universal python virtual environment finder
Project description
libsoulsearching
universal python virtual environment finder
installation
pip install libsoulsearching
quickstart
from libsoulsearching import find_venv, find_all_venvs, ToolType
# find the first/best venv
info = find_venv("/path/to/project")
if info:
print(f"found {info.tool.value} venv at {info.venv_path}")
# find all venvs
all_venvs = find_all_venvs("/path/to/project")
for venv in all_venvs:
print(f"{venv.tool.value}: {venv.venv_path}")
# find specific tool only
poetry_venv = find_venv("/path/to/project", tool=ToolType.POETRY)
supported tools
- poetry -
poetry.lock,pyproject.tomlwith poetry config - pipenv -
pipfile.lock - pdm -
pdm.lock,.pdm.toml - uv -
uv.lock,.venv - rye -
rye.lock,.python-version - hatch -
pyproject.tomlwith[tool.hatch.envs] - venv -
.venv/pyvenv.cfg - pyenv -
.python-version
cli usage
# find first venv
venvfinder /path/to/project
# list all venvs
venvfinder /path/to/project --all
# find specific tool
venvfinder /path/to/project --tool poetry
# json output
venvfinder /path/to/project --json
api reference
- libsoulsearching.find_venv
- libsoulsearching.find_all_venvs
- libsoulsearching.ToolType
- libsoulsearching.VenvInfo
def libsoulsearching.find_venv()
find a virtual environment in the given project directory
-
signature:
def find_venv( project_root: str | Path, tool: ToolType | None = None, ) -> VenvInfo | None: ...
-
arguments:
project_root: str | Pathpath to the project directorytool: ToolType | Nonespecific tool to detect. if none, uses priority order
-
returns:
VenvInfo | Nonevenvinfo if a venv is found, none otherwise
def libsoulsearching.find_all_venvs()
find all virtual environments in the given project directory
returns all detected venvs in priority order, including potentially invalid ones (is_valid=false) if the tool's marker files exist but the actual venv is missing
-
signature:
def find_all_venvs(project_root: str | Path) -> list[VenvInfo]: ...
-
arguments:
project_root: str | Pathpath to the project directory
-
returns:
list[VenvInfo]list of venvinfo objects (may be empty)
class libsoulsearching.ToolType
enumeration of supported python environment management tools
- attributes:
POETRY: strpoetry package managerPIPENV: strpipenv package managerPDM: strpdm package managerUV: struv package managerRYE: strrye package managerHATCH: strhatch package managerVENV: strstandard venv modulePYENV: strpyenv version managerENV_VAR: strvirtual environment from environment variable
class libsoulsearching.VenvInfo
information about a detected python virtual environment
- attributes:
tool: ToolTypethe detected tool typevenv_path: Path | Nonepath to the virtual environment directorypython_executable: Path | Nonepath to the python executablepython_version: str | Nonepython version string (e.g., "3.10.5")is_valid: boolwhether the detected environment exists and is valid
licence
mit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libsoulsearching-0.1.0-py3-none-any.whl.
File metadata
- Download URL: libsoulsearching-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c4c19ba1c86ff9eca074354de0ccf83c8246803aec4596ec8c9e7c25a568ef8
|
|
| MD5 |
11db4de4ea22744c39f2a9eb0fae8616
|
|
| BLAKE2b-256 |
1168a906f0912d2c40097003f940e070a1a0532ede4269bf50344e7b75f1e5ee
|