Metadata-Version: 2.1
Name: venvception
Version: 0.0.2
Summary: Install requirements and run code in virtual environments from the comfort of your own GIL
Author-email: Nathan Zimmerman <npzimmerman@gmail.com>
License: MIT
Project-URL: homepage, https://github.com/moradology/venvception
Project-URL: repository, https://github.com/moradology/venvception.git
Keywords: virtualenv,dependencies
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest >=8.0.0 ; extra == 'dev'
Requires-Dist: pytest-cov >=4.1.0 ; extra == 'dev'
Provides-Extra: lint
Requires-Dist: black >=23.9.1 ; extra == 'lint'
Requires-Dist: isort >=5.13.0 ; extra == 'lint'
Requires-Dist: flake8 >=7.0.0 ; extra == 'lint'
Requires-Dist: Flake8-pyproject >=1.2.3 ; extra == 'lint'
Requires-Dist: mypy >=1.8.0 ; extra == 'lint'
Requires-Dist: pre-commit >=3.4.0 ; extra == 'lint'
Requires-Dist: pytest >=8.0.0 ; extra == 'lint'
Requires-Dist: pytest-cov >=4.1.0 ; extra == 'lint'
Requires-Dist: tox >=4.11.3 ; extra == 'lint'

# Venvception

[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/moradology/venvception/cicd.yaml?style=for-the-badge)](https://github.com/moradology/venvception/actions/workflows/cicd.yaml)

Venvception is a Python library designed to simplify the process of creating and using temporary virtual environments when you have good reason to stay in the same process. It provides a context manager that automates the setup of a virtual environment, installs specified packages from a `requirements.txt` file, and ensures that the environment is used for the duration of the context.

![venvception in action](venvception.png)

## Why?

In distributed contexts, it can be convenient to ship a requirements specification rather than pre-baking containers. This library is quick and dirty.

## Installation

To install Venvception, run the following command:

```bash
pip install venvception
```

## Quick Start / Usage

Here's a simple example to get started with Venvception:

```python
from venvception import venv
from pathlib import Path

# Specify the path to your requirements file
requirements_path = Path("path/to/your/requirements.txt")

# Use the venv context manager to create and activate the virtual environment
with venv(requirements_path) as venv_path:
    # Import a module from the requirements.txt
    import your_module

    # You can also access the path to the virtual environment via `venv_path`
    print(f"Virtual environment created at: {venv_path}")
```

Ensure your `requirements.txt` file is properly formatted and accessible at the specified path.

### Accessing the Virtual Environment's Path

The context manager yields the path to the temporary virtual environment, allowing you to interact with it directly:

```python
with venv(Path("requirements.txt")) as venv_path:
    print(venv_path)
```

## Contributing

Contributions to Venvception are welcome! Please feel free to submit pull requests, report bugs, or suggest features through the issue tracker.

## License

Venvception is released under the [MIT License](LICENSE).
