uvpy 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.
uvpy-0.1.0/.gitignore ADDED
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
uvpy-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 lepy
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.
uvpy-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: uvpy
3
+ Version: 0.1.0
4
+ Summary: Portable Python App Framework with isolated venvs via uv
5
+ Project-URL: Homepage, https://github.com/lepy/uvpy
6
+ Project-URL: Repository, https://github.com/lepy/uvpy
7
+ Project-URL: Issues, https://github.com/lepy/uvpy/issues
8
+ Author: uvpy contributors
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: cli,framework,offline,portable,sandbox,uv,venv
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
23
+ Classifier: Topic :: System :: Software Distribution
24
+ Requires-Python: >=3.10
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
27
+ Requires-Dist: pytest>=7.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # uvpy - Portable Python App Framework
31
+
32
+ **Version 0.1.0** | **Python 3.12**
33
+
34
+ A fully portable, offline-capable CLI framework for modular Python apps.
35
+
36
+ ## Features
37
+
38
+ - **Portable**: Bundled Python, no system dependencies
39
+ - **Offline**: All packages from local `pypi/` mirror
40
+ - **Isolated**: Each app has its own venv (via uv)
41
+ - **Secure**: Sandbox - localhost only, no telemetry
42
+ - **Modular**: Apps as plugins in `apps/`
43
+
44
+ ## Dual Mode Operation
45
+
46
+ uvpy supports two modes:
47
+
48
+ 1. **Portable Mode**: With bundled Python, uv binary, and offline packages
49
+ 2. **Installed Mode**: `pip install uvpy` - uses system Python, apps from `./apps/`
50
+
51
+ ## Quickstart
52
+
53
+ ### Portable Mode
54
+
55
+ ```bash
56
+ # 1. Install portable Python (once)
57
+ curl -LO https://github.com/indygreg/python-build-standalone/releases/download/20240224/cpython-3.12.2+20240224-x86_64-unknown-linux-gnu-install_only.tar.gz
58
+ tar xzf cpython-*.tar.gz
59
+
60
+ # 2. Run an app
61
+ ./uvpy hello
62
+ ./uvpy --list-apps
63
+ ```
64
+
65
+ ### Installed Mode
66
+
67
+ ```bash
68
+ pip install uvpy
69
+ uvpy --list-apps
70
+ uvpy hello
71
+ ```
72
+
73
+ ## Structure
74
+
75
+ ```
76
+ uvpy/
77
+ ├── uvpy # Launcher (Linux/macOS)
78
+ ├── uvpy.bat # Launcher (Windows)
79
+ ├── src/uvpy/ # Package source
80
+ ├── python/ # Portable Python 3.12
81
+ ├── apps/ # App modules
82
+ ├── pypi/ # Offline packages (.whl)
83
+ └── bin/ # uv binary
84
+ ```
85
+
86
+ ## Commands
87
+
88
+ ```bash
89
+ ./uvpy --help # Help
90
+ ./uvpy --list-apps # List apps
91
+ ./uvpy <app> # Run app
92
+
93
+ # Portable mode only:
94
+ ./uvpy venv --list # Show venv status
95
+ ./uvpy venv <app> # Create venv (offline)
96
+ ./uvpy venv <app> --online # Create venv (online)
97
+
98
+ ./uvpy download --list # Show packages in pypi/
99
+ ./uvpy download --online numpy pandas # Download packages
100
+ ```
101
+
102
+ ## Creating a New App
103
+
104
+ ```bash
105
+ mkdir -p apps/myapp
106
+ ```
107
+
108
+ **apps/myapp/manifest.json:**
109
+ ```json
110
+ {
111
+ "name": "myapp",
112
+ "version": "1.0.0",
113
+ "description": "My application"
114
+ }
115
+ ```
116
+
117
+ **apps/myapp/pyproject.toml:**
118
+ ```toml
119
+ [project]
120
+ name = "myapp"
121
+ version = "1.0.0"
122
+ dependencies = ["numpy==1.26.4"]
123
+ ```
124
+
125
+ **apps/myapp/main.py:**
126
+ ```python
127
+ def register(subparser):
128
+ subparser.add_argument("--name", default="World")
129
+
130
+ def run(args):
131
+ import numpy as np
132
+ print(f"Hello {args.name}! NumPy version: {np.__version__}")
133
+ return 0
134
+ ```
135
+
136
+ ```bash
137
+ ./uvpy venv myapp # Create venv
138
+ ./uvpy myapp # Run app
139
+ ```
140
+
141
+ ## Security Sandbox
142
+
143
+ uvpy includes a security sandbox that:
144
+
145
+ - Blocks all network connections except localhost
146
+ - Disables telemetry (Streamlit, Matplotlib, etc.)
147
+ - Sets headless backends for GUI libraries
148
+
149
+ ```python
150
+ from uvpy import activate_sandbox
151
+ activate_sandbox()
152
+ ```
153
+
154
+ ## License
155
+
156
+ MIT License - see [LICENSE](LICENSE)
uvpy-0.1.0/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # uvpy - Portable Python App Framework
2
+
3
+ **Version 0.1.0** | **Python 3.12**
4
+
5
+ A fully portable, offline-capable CLI framework for modular Python apps.
6
+
7
+ ## Features
8
+
9
+ - **Portable**: Bundled Python, no system dependencies
10
+ - **Offline**: All packages from local `pypi/` mirror
11
+ - **Isolated**: Each app has its own venv (via uv)
12
+ - **Secure**: Sandbox - localhost only, no telemetry
13
+ - **Modular**: Apps as plugins in `apps/`
14
+
15
+ ## Dual Mode Operation
16
+
17
+ uvpy supports two modes:
18
+
19
+ 1. **Portable Mode**: With bundled Python, uv binary, and offline packages
20
+ 2. **Installed Mode**: `pip install uvpy` - uses system Python, apps from `./apps/`
21
+
22
+ ## Quickstart
23
+
24
+ ### Portable Mode
25
+
26
+ ```bash
27
+ # 1. Install portable Python (once)
28
+ curl -LO https://github.com/indygreg/python-build-standalone/releases/download/20240224/cpython-3.12.2+20240224-x86_64-unknown-linux-gnu-install_only.tar.gz
29
+ tar xzf cpython-*.tar.gz
30
+
31
+ # 2. Run an app
32
+ ./uvpy hello
33
+ ./uvpy --list-apps
34
+ ```
35
+
36
+ ### Installed Mode
37
+
38
+ ```bash
39
+ pip install uvpy
40
+ uvpy --list-apps
41
+ uvpy hello
42
+ ```
43
+
44
+ ## Structure
45
+
46
+ ```
47
+ uvpy/
48
+ ├── uvpy # Launcher (Linux/macOS)
49
+ ├── uvpy.bat # Launcher (Windows)
50
+ ├── src/uvpy/ # Package source
51
+ ├── python/ # Portable Python 3.12
52
+ ├── apps/ # App modules
53
+ ├── pypi/ # Offline packages (.whl)
54
+ └── bin/ # uv binary
55
+ ```
56
+
57
+ ## Commands
58
+
59
+ ```bash
60
+ ./uvpy --help # Help
61
+ ./uvpy --list-apps # List apps
62
+ ./uvpy <app> # Run app
63
+
64
+ # Portable mode only:
65
+ ./uvpy venv --list # Show venv status
66
+ ./uvpy venv <app> # Create venv (offline)
67
+ ./uvpy venv <app> --online # Create venv (online)
68
+
69
+ ./uvpy download --list # Show packages in pypi/
70
+ ./uvpy download --online numpy pandas # Download packages
71
+ ```
72
+
73
+ ## Creating a New App
74
+
75
+ ```bash
76
+ mkdir -p apps/myapp
77
+ ```
78
+
79
+ **apps/myapp/manifest.json:**
80
+ ```json
81
+ {
82
+ "name": "myapp",
83
+ "version": "1.0.0",
84
+ "description": "My application"
85
+ }
86
+ ```
87
+
88
+ **apps/myapp/pyproject.toml:**
89
+ ```toml
90
+ [project]
91
+ name = "myapp"
92
+ version = "1.0.0"
93
+ dependencies = ["numpy==1.26.4"]
94
+ ```
95
+
96
+ **apps/myapp/main.py:**
97
+ ```python
98
+ def register(subparser):
99
+ subparser.add_argument("--name", default="World")
100
+
101
+ def run(args):
102
+ import numpy as np
103
+ print(f"Hello {args.name}! NumPy version: {np.__version__}")
104
+ return 0
105
+ ```
106
+
107
+ ```bash
108
+ ./uvpy venv myapp # Create venv
109
+ ./uvpy myapp # Run app
110
+ ```
111
+
112
+ ## Security Sandbox
113
+
114
+ uvpy includes a security sandbox that:
115
+
116
+ - Blocks all network connections except localhost
117
+ - Disables telemetry (Streamlit, Matplotlib, etc.)
118
+ - Sets headless backends for GUI libraries
119
+
120
+ ```python
121
+ from uvpy import activate_sandbox
122
+ activate_sandbox()
123
+ ```
124
+
125
+ ## License
126
+
127
+ MIT License - see [LICENSE](LICENSE)
@@ -0,0 +1,87 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "uvpy"
7
+ version = "0.1.0"
8
+ description = "Portable Python App Framework with isolated venvs via uv"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "uvpy contributors" }
14
+ ]
15
+ keywords = ["cli", "framework", "portable", "uv", "venv", "sandbox", "offline"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
28
+ "Topic :: System :: Software Distribution",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/lepy/uvpy"
33
+ Repository = "https://github.com/lepy/uvpy"
34
+ Issues = "https://github.com/lepy/uvpy/issues"
35
+
36
+ [project.scripts]
37
+ uvpy = "uvpy.cli:main"
38
+
39
+ [tool.hatch.build.targets.sdist]
40
+ include = [
41
+ "/src",
42
+ "/README.md",
43
+ "/LICENSE",
44
+ ]
45
+ exclude = [
46
+ "claude.md",
47
+ ".gitignore",
48
+ "*.local",
49
+ ]
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/uvpy"]
53
+
54
+ [project.optional-dependencies]
55
+ dev = [
56
+ "pytest>=7.0",
57
+ "pytest-cov>=4.0",
58
+ ]
59
+
60
+ [tool.pytest.ini_options]
61
+ testpaths = ["tests"]
62
+ python_files = ["test_*.py"]
63
+ python_functions = ["test_*"]
64
+ python_classes = ["Test*"]
65
+ addopts = [
66
+ "-v",
67
+ "--tb=short",
68
+ "-ra",
69
+ ]
70
+ filterwarnings = [
71
+ "ignore::DeprecationWarning",
72
+ ]
73
+
74
+ [tool.coverage.run]
75
+ source = ["src/uvpy"]
76
+ branch = true
77
+ omit = [
78
+ "*/tests/*",
79
+ "*/__pycache__/*",
80
+ ]
81
+
82
+ [tool.coverage.report]
83
+ exclude_lines = [
84
+ "pragma: no cover",
85
+ "if __name__ == .__main__.:",
86
+ "raise NotImplementedError",
87
+ ]
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ uvpy - Portable Python App Framework
4
+
5
+ A framework for isolated Python apps with:
6
+ - Portable Python (optional)
7
+ - Isolated venvs per app (via uv)
8
+ - Offline installation from local pypi/
9
+ - Sandbox: localhost only, no telemetry
10
+ """
11
+
12
+ try:
13
+ from importlib.metadata import version as _get_version
14
+ __version__ = _get_version("uvpy")
15
+ except Exception:
16
+ __version__ = "0.1.0"
17
+
18
+ from .sandbox import activate as activate_sandbox
19
+ from .imports import try_import, require, is_available, LazyModule, optional_import
20
+
21
+ __all__ = [
22
+ "__version__",
23
+ "activate_sandbox",
24
+ "try_import",
25
+ "require",
26
+ "is_available",
27
+ "LazyModule",
28
+ "optional_import",
29
+ ]
@@ -0,0 +1,13 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ uvpy - Entry point for python -m uvpy
4
+
5
+ Enables:
6
+ python -m uvpy --help
7
+ python -m uvpy hello
8
+ """
9
+ from .cli import main
10
+ import sys
11
+
12
+ if __name__ == "__main__":
13
+ sys.exit(main())