Skip to main content

Automatically activate, and deactivate virutal environments when entering or leaving directories.

Project description

Venver

Automatically activate, and deactivate virutal environments when entering or leaving directories.

Installation

curl -LsSf https://codeberg.org/narvin/venver/raw/branch/main/bin/install.sh | sh

Once finished, the installation script will print additional instructions to configure your shell.

Usage

Let’s assume you have a python project with a virtual environment like this:

~/
├─ myapp/
│  ├─ .venv/
│  │   ...
│  ├─ src/
│  │   ...
│  ├─ .gitignore
│  ├─ pyproject.toml
│  ├─ README.rst

Add a .venver file to the project root.

cd ~/myapp
echo './.venv' > .venver
~/
├─ myapp/
│  ├─ .venv/
│  │   ...
│  ├─ src/
│  │   ...
│  ├─ .gitignore
│  ├─ .venver
│  ├─ pyproject.toml
│  ├─ README.rst

Navigating anywhere inside the myapp directory will result in the environment at myapp/.venv being activated. And navigating outside of myapp will deactivate the environment.

~ $ cd myapp
~/myapp (.venv) $ cd src
~/myapp/src (.venv) $ cd ~
~ $ cd myapp/src
~/myapp/src (.venv) $

If you manually deactivate the environment, it won’t be automatically activated again until you navigate outside of myapp, then reenter it.

~ $ cd myapp
~/myapp (.venv) $ deactivate
~/myapp $ cd src
~/myapp/src $ cd ~
~ $ cd myapp
~/myapp (.venv) $

You may specify an environment that isn’t in the project directory. This is useful if you have environments you want to reuse. The activation, and deactivation will still be relative to the .venver directory, and not the environment directory.

~/
├─ venvs/
│  ├─ web-venv/
│  │   ...
│  ├─ console-venv/
│  │   ...
cd ~/myapp
echo '~/venvs/web-venv' > .venver
~ $ cd myapp
~/myapp (web-venv) $ cd src
~/myapp/src (web-venv) $ cd ~
~ $ cd myapp/src
~/myapp/src (web-venv) $

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

venver-0.5.2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

venver-0.5.2-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file venver-0.5.2.tar.gz.

File metadata

  • Download URL: venver-0.5.2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for venver-0.5.2.tar.gz
Algorithm Hash digest
SHA256 fe57faaa5d5a434bff1944cf4f68ccea40e5bbdab04252f47328b362ad13c934
MD5 b33a1f51d891a9ad7701046a37d25ce8
BLAKE2b-256 42135019e87f23ae6cc5558c162d9f7949898c5f09e9e733f4fb9ab214864236

See more details on using hashes here.

File details

Details for the file venver-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: venver-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for venver-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1eaf6b0c6fd5fb3064eba7e2d6d90d4e6af3efc7204d296775ce7199ed254c2e
MD5 1f1a0e89bddb53c00f886ca2b19c2914
BLAKE2b-256 c2ed0c6ed2f42df09e7d059f864d42a050f52a892bee7c718bd6598bd55e38ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page