Metadata-Version: 2.4
Name: venver
Version: 0.5.1
Summary: Automatically activate, and deactivate virutal environments when entering or leaving directories.
Author: Narvin Singh
Author-email: Narvin Singh <Narvin.A.Singh@gmail.com>
License-Expression: LicenseRef-no-ai-ethical-license
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Requires-Dist: python-docs-theme~=2025.2 ; extra == 'doc'
Requires-Dist: sphinx~=8.1 ; extra == 'doc'
Requires-Python: >=3.10
Project-URL: Homepage, https://venver.readthedocs.io
Project-URL: Documentation, https://venver.readthedocs.io
Project-URL: Repository, https://codeberg.org/venver
Project-URL: Issues, https://codeberg.org/venver/issues
Provides-Extra: doc
Description-Content-Type: text/x-rst

Venver
######

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

Installation
############

.. code-block:: shell

    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:

.. code-block::

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

Add a ``.venver`` file to the project root.

.. code-block:: shell

    cd ~/myapp
    echo './.venv' > .venver

.. code-block::

    ~/
    ├─ 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.

.. code-block:: console

    ~ $ 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.

.. code-block:: console

    ~ $ 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.

.. code-block::

    ~/
    ├─ venvs/
    │  ├─ web-venv/
    │  │   ...
    │  ├─ console-venv/
    │  │   ...

.. code-block:: shell

    cd ~/myapp
    echo '~/venvs/web-venv' > .venver

.. code-block:: console

    ~ $ cd myapp
    ~/myapp (web-venv) $ cd src
    ~/myapp/src (web-venv) $ cd ~
    ~ $ cd myapp/src
    ~/myapp/src (web-venv) $
