lazyvenv 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lazyvenv-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abdulaziz-Hassan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: lazyvenv
3
+ Version: 0.1.0
4
+ Summary: A TUI for managing Python virtual environments
5
+ Keywords: virtualenv,tui
6
+ Author: Abdulaziz-Hassan
7
+ Author-email: Abdulaziz-Hassan <abdulazizhza@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: POSIX
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Requires-Dist: rich>=15.0.0
14
+ Requires-Dist: textual>=8.2.8
15
+ Requires-Python: >=3.13
16
+ Project-URL: Homepage, https://github.com/Abdulaziz-Hassan/lazyvenv
17
+ Project-URL: Issues, https://github.com/Abdulaziz-Hassan/lazyvenv/issues
18
+ Description-Content-Type: text/markdown
19
+
20
+ # lazyvenv
21
+
22
+ [![PyPI](https://img.shields.io/pypi/v/lazyvenv)](https://pypi.org/project/lazyvenv/)
23
+ [![Python](https://img.shields.io/pypi/pyversions/lazyvenv)](https://pypi.org/project/lazyvenv/)
24
+ [![CI](https://github.com/Abdulaziz-Hassan/lazyvenv/actions/workflows/ci.yml/badge.svg)](https://github.com/Abdulaziz-Hassan/lazyvenv/actions/workflows/ci.yml)
25
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
26
+
27
+ A TUI for managing Python virtual environments.
28
+
29
+ ![screenshot](https://raw.githubusercontent.com/Abdulaziz-Hassan/lazyvenv/main/docs/screenshot.png)
30
+
31
+ lazyvenv shows the virtual environments in the current directory, lets you
32
+ inspect their installed packages (including origin, size, and metadata), and
33
+ create, delete, activate, and deactivate environments — all from one keyboard-
34
+ driven interface.
35
+
36
+ ## Requirements
37
+
38
+ - Python 3.13 or newer
39
+ - [uv](https://docs.astral.sh/uv/) — used to list interpreters and create venvs
40
+ - zsh, bash, or sh (for the activation shell hook)
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ uv tool install lazyvenv
46
+ ```
47
+
48
+ This installs the `lazyvenv` command globally, outside any project venv —
49
+ which is required for activation to work reliably.
50
+
51
+ ## Shell integration (for activation)
52
+
53
+ Pressing `a` inside the app marks a venv to be (de)activated, and the change
54
+ is applied when you quit. For that to work, add the wrapper function to your
55
+ shell config:
56
+
57
+ ```bash
58
+ # ~/.zshrc or ~/.bashrc
59
+ eval "$(lazyvenv init zsh)" # or: lazyvenv init bash
60
+ ```
61
+
62
+ Restart your shell (or `source` the file). Without this hook the app still
63
+ works, but `a` will show a warning instead of activating.
64
+
65
+ ## Usage
66
+
67
+ Run `lazyvenv` inside any directory containing virtual environments (it scans
68
+ the directory itself and its immediate children for `pyvenv.cfg` files):
69
+
70
+ ```bash
71
+ cd your-project
72
+ lazyvenv
73
+ ```
74
+
75
+ ### Keys
76
+
77
+ | Key | Action |
78
+ |-----|--------|
79
+ | `j` / `k` | Move the cursor up/down (arrow keys work too) |
80
+ | `h` / `l` | Switch between the venv list and the packages table |
81
+ | `a` | Toggle (de)activation of the highlighted venv (applied on quit) |
82
+ | `c` | Create a new venv (pick any uv-managed interpreter) |
83
+ | `d` | Delete the highlighted venv (with confirmation) |
84
+ | `r` | Refresh the venv list |
85
+ | `/` | Filter packages by name (`Esc` clears) |
86
+ | `⏎` | Open the full details for the highlighted package |
87
+ | `q` | Quit (or go back, inside a screen/dialog) |
88
+
89
+ ### CLI
90
+
91
+ ```
92
+ lazyvenv Launch the TUI
93
+ lazyvenv init [shell] Print the shell wrapper (zsh or bash)
94
+ lazyvenv --version Print the version
95
+ lazyvenv --help Show help
96
+ ```
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ git clone https://github.com/Abdulaziz-Hassan/lazyvenv
102
+ cd lazyvenv
103
+ uv sync
104
+ uv run pytest # tests
105
+ uv run ruff check # lint
106
+ uv run ruff format # format
107
+ uv run mypy # types (strict)
108
+ uv run lazyvenv # run the app
109
+ ```
110
+
111
+ For local development of the global command (e.g. to test the shell hook):
112
+
113
+ ```bash
114
+ uv tool install --editable .
115
+ ```
116
+
117
+ ## Changelog
118
+
119
+ See [CHANGELOG.md](CHANGELOG.md).
120
+
121
+ ## License
122
+
123
+ [MIT](LICENSE)
@@ -0,0 +1,104 @@
1
+ # lazyvenv
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/lazyvenv)](https://pypi.org/project/lazyvenv/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/lazyvenv)](https://pypi.org/project/lazyvenv/)
5
+ [![CI](https://github.com/Abdulaziz-Hassan/lazyvenv/actions/workflows/ci.yml/badge.svg)](https://github.com/Abdulaziz-Hassan/lazyvenv/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ A TUI for managing Python virtual environments.
9
+
10
+ ![screenshot](https://raw.githubusercontent.com/Abdulaziz-Hassan/lazyvenv/main/docs/screenshot.png)
11
+
12
+ lazyvenv shows the virtual environments in the current directory, lets you
13
+ inspect their installed packages (including origin, size, and metadata), and
14
+ create, delete, activate, and deactivate environments — all from one keyboard-
15
+ driven interface.
16
+
17
+ ## Requirements
18
+
19
+ - Python 3.13 or newer
20
+ - [uv](https://docs.astral.sh/uv/) — used to list interpreters and create venvs
21
+ - zsh, bash, or sh (for the activation shell hook)
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ uv tool install lazyvenv
27
+ ```
28
+
29
+ This installs the `lazyvenv` command globally, outside any project venv —
30
+ which is required for activation to work reliably.
31
+
32
+ ## Shell integration (for activation)
33
+
34
+ Pressing `a` inside the app marks a venv to be (de)activated, and the change
35
+ is applied when you quit. For that to work, add the wrapper function to your
36
+ shell config:
37
+
38
+ ```bash
39
+ # ~/.zshrc or ~/.bashrc
40
+ eval "$(lazyvenv init zsh)" # or: lazyvenv init bash
41
+ ```
42
+
43
+ Restart your shell (or `source` the file). Without this hook the app still
44
+ works, but `a` will show a warning instead of activating.
45
+
46
+ ## Usage
47
+
48
+ Run `lazyvenv` inside any directory containing virtual environments (it scans
49
+ the directory itself and its immediate children for `pyvenv.cfg` files):
50
+
51
+ ```bash
52
+ cd your-project
53
+ lazyvenv
54
+ ```
55
+
56
+ ### Keys
57
+
58
+ | Key | Action |
59
+ |-----|--------|
60
+ | `j` / `k` | Move the cursor up/down (arrow keys work too) |
61
+ | `h` / `l` | Switch between the venv list and the packages table |
62
+ | `a` | Toggle (de)activation of the highlighted venv (applied on quit) |
63
+ | `c` | Create a new venv (pick any uv-managed interpreter) |
64
+ | `d` | Delete the highlighted venv (with confirmation) |
65
+ | `r` | Refresh the venv list |
66
+ | `/` | Filter packages by name (`Esc` clears) |
67
+ | `⏎` | Open the full details for the highlighted package |
68
+ | `q` | Quit (or go back, inside a screen/dialog) |
69
+
70
+ ### CLI
71
+
72
+ ```
73
+ lazyvenv Launch the TUI
74
+ lazyvenv init [shell] Print the shell wrapper (zsh or bash)
75
+ lazyvenv --version Print the version
76
+ lazyvenv --help Show help
77
+ ```
78
+
79
+ ## Development
80
+
81
+ ```bash
82
+ git clone https://github.com/Abdulaziz-Hassan/lazyvenv
83
+ cd lazyvenv
84
+ uv sync
85
+ uv run pytest # tests
86
+ uv run ruff check # lint
87
+ uv run ruff format # format
88
+ uv run mypy # types (strict)
89
+ uv run lazyvenv # run the app
90
+ ```
91
+
92
+ For local development of the global command (e.g. to test the shell hook):
93
+
94
+ ```bash
95
+ uv tool install --editable .
96
+ ```
97
+
98
+ ## Changelog
99
+
100
+ See [CHANGELOG.md](CHANGELOG.md).
101
+
102
+ ## License
103
+
104
+ [MIT](LICENSE)
@@ -0,0 +1,79 @@
1
+ [project]
2
+ name = "lazyvenv"
3
+ version = "0.1.0"
4
+ description = "A TUI for managing Python virtual environments"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.13"
9
+ keywords = [
10
+ "virtualenv",
11
+ "tui",
12
+ ]
13
+ classifiers = [
14
+ "Operating System :: POSIX",
15
+ "Programming Language :: Python :: 3.13",
16
+ "Programming Language :: Python :: 3.14",
17
+ ]
18
+ dependencies = [
19
+ "rich>=15.0.0",
20
+ "textual>=8.2.8",
21
+ ]
22
+
23
+ [[project.authors]]
24
+ name = "Abdulaziz-Hassan"
25
+ email = "abdulazizhza@gmail.com"
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/Abdulaziz-Hassan/lazyvenv"
29
+ Issues = "https://github.com/Abdulaziz-Hassan/lazyvenv/issues"
30
+
31
+ [project.scripts]
32
+ lazyvenv = "lazyvenv:main"
33
+
34
+ [build-system]
35
+ requires = ["uv_build>=0.12.1,<0.13.0"]
36
+ build-backend = "uv_build"
37
+
38
+ [dependency-groups]
39
+ dev = [
40
+ "mypy>=2.3.1",
41
+ "pytest>=9.1.1",
42
+ "pytest-asyncio>=1.4.0",
43
+ "ruff>=0.16.3",
44
+ ]
45
+
46
+ [tool.ruff]
47
+ target-version = "py313"
48
+
49
+ [tool.ruff.lint]
50
+ select = [
51
+ "E",
52
+ "F",
53
+ "I",
54
+ "UP",
55
+ "B",
56
+ "SIM",
57
+ "RUF",
58
+ ]
59
+
60
+ [tool.ruff.lint.per-file-ignores]
61
+ "src/lazyvenv/packages.py" = ["E501"]
62
+ "tests/test_create.py" = ["E501"]
63
+
64
+ [tool.pytest.ini_options]
65
+ testpaths = ["tests"]
66
+ asyncio_mode = "auto"
67
+
68
+ [tool.mypy]
69
+ strict = true
70
+ files = [
71
+ "src",
72
+ "tests",
73
+ ]
74
+ mypy_path = "src"
75
+
76
+ [[tool.mypy.overrides]]
77
+ module = "tests.*"
78
+ disallow_untyped_defs = false
79
+ disallow_untyped_calls = false
@@ -0,0 +1,64 @@
1
+ [project]
2
+ name = "lazyvenv"
3
+ version = "0.1.0"
4
+ description = "A TUI for managing Python virtual environments"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "Abdulaziz-Hassan", email = "abdulazizhza@gmail.com" }
10
+ ]
11
+ requires-python = ">=3.13"
12
+ keywords = ["virtualenv", "tui"]
13
+ classifiers = [
14
+ "Operating System :: POSIX",
15
+ "Programming Language :: Python :: 3.13",
16
+ "Programming Language :: Python :: 3.14",
17
+ ]
18
+ dependencies = [
19
+ "rich>=15.0.0",
20
+ "textual>=8.2.8",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/Abdulaziz-Hassan/lazyvenv"
25
+ Issues = "https://github.com/Abdulaziz-Hassan/lazyvenv/issues"
26
+
27
+ [project.scripts]
28
+ lazyvenv = "lazyvenv:main"
29
+
30
+ [build-system]
31
+ requires = ["uv_build>=0.12.1,<0.13.0"]
32
+ build-backend = "uv_build"
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "mypy>=2.3.1",
37
+ "pytest>=9.1.1",
38
+ "pytest-asyncio>=1.4.0",
39
+ "ruff>=0.16.3",
40
+ ]
41
+
42
+ [tool.ruff]
43
+ target-version = "py313"
44
+
45
+ [tool.ruff.lint]
46
+ select = ["E", "F", "I", "UP", "B", "SIM", "RUF"]
47
+
48
+ [tool.ruff.lint.per-file-ignores]
49
+ "src/lazyvenv/packages.py" = ["E501"] # embedded inspector script
50
+ "tests/test_create.py" = ["E501"] # verbatim `uv python list` fixture output
51
+
52
+ [tool.pytest.ini_options]
53
+ testpaths = ["tests"]
54
+ asyncio_mode = "auto"
55
+
56
+ [tool.mypy]
57
+ strict = true
58
+ files = ["src", "tests"]
59
+ mypy_path = "src"
60
+
61
+ [[tool.mypy.overrides]]
62
+ module = "tests.*"
63
+ disallow_untyped_defs = false
64
+ disallow_untyped_calls = false
@@ -0,0 +1,47 @@
1
+ """lazyvenv - a TUI for managing Python virtual environments."""
2
+
3
+ import argparse
4
+ import os
5
+ from importlib.metadata import version
6
+ from pathlib import Path
7
+
8
+ from lazyvenv.activation import init_script
9
+
10
+
11
+ def main() -> None:
12
+ parser = argparse.ArgumentParser(
13
+ prog="lazyvenv",
14
+ description="A TUI for managing Python virtual environments.",
15
+ )
16
+ parser.add_argument(
17
+ "--version",
18
+ "-V",
19
+ action="version",
20
+ version=f"%(prog)s {version('lazyvenv')}",
21
+ )
22
+ subparsers = parser.add_subparsers(dest="command")
23
+
24
+ init = subparsers.add_parser("init", help="print the shell wrapper function")
25
+ init.add_argument("shell", nargs="?", default="zsh", choices=["zsh", "bash", "sh"])
26
+
27
+ args = parser.parse_args()
28
+ if args.command == "init":
29
+ _print_init(args.shell)
30
+ else:
31
+ _run_tui()
32
+
33
+
34
+ def _print_init(shell: str) -> None:
35
+ """Print the shell wrapper function (zsh/bash)."""
36
+ print(init_script(shell))
37
+
38
+
39
+ def _run_tui() -> None:
40
+ """Launch the TUI, then apply any pending (de)activation."""
41
+ from lazyvenv.app import LazyVenvApp # deferred: importing textual is slow
42
+
43
+ app = LazyVenvApp()
44
+ app.run()
45
+ cmd_file = os.environ.get("LAZYVENV_SHELL_CMD_FILE")
46
+ if cmd_file and app.pending_command:
47
+ Path(cmd_file).write_text(app.pending_command + "\n")
@@ -0,0 +1,28 @@
1
+ from lazyvenv.venvs import Venv
2
+
3
+ DEACTIVATE_COMMAND = "deactivate"
4
+
5
+
6
+ def activation_command(venv: Venv) -> str:
7
+ """The shell command that activates *venv* in the current shell."""
8
+ return f"source '{venv.path}/bin/activate'"
9
+
10
+
11
+ _INIT_SCRIPT = """\
12
+ lazyvenv() {
13
+ local tmpfile
14
+ tmpfile="$(mktemp "${TMPDIR:-/tmp}/lazyvenv.XXXXXX")"
15
+ LAZYVENV_SHELL_CMD_FILE="$tmpfile" command lazyvenv "$@"
16
+ if [ -s "$tmpfile" ]; then
17
+ eval "$(cat "$tmpfile")"
18
+ fi
19
+ rm -f "$tmpfile"
20
+ }
21
+ """
22
+
23
+
24
+ def init_script(shell: str) -> str:
25
+ """The wrapper function for *shell* for ``eval "$(lazyvenv init zsh)"``."""
26
+ if shell not in {"zsh", "bash", "sh"}:
27
+ raise ValueError(f"unsupported shell: {shell!r} (supported: zsh, bash, sh)")
28
+ return _INIT_SCRIPT