Download tests/test_packaging.py from buggandhi/Orqanta-AI: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/buggandhi/Orqanta-AI/resolve/main/tests/test_packaging.py
- Command line
-
hf download hf://buggandhi/Orqanta-AI/tests/test_packaging.py
-
curl -L -o test_packaging.py https://huggingface.co/buggandhi/Orqanta-AI/resolve/main/tests/test_packaging.py
1.56 kB
| from __future__ import annotations | |
| import re | |
| from pathlib import Path | |
| import pytest | |
| tomllib = pytest.importorskip("tomllib") | |
| def test_training_dependencies_are_not_required_for_runtime() -> None: | |
| root = Path(__file__).parents[1] | |
| project = tomllib.loads((root / "pyproject.toml").read_text()) | |
| runtime = set(project["project"]["dependencies"]) | |
| training = set(project["project"]["optional-dependencies"]["train"]) | |
| extras = project["project"]["optional-dependencies"] | |
| assert runtime.isdisjoint(training) | |
| assert extras["gpu"] | |
| assert extras["metal"] | |
| assert not set(extras["gpu"]).intersection(training) | |
| assert not set(extras["metal"]).intersection(training) | |
| requirements = { | |
| line.strip() | |
| for line in (root / "requirements.txt").read_text().splitlines() | |
| if line.strip() and not line.startswith("#") | |
| } | |
| train_requirements = { | |
| line.strip() | |
| for line in (root / "requirements-train.txt").read_text().splitlines() | |
| if line.strip() and not line.startswith("#") and not line.startswith("-r ") | |
| } | |
| assert requirements == runtime | |
| assert train_requirements == training | |
| def test_setup_scripts_install_extras_that_exist() -> None: | |
| root = Path(__file__).parents[1] | |
| extras = set(tomllib.loads((root / "pyproject.toml").read_text())["project"]["optional-dependencies"]) | |
| for script in ("setup", "setup.bat"): | |
| for group in re.findall(r"\.\[([^\]]+)\]", (root / script).read_text()): | |
| assert set(group.split(",")) <= extras, script | |