venv command¶
The venv command manages the creation and management of one or multiple virtual environments for development or ci.
Create virtual environment¶
Create your default virtual environment¶
By default, senv will use conda
as your build system, and the channel conda-forge
. By running
$ senv venv install
generating lock files
---> 100%
installing dependencies with conda
---> 100%
Dependencies successfully installed
A new virtual environment with your project's name, was created along with the windows, macos, and linux lock files in the venv_locks_dir
.
This can be configured in the pyproject.toml file, see configure sections
Create a poetry environment along with the conda environment¶
$ senv venv install --build-system poetry
generating lock file
---> 100%
installing dependencies with poetry
---> 100%
Dependencies successfully installed
in this case, a poetry environment and a poetry.lock file was created
Activate your environment¶
You can activate your environment by simply running
$ senv venv shell
venv activate
Or activate using poetry with
$ senv venv shell --build-system poetry
venv activate
This flexibility can potentially be useful if you are planning to distribute you package with pypi and conda and you want to test both cases in CI.
Update your environment¶
If you want to update your dependencies (based on the constraints defined in pyproject.toml), you can run the update
command
$ senv venv update
generating lock file
---> 100%
installing dependencies with conda
---> 100%
Dependencies successfully installed
or update both multiple build-systems at the same time
$ senv venv update --build-system conda --build-system poetry
generating conda lock files
---> 100%
installing dependencies with conda
---> 100%
generating poetry lock file
---> 100%
installing dependencies with poetry
---> 100%
Environment susccessfully updated
Lock your environment¶
To just update the lock files without updating your environment, use lock
# you can also include mulple --build-system like in the command `update`
$ senv venv lock
generating lock file
---> 100%
Dependencies successfully installed
Configure your virtual environments¶
Full CLI documentation¶
venv_command¶
Usage:
senv venv [OPTIONS] COMMAND [ARGS]...
install¶
Installs both, the dependencies and the dev-dependencies in a a virtual environment.
This venv van be activated with senv venv shell
.
You can configure where the lock files will be stored with the key `tools.senv.venv.venv-lock-dir
Usage:
senv venv install [OPTIONS]
Options:
--build-system [conda|poetry] [default: (dynamic)]
lock¶
Usage:
senv venv lock [OPTIONS]
Options:
--build-system [conda|poetry] [default: (dynamic)]
--platforms TEXT conda platforms, for example osx-64 or
linux-64 [default: (dynamic)]
shell¶
Usage:
senv venv shell [OPTIONS]
Options:
--build-system [conda|poetry] [default: (dynamic)]
sync¶
Syncs the current venv with the lock files. Installs the missing dependencies and removes the ones that are not in the lock file
Usage:
senv venv sync [OPTIONS]
Options:
--build-system [conda|poetry] [default: (dynamic)]
update¶
Updates the lock files and install the dependencies in your venv based on the constrains defined in the pyproject.toml
Usage:
senv venv update [OPTIONS]
Options:
--build-system [conda|poetry] [default: (dynamic)]
--platforms TEXT conda platforms, for example osx-64 or
linux-64 [default: (dynamic)]