API docs

Internal API


Autovenv helps you manage your virtual environments.

class autovenv.VirtualEnvs(data_dir=None, home=None, cwd=None)

This is where the action happens.


Returns the name of the virtualenvironment that should be active for this project. If we’re not within a project, return an empty string.


Gets the name of the non-system python to use. This is the version specified in the .python-version file in the project root (if it exists), or else the version set with “autovenv choose (name)”.

If neither of these two conditions apply, this will return None, and so the system python will be used.


If a virtual environment is activated, return that virtual environment’s (folder) name.

Otherwise, return an empty string.


Returns the path of the currently active virtual environment.


If a virtual environment is activated, return the path to the python executable. Otherwise, return None.


If we’re within a python project, return the path to the root of that project. Otherwise, return None.


Make a new virtual environment with the given name.


Generates the correct bash command to make sure that the appropriate virtualenv is activated for the project folder you’re in (or to deactivate if you’re not in a project folder).


Entry point for the ‘autovenv’ command.

Simply creates a VirtualEnvs object with default parameters, and runs the command via that.

Creates a symlink. If a symlink of this link name already exists, replace it.