Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ __pycache__/
.pytest_cache/
.ruff_cache/
.venv/
tempyenv
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
```
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion src/tempyenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading