Skip to main content

Venvception

GitHub Workflow Status (with event)

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

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:

pip install venvception

Quick Start / Usage

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

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:

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.

Metadata

Release files for venvception 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for venvception 0.0.5
File Size Uploaded
venvception-0.0.5.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for venvception 0.0.5
File Interpreter ABI Platform
venvception-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / venvception-0.0.5.tar.gz

Download URL venvception-0.0.5.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d947332bef0ae911f117eedd21f457dd1abd0f34c8aee1cc89c4daef6dc239f0
BLAKE2b-256 checksum
How to use checksums
fee9ef8ed5fd8864400fd30b73ae3c64ccc7934c54059502f0a750a1123ddca1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / venvception-0.0.5-py3-none-any.whl

Download URL venvception-0.0.5-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cace2eb4e7f0ace1330bac8b1f5bdeed8b2c1dae8a5affc413efde7b21884f53
BLAKE2b-256 checksum
How to use checksums
e8cca58aa9332be75a1af80f10120026f0c85ef58b9676a4b7db3cc333a4af91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page