Fish shell tool for managing Python virtual environments

Overview

VirtualFish

Build Status PyPI Version

VirtualFish is a Python virtual environment manager for the Fish shell.

You can get started by reading the documentation. (It’s quite short… Promise!)

You can also get help on #virtualfish on OFTC (ircs://irc.oftc.net:6697/#virtualfish), the same network as the Fish IRC channel.

VirtualFish is currently maintained by Justin Mayer, and was originally created by Leigh Brenecki.

A quickstart, for the impatient

👉 Fish version 3.1 or higher is required. 👈

  1. python -m pip install virtualfish
  2. vf install
  3. Add VirtualFish to your prompt
  4. vf new myvirtualenv; which python

Read the documentation to find out more about project management, environment variable automation, auto-activation, and other plugins, as well as extending VirtualFish with events, virtualenvwrapper emulation, and more.

Comments
  • VirtualFish is not accessible after simple pip install

    VirtualFish is not accessible after simple pip install

    • [x] I am using Fish shell version 3.1 or higher.
    • [x] I am using Python version 3.6 or higher.
    • [x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
    • OS version and name: macOS Catalina version: 10.15.4
    • Fish shell version: 3.1.2
    • VirtualFish version: 2.2.3

    Issue

    I am using VirtualFish for a while but recently I have changed my computer (given by the company) and I needed to configure my environment once again after a long time not doing that.

    I have followed the instruction placed in README.md file and unfortunately, I found a problem with triggering the second command 😕 The main problem is that vf command can't be recognized as a global command for my machine. I suppose that this problem can be connected somehow with my computer, not with a particular bug in the library but the installation process with the usage of pip package installer didn't inform me about that 🤷‍♀️

    I have installed VirtualFish with the usage of directly run cli.py module with the install argument and it works like a charm 🙌 but I am pretty sure that something should be updated: either documentation or code 🧐

    bug 
    opened by redlickigrzegorz 22
  • Add environment plugin

    Add environment plugin

    Add environment plugin and documentation

    This is built largely on the existing work of shanx in https://github.com/adambrenecki/virtualfish/pull/39 and the ideas in #92 by adambreneck. This should address #92 and my manual testing was successful. Please let me know if there are any improvements that I can make.

    opened by zsommers 20
  • How to update vf after brew update

    How to update vf after brew update

    I tried doing a brew update and brew upgrade, which updated my python from 3.7 to 3.8. Sadly I see I was not able to uninstall and reinstall vf becuase of the following issue

    fish: Unknown command: /usr/local/opt/python/bin/python3.7
    /usr/local/lib/python3.7/site-packages/virtualfish/virtual.fish (line 542):
        $python -m virtualfish.loader.installer uninstall
        ^
    in function '__vf_uninstall'
            called on line 1 of file /usr/local/lib/python3.7/site-packages/virtualfish/virtual.fish
    in function 'vf' with arguments 'uninstall'
    VirtualFish has been uninstalled from this shell.
    Run 'exec fish' to reload Fish.
    Note that the Python package will still be installed and needs to be removed separately (e.g. using 'pip uninstall virtualfish').
    

    Sorry of about my ignorance, after some debug and analysis I see that ~/.confg/fish/conf.d/virtuafish-loader.fish was still pointing to older python in my case 3.7.

    How to overcome these issues ?? Is there a way to update vf in cleaner way ?

    question 
    opened by kameshsampath 13
  • fish: Unknown command 'vf'

    fish: Unknown command 'vf'

    I installed virtualfish earlier today and it worked fine, but I was having some issues and decided to uninstall and reinstall. Now vf isn't recognized.

    config.fish contains: eval (python -m virtualfish)

    command line outputs:

    fish --version:
    fish, version 2.3.1

    python -m virtualfish compat_aliases: set -g VIRTUALFISH_VERSION 1.0.5;set -g VIRTUALFISH_PYTHON_EXEC /usr/bin/python;. /Library/Python/2.7/site-packages/virtualfish/virtual.fish;. /Library/Python/2.7/site-packages/virtualfish/compat_aliases.fish;emit virtualfish_did_setup_plugins

    functions: ., N_, abbr, alias, assert, assert.error_message, assert.expand_operator, autoload, available, cd, contains_seq, delete-or-exit, dirh, dirs, down-or-search, eval, export, fish-spec, fish_config, fish_default_key_bindings, fish_fallback_prompt, fish_indent, fish_mode_prompt, fish_prompt, fish_sigtrap_handler, fish_update_completions, fish_user_key_bindings, fish_vi_cursor, fish_vi_key_bindings, fish_vi_mode, fisher, fnode, frub, fruby, fsub, fsubl, fuck, funced, funcsave, getopts, git_ahead, git_branch_name, git_is_dirty, git_is_repo, git_is_staged, git_is_stashed, git_is_touched, git_untracked, grep, help, history, hostname, isatty, la, ll, ls, man, math, nextd, nextd-or-forward-word, omf, omf.bundle.add, omf.bundle.install, omf.bundle.remove, omf.channel.get, omf.channel.set, omf.check.fish_prompt, omf.check.version, omf.cli.cd, omf.cli.channel, omf.cli.describe, omf.cli.destroy, omf.cli.doctor, omf.cli.help, omf.cli.install, omf.cli.list, omf.cli.new, omf.cli.reload, omf.cli.remove, omf.cli.search, omf.cli.theme, omf.cli.themes.list, omf.cli.update, omf.cli.version, omf.core.update, omf.destroy, omf.doctor, omf.index.path, omf.index.query, omf.index.repositories, omf.index.stat, omf.index.update, omf.packages.cd, omf.packages.install, omf.packages.list, omf.packages.name, omf.packages.new, omf.packages.path, omf.packages.remove, omf.packages.run_hook, omf.packages.update, omf.packages.valid_name, omf.reload, omf.repo.clone, omf.repo.pull, omf.theme.set, omf.version, omf.xdg.config_home, omf::dim, omf::em, omf::err, omf::off, omf::under, open, popd, prevd, prevd-or-backward-word, prompt_pwd, prompt_segments, psub, pushd, realpath, refresh, require, rvm, seq, setenv, string, suspend, trap, type, umask, up-or-search, vared, z, zo,

    pip freeze: altgraph==0.10.2 bdist-mpkg==0.5.0 bonjour-py==0.3 click==6.7 macholib==1.5.1 matplotlib==1.3.1 modulegraph==0.10.4 numpy==1.8.0rc1 pbr==1.10.0 py2app==0.7.3 pyobjc-core==2.5.1 pyobjc-framework-Accounts==2.5.1 pyobjc-framework-AddressBook==2.5.1 pyobjc-framework-AppleScriptKit==2.5.1 pyobjc-framework-AppleScriptObjC==2.5.1 pyobjc-framework-Automator==2.5.1 pyobjc-framework-CFNetwork==2.5.1 pyobjc-framework-Cocoa==2.5.1 pyobjc-framework-Collaboration==2.5.1 pyobjc-framework-CoreData==2.5.1 pyobjc-framework-CoreLocation==2.5.1 pyobjc-framework-CoreText==2.5.1 pyobjc-framework-DictionaryServices==2.5.1 pyobjc-framework-EventKit==2.5.1 pyobjc-framework-ExceptionHandling==2.5.1 pyobjc-framework-FSEvents==2.5.1 pyobjc-framework-InputMethodKit==2.5.1 pyobjc-framework-InstallerPlugins==2.5.1 pyobjc-framework-InstantMessage==2.5.1 pyobjc-framework-LatentSemanticMapping==2.5.1 pyobjc-framework-LaunchServices==2.5.1 pyobjc-framework-Message==2.5.1 pyobjc-framework-OpenDirectory==2.5.1 pyobjc-framework-PreferencePanes==2.5.1 pyobjc-framework-PubSub==2.5.1 pyobjc-framework-QTKit==2.5.1 pyobjc-framework-Quartz==2.5.1 pyobjc-framework-ScreenSaver==2.5.1 pyobjc-framework-ScriptingBridge==2.5.1 pyobjc-framework-SearchKit==2.5.1 pyobjc-framework-ServiceManagement==2.5.1 pyobjc-framework-Social==2.5.1 pyobjc-framework-SyncServices==2.5.1 pyobjc-framework-SystemConfiguration==2.5.1 pyobjc-framework-WebKit==2.5.1 pyOpenSSL==0.13.1 pyparsing==2.0.1 python-dateutil==1.5 pytz==2013.7 scipy==0.13.0b1 six==1.4.1 virtualenv==15.1.0 virtualfish==1.0.5 xattr==0.6.4 zope.interface==4.1.1

    opened by KristaProkop 13
  • Improve `vf install` behavior when already installed

    Improve `vf install` behavior when already installed

    According to https://virtualfish.readthedocs.io/en/latest/plugins.html, vf install <plugin> should work, however I get:

    $ vf install auto_activation
    VirtualFish is already installed! Hooray!
    

    Version is 2.0.1.

    opened by zx8 12
  • Fails to create python 3 virtualenv

    Fails to create python 3 virtualenv

    $ vf new --python=/usr/local/bin/python3 finance-scraper3
    Running virtualenv with interpreter /usr/local/bin/python3
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 14, in <module>
        import shutil
      File "/usr/local/Cellar/python3/3.4.0/Frameworks/Python.framework/Versions/3.4/lib/python3.4/shutil.py", line 11, in <module>
        import fnmatch
      File "/usr/local/Cellar/python3/3.4.0/Frameworks/Python.framework/Versions/3.4/lib/python3.4/fnmatch.py", line 15, in <module>
        import functools
      File "/usr/local/Cellar/python3/3.4.0/Frameworks/Python.framework/Versions/3.4/lib/python3.4/functools.py", line 21, in <module>
        from collections import namedtuple
      File "/usr/local/Cellar/python3/3.4.0/Frameworks/Python.framework/Versions/3.4/lib/python3.4/collections/__init__.py", line 17, in <module>
        from reprlib import recursive_repr as _recursive_repr
      File "/usr/local/lib/python2.7/site-packages/reprlib.py", line 3, in <module>
        from repr import *
    ImportError: No module named 'repr'
    Error: The virtualenv wasn't created properly.
    virtualenv returned status 1.
    
    opened by saulshanabrook 12
  • Support for postactivate

    Support for postactivate

    Hi, I've started to use your virtualfish and I like it. Would it be possible to add support for postactivate actions? With virtualenvwrapper I can put this into bin/postactivate:

    !/bin/bash

    This hook is run after this virtualenv is activated.

    PROJECT_PATH=/path/to/project export DJANGO_SETTINGS_MODULE=project.settings export PYTHONPATH=$PROJECT_PATH/src cd $PROJECT_PATH

    Also, aliases from acvirtualenv to workon might be handy.

    enhancement 
    opened by stereoit 11
  • Add `vf upgrade $venv` to upgrade major/minor Python versions

    Add `vf upgrade $venv` to upgrade major/minor Python versions

    Stock Python venv module has an --upgrade function that lets you upgrade virtualenvs created via that, but that doesn't seem to work with virtualfish created venvs. Having a similar mode for vf (e.g., vf upgrade $venv) would be great.

    opened by Freso 10
  • Opt-out warning if $VIRTUAL_ENV does not appear in fish_prompt

    Opt-out warning if $VIRTUAL_ENV does not appear in fish_prompt

    • [x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
    • [x] I have searched the documentation and believe that my question is not covered.
    • [x] I am willing to lend a hand to help implement this feature.

    Feature Request

    #113 added (via 9020ed6) a warning message if the name of the virtualenv does not appear in the fish_prompt.

    I use the fish_right_prompt to display this piece of information, and thus get the warning on every activation. This is annoying and currently cannot be suppressed other than by patching the source.

    What about:

    • checking fish_right_prompt as well?
    • adding an option (at install time? as an environment variable?) to disable the check overall?

    The check in 9020ed6 also has the shortcoming that it wrongly succeeds if e.g. the working directory path contains the name of the virtualenv. But this is IMHO a minor issue.

    enhancement 
    opened by airwoodix 9
  • workon alias doesn't cd, vf workon does

    workon alias doesn't cd, vf workon does

    Both the alias and the original command activate the virtualenv, but only the former doesn't cd to the project dir. Tried both version 1.0.5 and latest from github 1.0.6.dev20+g64f7675 this is what happens to me right now:

    ~/ workon myproject
    (myenv) ~/ deactivate
    ~/ vf workon myproject
    (myenv) ~/d/myproject
    

    These are my related fish config lines:

    set -x PROJECT_HOME ~/dev
    set -x VIRTUAL_ENV_DISABLE_PROMPT 1  # avoid dupe venv in PS
    eval (python -m virtualfish projects compat_aliases)
    
    opened by asfaltboy 9
  • error activating virtualenv

    error activating virtualenv

    hi adam,

    thanks for your work first! I really like fish and I feel thankful for people who are writing code for it!

    I ran into a problem when I activated my first environment:

    christoph@christoph ~/k/dev> vf activate myenv
    activate myenv
    fish: Could not expand string '$argv[0..1]'
    /usr/local/bin/virtual.fish (line 49):  echo $argv[0..1]
                                                        ^
    in function 'vf',
        called on standard input,
        with parameter list 'activate myenv'
    

    I consulted the fish documentation (I don't know too much about it) and understood your code, but honestly I have no idea why it does not work.

    Finally I made a fast but not elegant fix:

            set scargs $argv[2]
            #set scargs $argv[2..-1]
    

    Maybe other people might be affected too? Do you know why the error is popping up?

    opened by christophlingg 9
  • vf upgrade: ‘sed’ cannot find [an undisclosed] file

    vf upgrade: ‘sed’ cannot find [an undisclosed] file

    • [x] I am using Fish shell version 3.1 or higher.
    • [x] I am using Python version 3.6 or higher.
    • [x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
    • [x] If related to a plugin, I prefixed the issue title with the name of the plugin.
    • OS version and name: Rolling ArchLinux
    • Fish shell version: 3.5.1
    • VirtualFish version: 2.5.5

    Issue

    TL;DR: vf upgrade fails with “sed: can't read : No such file or directory” and I have no idea which file vf is talking about.

    I have exactly one virtual environment, toot, that holds the newest version on the PyPI package by the same name.

    $ cat ~/.virtualenvs/global_requirements.txt
    pip
    wheel
    setuptools
    

    When I attempted to upgrade the envuironment, all I got was an unhelpful error:

    $ vf upgrade toot
    Upgrading toot from 3.10.8 to 3.10.8
    sed: can't read : No such file or directory
    

    I'm unsure how to proceed.

    bug 
    opened by kseistrup 0
  • Improve docs for systems without a interpreter linked to `python`

    Improve docs for systems without a interpreter linked to `python`

    • [ x] I have searched the issues (including closed ones) and believe that this is not a duplicate.

    Issue

    The installation instructions assume that the user has an interpreter or path linked to python which is not the case any more on newer macOS systems like macOS Ventura. Therefore to ease installation on these systems I think the installation instructions could be a little bit more clear as my first guess how to handle it on the new systems didn't work.

    Steps that I took before installing Virtual Fish

    • Install Homebrew
      • Install Fish
      • Install Pyenv
    • install apple Xcode command line tools

    Installation steps Virtual Fish

    As suggested by the docs

    • python -m pip install --user virtualfish -> not possible result : fish: Unknown command: python Knowing that python is sometimes linked to python2 and not 3
    • python3 -m pip install --user virtualfish -> installation succesfull
    • vf install -> fish: Unknown command: vf

    My opinion is that an improvement can be made to the docs, do you agree ? Or should the user be aware of installing using venv or something similar?

    Docs

    So given this information where should virtual fish ideally been installed? I have seen the brew python being used or should the user create a symlink between python and python3? Or should it be installed in each virtual environment?

    docs 
    opened by Jeroendevr 2
  • bin folder isn't added to path correctly for Python3.10 (local/bin/ isn't used)

    bin folder isn't added to path correctly for Python3.10 (local/bin/ isn't used)

    • [x] I am using Fish shell version 3.1 or higher.
    • [x] I am using Python version 3.6 or higher.
    • [x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
    • [x] If related to a plugin, I prefixed the issue title with the name of the plugin.
    • OS version and name: Ubuntu 20.04.5 LTS
    • Fish shell version: 3.5.1
    • VirtualFish version: 2.5.3

    Issue

    When creating a venv with python3.10 (in my case 3.10.7), the bin folder is located under <venv>/local/bin/, not simply <venv>/bin. I've looked at the virtualfish source code a bit and it seems this is never explicitly handled, it's just assumed that bin. This is also evidenced by the fact that echoing $PATH shows bin instead of local/bin. And yes, python3.10 is in my path.

    To reproduce:

    • Install virtualfish
    • Install python3.10

    image

    bug 
    opened by AlmightyYakob 3
  • What does vf check when it decides an env is

    What does vf check when it decides an env is "broken" ?

    • [x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
    • [x] If related to a plugin, I prefixed the issue title with the name of the plugin.

    Issue

    hi there, long time user, was noticing this fancy "broken" descriptor in vf --ls and was curious what it means/what it checks? There doesn't seem to be any mention of what triggers vf as detecting a venv as "broken" and/or what it means for "upgrade" to fix them.

    after a bit of troubleshooting, it looks like vf checks the status of python -m pip & throws away the output. I had a few venv's that i had created with --no-pip and that was the issue.

    docs 
    opened by amj 4
  • Autocompletions for Python installs via Pyton.org Mac installer

    Autocompletions for Python installs via Pyton.org Mac installer

    This brings the two previous commits together by adding autocompletions for Python versions installed with Python.org's Mac installer. It adds another valid option to the VIRTUALFISH_PYVERSION_COMPLETION environment variable and an extra function to provide autocompletions of Python versions installed in /Library/Frameworks/Python.framework/Versions

    Note that this already includes #220 and #221 because it depends on them. This only adds the extra function in __vfsupport_setup_autocomplete and slightly adjusts the docs.

    opened by sbaack 0
  • Improve detection of installed Python version

    Improve detection of installed Python version

    First, this commit adds detection of Python versions installed via Python.org's Mac OS installers (which are installed in /Library/Frameworks/Python.framework/Versions/). virtualfish will prefer Python.org installations over Homebrew Python, but asdf, pyenv, or pythonz are preferred over Python.org installs.

    Second, this commit fixes an issue in how Python versions are deteced when calling vf new -p or vf upgrade -p. Before this commit, virtualfish checked if various executables are available, but didn't continue to search if the specified Python version has not been installed in the first available application. For example, if pyenv is installed but the specified Python version has not been installed with pyenv, virtualfish will directly fall back to pass to Virtualenv as-is instead of continuing the search in, say, pythonz or Homebrew.

    While it is unlikely that one would have both pyenv and pythonz installed, continuing to search for a Python version if it hasn't been installed in the first application found is useful with regards to detecting Python.org installs. One might mostly use pyenv, but has issues compiling a particular Python version with it and therefore installs it with Python.org's Mac installer.

    opened by sbaack 0
Releases(2.5.5)
Owner
Justin Mayer
Justin Mayer
Virtual Python Environment builder

virtualenv A tool for creating isolated virtual python environments. Installation Documentation Changelog Issues PyPI Github Code of Conduct Everyone

Python Packaging Authority 4.3k Dec 30, 2022
A fast and easy python virtual environment creator for linux with some pre-installed libraries.

python-venv-creator A fast and easy python virtual environment created for linux with some optional pre-installed libraries. Dependencies: The followi

null 2 Apr 19, 2022
This tool is used to install `pyenv` and friends.

pyenv installer This tool installs pyenv and friends. It is inspired by rbenv-installer. Prerequisites In general, compiling your own Python interpret

pyenv 3.5k Jan 3, 2023
Simple Python version management

Simple Python Version Management: pyenv pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UN

pyenv 30.1k Jan 4, 2023
Python Development Workflow for Humans.

Pipenv: Python Development Workflow for Humans [ ~ Dependency Scanning by PyUp.io ~ ] Pipenv is a tool that aims to bring the best of all packaging wo

Python Packaging Authority 23.5k Jan 1, 2023
Python virtualenvs in Debian packages

dh-virtualenv Contents Overview Presentations, Blogs & Other Resources Using dh-virtualenv How does it work? Running tests Building the package in a D

Spotify 1.5k Jan 2, 2023
a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)

pyenv-virtualenv pyenv-virtualenv is a pyenv plugin that provides features to manage virtualenvs and conda environments for Python on UNIX-like system

pyenv 5.3k Jan 8, 2023
A simple but powerful Python packer to run any project with any virtualenv dependencies anywhwere.

PyEmpaq A simple but powerful Python packer to run any project with any virtualenv dependencies anywhwere. With PyEmpaq you can convert any Python pro

Facundo Batista 23 Sep 22, 2022
Define requirements inside your python code and scriptenv makes them ready to import.

scriptenv Define requirements inside your python code and scriptenv makes them ready to import. Getting Started Install scriptenv $ pip install script

Stefan Hoelzl 6 Nov 4, 2022
💻VIEN is a command-line tool for managing Python Virtual Environments.

vien VIEN is a command-line tool for managing Python Virtual Environments. It provides one-line shortcuts for: creating and deleting environments runn

Artёm IG 5 Mar 19, 2022
(BionicLambda Universal SHell) A simple shell made in Python. Docs and possible C port incoming.

blush ?? (BionicLambda Universal SHell) A simple shell made in Python. Docs and possible C port incoming. Note: The Linux executables were made on Ubu

null 3 Jun 30, 2021
ICMP Reverse Shell written in Python 3 and with Scapy (backdoor/rev shell)

icmpdoor - ICMP Reverse Shell icmpdoor is an ICMP rev shell written in Python3 and scapy. Tested on Ubuntu 20.04, Debian 10 (Kali Linux), and Windows

Jeroen van Kessel 206 Dec 29, 2022
Kubernetes shell: An integrated shell for working with the Kubernetes

kube-shell Kube-shell: An integrated shell for working with the Kubernetes CLI Under the hood kube-shell still calls kubectl. Kube-shell aims to provi

CloudNative Labs 2.2k Jan 8, 2023
Bear-Shell is a shell based in the terminal or command prompt.

Bear-Shell is a shell based in the terminal or command prompt. You can navigate files, run python files, create files via the BearUtils text editor, and a lot more coming up!

MichaelBear 6 Dec 25, 2021
Bear-Shell is a shell based in the terminal or command prompt.

Bear-Shell is a shell based in the terminal or command prompt. You can navigate files, run python files, create files via the BearUtils text editor, and a lot more coming up!

MichaelBear 6 Dec 25, 2021
iTerm2 Shell integration for Xonsh shell.

iTerm2 Shell Integration iTerm2 Shell integration for Xonsh shell. Installation To install use pip: xpip install xontrib-iterm2 # or: xpip install -U

Noorhteen Raja NJ 6 Dec 29, 2022
Discord-shell - Reverse shell accessible via discord.py bot

Discord-shell reverse shell on discord bot. (STILL IN DEVELOPMENT) Installation

Skultz 6 Oct 21, 2022
Manage python virtual environments on the working notebook server

notebook-environments Manage python virtual environments on the working notebook server. Installation It is recommended to use this package together w

Vladislav Punko 44 Nov 2, 2022
Lsp Plugin for working with Python virtual environments

py_lsp.nvim What is py_lsp? py_lsp.nvim is a neovim plugin that helps with using the lsp feature for python development. It tackles the problem about

Patrick Haller 55 Dec 27, 2022