Venv

Qualified name: tin.apps.venvs.models.Venv

class Venv(*args, **kwargs)[source]

Bases: Model

A Python Virtual Environment.

Parameters:

Reverse relationships:

Parameters:

assignments (Reverse ForeignKey from Assignment) – All assignments of this venv (related name of venv)

Methods

get_absolute_url

get_activation_env

Returns information about the virtual environment.

install_packages

Install packages

list_packages

List all packages in a virtual environment.

Attributes

OUTPUT_MAX_LENGTH

assignments

Type: Reverse ForeignKey from Assignment

fully_created

Type: BooleanField

id

Type: BigAutoField

installing_packages

Type: BooleanField

name

Type: CharField

objects

package_installation_output

Type: CharField

path

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

get_activation_env() dict[str, str][source]

Returns information about the virtual environment.

Returns:

A dictionary with the keys

  • VIRTUAL_ENV: the path to the virtual environment

  • PATH: the modified $PATH variable

install_packages(pkgs: Iterable[str]) None[source]

Install packages

list_packages() list[list[str]] | None[source]

List all packages in a virtual environment.

TODO

This parses the output from pip freeze. Ideally, there should be a better way to do this.