# iso-env - Run apps in an isolated environment using uv
[![Linting](../../actions/workflows/lint.yml/badge.svg)](../../actions/workflows/lint.yml)
[![MacOS_Tests](../../actions/workflows/push_macos.yml/badge.svg)](../../actions/workflows/push_macos.yml)
[![Ubuntu_Tests](../../actions/workflows/push_ubuntu.yml/badge.svg)](../../actions/workflows/push_ubuntu.yml)
[![Win_Tests](../../actions/workflows/push_win.yml/badge.svg)](../../actions/workflows/push_win.yml)
# Simple Example
```python
import unittest
from pathlib import Path
from iso_env.api import IsoEnv, IsoEnvArgs, Requirements
REQUIREMENTS_TXT = """
static-ffmpeg
"""
class MainTester(unittest.TestCase):
"""Main tester class."""
def test_iso_env(self) -> None:
"""Test command line interface (CLI)."""
args = IsoEnvArgs(
venv_path=Path(".env_ffmpeg"),
build_info=Requirements(REQUIREMENTS_TXT, python_version="==3.10.*"),
)
iso = IsoEnv(args)
cp = iso.run(["static_ffmpeg", "-version"])
print(cp)
cp = iso.run(["pwd"])
print(cp)
print()
if __name__ == "__main__":
unittest.main()
```
# Complex Example
```
"""
Unit test file.
"""
import unittest
from pathlib import Path
from iso_env.api import IsoEnv, IsoEnvArgs, PyProjectToml
PY_PROJECT_TOML = PyProjectToml(
"""
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.10.0"
dependencies = [
"torch==2.1.2",
]
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[tool.uv.sources]
torch = [
{ index = "pytorch-cu121", marker = "platform_system == 'Windows'" },
]
[[tool.uv.index]]
name = "pytorch-cu121"
url = "https://download.pytorch.org/whl/cu121"
explicit = true
"""
)
class ComplexInstallTester(unittest.TestCase):
"""Main tester class."""
@unittest.skip("Skip this test - it takes a long time")
def test_iso_env(self) -> None:
"""Test command line interface (CLI)."""
args = IsoEnvArgs(
venv_path=Path(".env_torch"),
build_info=PY_PROJECT_TOML,
)
iso = IsoEnv(args)
cp = iso.run('python -c "import torch; print(torch.__version__)"', check=True)
print(cp)
if __name__ == "__main__":
unittest.main()
```
To develop software, run `. ./activate.sh`
# Windows
This environment requires you to use `git-bash`.
# Linting
Run `./lint.sh` to find linting errors using `pylint`, `flake8` and `mypy`.
Raw data
{
"_id": null,
"home_page": "https://github.com/zackees/iso-env",
"name": "uv-iso-env",
"maintainer": "Zachary Vorhies",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "template-python-cmd",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c2/77/3217039a2b0ab4137404d0d0e54c7d9e72950cdb67d7b7948c4b7406efcd/uv_iso_env-1.0.12.tar.gz",
"platform": null,
"description": "# iso-env - Run apps in an isolated environment using uv\r\n\r\n[![Linting](../../actions/workflows/lint.yml/badge.svg)](../../actions/workflows/lint.yml)\r\n\r\n[![MacOS_Tests](../../actions/workflows/push_macos.yml/badge.svg)](../../actions/workflows/push_macos.yml)\r\n[![Ubuntu_Tests](../../actions/workflows/push_ubuntu.yml/badge.svg)](../../actions/workflows/push_ubuntu.yml)\r\n[![Win_Tests](../../actions/workflows/push_win.yml/badge.svg)](../../actions/workflows/push_win.yml)\r\n\r\n\r\n# Simple Example\r\n\r\n\r\n```python\r\n\r\nimport unittest\r\nfrom pathlib import Path\r\n\r\nfrom iso_env.api import IsoEnv, IsoEnvArgs, Requirements\r\n\r\nREQUIREMENTS_TXT = \"\"\"\r\nstatic-ffmpeg\r\n\"\"\"\r\n\r\n\r\nclass MainTester(unittest.TestCase):\r\n \"\"\"Main tester class.\"\"\"\r\n\r\n def test_iso_env(self) -> None:\r\n \"\"\"Test command line interface (CLI).\"\"\"\r\n args = IsoEnvArgs(\r\n venv_path=Path(\".env_ffmpeg\"),\r\n build_info=Requirements(REQUIREMENTS_TXT, python_version=\"==3.10.*\"),\r\n )\r\n iso = IsoEnv(args)\r\n cp = iso.run([\"static_ffmpeg\", \"-version\"])\r\n print(cp)\r\n\r\n cp = iso.run([\"pwd\"])\r\n print(cp)\r\n print()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n unittest.main()\r\n```\r\n\r\n# Complex Example\r\n\r\n```\r\n\"\"\"\r\nUnit test file.\r\n\"\"\"\r\n\r\nimport unittest\r\nfrom pathlib import Path\r\n\r\nfrom iso_env.api import IsoEnv, IsoEnvArgs, PyProjectToml\r\n\r\nPY_PROJECT_TOML = PyProjectToml(\r\n \"\"\"\r\n[project]\r\nname = \"project\"\r\nversion = \"0.1.0\"\r\nrequires-python = \">=3.10.0\"\r\ndependencies = [\r\n \"torch==2.1.2\",\r\n]\r\n\r\n[build-system]\r\nrequires = [\"setuptools\", \"wheel\"]\r\nbuild-backend = \"setuptools.build_meta\"\r\n\r\n[tool.uv.sources]\r\ntorch = [\r\n { index = \"pytorch-cu121\", marker = \"platform_system == 'Windows'\" },\r\n]\r\n\r\n[[tool.uv.index]]\r\nname = \"pytorch-cu121\"\r\nurl = \"https://download.pytorch.org/whl/cu121\"\r\nexplicit = true\r\n\"\"\"\r\n)\r\n\r\n\r\nclass ComplexInstallTester(unittest.TestCase):\r\n \"\"\"Main tester class.\"\"\"\r\n\r\n @unittest.skip(\"Skip this test - it takes a long time\")\r\n def test_iso_env(self) -> None:\r\n \"\"\"Test command line interface (CLI).\"\"\"\r\n args = IsoEnvArgs(\r\n venv_path=Path(\".env_torch\"),\r\n build_info=PY_PROJECT_TOML,\r\n )\r\n iso = IsoEnv(args)\r\n cp = iso.run('python -c \"import torch; print(torch.__version__)\"', check=True)\r\n print(cp)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n unittest.main()\r\n```\r\n\r\n\r\n\r\nTo develop software, run `. ./activate.sh`\r\n\r\n# Windows\r\n\r\nThis environment requires you to use `git-bash`.\r\n\r\n# Linting\r\n\r\nRun `./lint.sh` to find linting errors using `pylint`, `flake8` and `mypy`.\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "isolated environment2, re-written using uv",
"version": "1.0.12",
"project_urls": {
"Homepage": "https://github.com/zackees/iso-env"
},
"split_keywords": [
"template-python-cmd"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5bce1ee375051ad4cd31c7d44f2b6ae96278500ef4f267bc9d2ffbeb65b28147",
"md5": "ddcaa1a80e68527cf86428c690eb9599",
"sha256": "61e428f4e99f242fcd57a756c61171f3d43910e30aa925832ccd54d927ad2015"
},
"downloads": -1,
"filename": "uv_iso_env-1.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ddcaa1a80e68527cf86428c690eb9599",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6253,
"upload_time": "2025-01-22T02:41:32",
"upload_time_iso_8601": "2025-01-22T02:41:32.010797Z",
"url": "https://files.pythonhosted.org/packages/5b/ce/1ee375051ad4cd31c7d44f2b6ae96278500ef4f267bc9d2ffbeb65b28147/uv_iso_env-1.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c2773217039a2b0ab4137404d0d0e54c7d9e72950cdb67d7b7948c4b7406efcd",
"md5": "86a287e5a238bede5777ad798297bf2d",
"sha256": "b5a53f85062754e7156f04bf3831f975518dc9bed9db42318003fedd29598228"
},
"downloads": -1,
"filename": "uv_iso_env-1.0.12.tar.gz",
"has_sig": false,
"md5_digest": "86a287e5a238bede5777ad798297bf2d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 33715,
"upload_time": "2025-01-22T02:41:33",
"upload_time_iso_8601": "2025-01-22T02:41:33.595315Z",
"url": "https://files.pythonhosted.org/packages/c2/77/3217039a2b0ab4137404d0d0e54c7d9e72950cdb67d7b7948c4b7406efcd/uv_iso_env-1.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-22 02:41:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zackees",
"github_project": "iso-env",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "uv-iso-env"
}