API docs

Internal API

autovenv

Autovenv helps you manage your virtual environments.

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

This is where the action happens.

correct_venv_name

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

current_pythonbuild_name

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.

current_venv_name

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

Otherwise, return an empty string.

current_venv_path

Returns the path of the currently active virtual environment.

current_venv_python_path

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

likely_projfolder

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

make_virtualenv(name)

Make a new virtual environment with the given name.

suggested_command(shell=u'bash')

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).

autovenv.do_command()

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.