Skip to content

Env

invoke_tasklib.env

Environment and dependency management tasks.

invoke_tasklib.env.create_venv

create_venv(c: Context) -> None

Create a virtual environment and install invoke.

Note

The virtual environment will be created in the .venv directory and any existing environment will be cleared.

invoke_tasklib.env.install

install(
    c: Context,
    optional_deps: bool = True,
    groups: str | None = None,
) -> None

Install project dependencies and the package in editable mode.

Parameters:

Name Type Description Default
c Context

The invoke context.

required
optional_deps bool

If True, install all optional dependencies defined in the project extras. Default is True.

True
groups str | None

Comma-separated list of dependency groups to install, e.g. "dev,docs". Use an empty string to install no group. Defaults to the tasklib.groups.install config value ("dev" unless overridden in invoke.yaml).

None

invoke_tasklib.env.show_installed_packages

show_installed_packages(c: Context) -> None

Show the installed packages.

invoke_tasklib.env.show_python_config

show_python_config(c: Context) -> None

Show the python configuration.

invoke_tasklib.env.update

update(c: Context, groups: str | None = None) -> None

Update dependencies and pre-commit hooks to their latest versions.

Parameters:

Name Type Description Default
c Context

The invoke context.

required
groups str | None

Comma-separated list of dependency groups to reinstall after updating, e.g. "dev,docs". Defaults to the tasklib.groups.update config value ("dev,docs" unless overridden in invoke.yaml).

None
Warning

This may introduce breaking changes. Review the changes and run tests after updating.