Project initialization#1
Conversation
There was a problem hiding this comment.
Pull request overview
Bootstraps qRG as an installable Python package using a src/ layout and uv-managed dependency groups, with initial CI, tox, linting/type-check tooling, and a minimal smoke test.
Changes:
- Added packaging/build metadata and dependency configuration (including backend-selectable torch extras) in
pyproject.toml. - Introduced local/CI automation via
tox,pre-commit, and a GitHub Actions workflow. - Added initial package scaffold under
src/qrg/plus a simple import smoke test.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Defines package metadata, dependencies/extras, and tool configs (uv/ruff/mypy/pytest). |
tox.ini |
Adds tox environments for tests, linting, and type checking. |
.github/workflows/ci.yml |
Runs dependency sync and tox in GitHub Actions CI. |
.pre-commit-config.yaml |
Adds pre-commit hooks for hygiene, Ruff, and mypy. |
src/qrg/__init__.py |
Adds minimal package entrypoint and __version__. |
tests/test_smoke.py |
Adds a smoke test validating the package imports and exposes a version. |
.gitignore |
Ignores uv.lock and a few OS/PyTorch artifact patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| __all__ = ["__version__"] | ||
|
|
||
| __version__ = "0.1.0" |
There was a problem hiding this comment.
__version__ is hard-coded here and also duplicated in pyproject.toml. This will eventually drift and cause incorrect version reporting; consider deriving it from installed package metadata (e.g., via importlib.metadata) or using a single-source versioning approach so you only update the version in one place.
| __version__ = "0.1.0" | |
| try: | |
| # Python 3.8+ | |
| from importlib.metadata import PackageNotFoundError, version | |
| except ImportError: # pragma: no cover | |
| # Python < 3.8 | |
| from importlib_metadata import PackageNotFoundError, version # type: ignore[import] | |
| try: | |
| # Use the top-level package name as the distribution name | |
| _distribution_name = __name__.split(".")[0] | |
| __version__ = version(_distribution_name) | |
| except PackageNotFoundError: # pragma: no cover | |
| # Fallback when the package is not installed with metadata available | |
| __version__ = "0.0.0" |
| package = wheel | ||
| extras = | ||
| cpu | ||
| dependency_groups = | ||
| dev | ||
| commands = | ||
| pytest --cov=qrg --cov-report=term-missing tests |
There was a problem hiding this comment.
The default [testenv] installs the cpu extra, which will pull in torch/torchvision for every test run and in CI. Since the current tests are only a smoke import test, this adds significant install time and potential CI flakiness for no functional benefit; consider making torch installation a dedicated tox env/factor (or optional) so unit tests can run without heavyweight extras.
| [project.optional-dependencies] | ||
| cpu = [ | ||
| "torch>=2.7.0", | ||
| "torchvision>=0.22.0", | ||
| ] | ||
| cu126 = [ | ||
| "torch>=2.7.0", | ||
| "torchvision>=0.22.0", | ||
| ] | ||
| cu128 = [ | ||
| "torch>=2.7.0", | ||
| "torchvision>=0.22.0", | ||
| ] | ||
| cu129 = [ | ||
| "torch>=2.7.0", | ||
| "torchvision>=0.22.0", | ||
| ] | ||
| cu130 = [ | ||
| "torch>=2.7.0", | ||
| "torchvision>=0.22.0", | ||
| ] |
There was a problem hiding this comment.
All backend extras (cpu, cu126, cu128, etc.) declare identical dependencies (torch/torchvision), and the actual index selection is implemented only under [tool.uv.sources]. Installers other than uv (e.g., pip install .[cu128]) will ignore the tool.uv config and likely resolve the default (often CPU) wheels, making these extras misleading. Consider documenting that uv is required for CUDA extras, or encode CUDA-specific requirements in a way that works with standard installers.
Summary
Bootstrap
qRGas an installable Python package managed withuv, with a minimalsrc/layout, development tooling, CI, tox, notebook dependencies, and backend-selectable PyTorch extras.What Changed
pyproject.tomlsetuptoolsbuild backend andsrc/package discoveryqtencpucu126cu128cu129cu130uvsource routing fortorchandtorchvisionto the correct PyTorch indexesuvextra conflict configuration so only one backend extra can be selected at a timeruffpytestpytest-covmypypre-committoxtox-uvbuildtwineipykerneljupyterlabnotebooksrc/qrg/tests/pre-commitconfiguration for:astral-sh/setup-uvtox.iniwith:py311linttype.gitignoreto ignore:uv.lock.DS_Store*.pt*.pth*.safetensorsTox / CI Behavior
toxis now the main local/CI entrypointpy311runs tests with coveragelintruns Ruff check and format checktyperuns mypyuv sync --group devfollowed byuv run toxInstall Examples
uv sync --group devuv sync --group dev --group nbuv sync --group dev --group nb --extra cpuuv sync --group dev --group nb --extra cu128Notes
qtenis a required base dependencyuvconflict configurationuv.lockis intentionally gitignored for this repository