diff --git a/.gitignore b/.gitignore index ebc2458..883145f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __pycache__/ .pytest_cache/ .ruff_cache/ .venv/ +tempyenv diff --git a/README.md b/README.md index abd1202..83ea88a 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ tempyenv Description =========== -An easy and quick way to create a temporary Python virtual environment. +The easy and quick way to create a temporary Python virtual environment. -tempyenv sets up a python environment in a temporary path. +`tempyenv` sets up a python environment in a temporary path and auto removes the environment when you exit. [![Build Status](https://app.travis-ci.com/outbit/tempyenv.svg?branch=develop "ansible-docs latest build")](http://travis-ci.org/outbit/tempyenv) [![PIP Version](https://img.shields.io/pypi/v/tempyenv.svg "tempyenv PyPI version")](https://pypi.python.org/pypi/tempyenv) @@ -15,6 +15,12 @@ tempyenv sets up a python environment in a temporary path. Installation =========== +Using [uv](https://docs.astral.sh/uv/) (recommended): +```shell +$ uv tool install tempyenv +``` + +Using pip: ```shell $ python -m pip install tempyenv ``` @@ -27,14 +33,11 @@ $ tempyenv (tempyenv) is setting up your virtual environment...hold tight Virtual environment created at /var/folders/4b/dnp21z017cg_rbgfdtzclqlm0000gn/T/tmpacwjkg5z/venv Virtual environment loading from /var/folders/4b/dnp21z017cg_rbgfdtzclqlm0000gn/T/tmpacwjkg5z/venv -(tempyenv)(venv) $ echo "now you can pip install in your virtual environment" -``` - -For a shorter command option, use: -```bash -$ tenv -or -$ tempyenv +(tempyenv)$ which pip +/var/folders/j4/skpmllqx5ls_6s4kn3l25gq00000gn/T/tmpo5a2dwmh/venv/bin/pip +(tempyenv)$ exit +Cleaning up temporary virtual environment... +Temporary environment removed successfully. ``` Help @@ -51,13 +54,7 @@ options: To specify a specific version of python ```bash -$ tempyenv -p python3.10 -``` - -or - -```bash -$ python3.10 -m tempyenv +$ tempyenv -p python3.14 ``` License diff --git a/pyproject.toml b/pyproject.toml index ce07c40..7309529 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,6 @@ build-backend = "setuptools.build_meta" [project.scripts] tempyenv = "tempyenv.cli:main" -tmpyenv = "tempyenv.cli:main" -tenv = "tempyenv.cli:main" [tool.setuptools] package-dir = {"" = "src"} diff --git a/src/tempyenv/cli.py b/src/tempyenv/cli.py index 2bece2d..b78f176 100644 --- a/src/tempyenv/cli.py +++ b/src/tempyenv/cli.py @@ -39,7 +39,7 @@ def load_virtual_environment(self): current_shell = "bash" subprocess.run([f"{current_shell}", "-c", - f"source {self.venv_path}/bin/activate && export PS1=\"(tempyenv)$PS1\\$ \" && {current_shell}"], + f"export VIRTUAL_ENV_DISABLE_PROMPT=1 && source {self.venv_path}/bin/activate && export PS1=\"(tempyenv)$PS1\\$ \" && {current_shell}"], stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,