Skip to content

Project initialization#1

Merged
eyjafjallac merged 5 commits into
mainfrom
dev/setup
Apr 2, 2026
Merged

Project initialization#1
eyjafjallac merged 5 commits into
mainfrom
dev/setup

Conversation

@Alphaharrius
Copy link
Copy Markdown
Owner

Summary

Bootstrap qRG as an installable Python package managed with uv, with a minimal src/ layout, development tooling, CI, tox, notebook dependencies, and backend-selectable PyTorch extras.

What Changed

  • Added package metadata and build configuration in pyproject.toml
  • Configured setuptools build backend and src/ package discovery
  • Added base runtime dependency:
    • qten
  • Added PyTorch optional extras:
    • cpu
    • cu126
    • cu128
    • cu129
    • cu130
  • Added uv source routing for torch and torchvision to the correct PyTorch indexes
  • Added uv extra conflict configuration so only one backend extra can be selected at a time
  • Added development dependency group:
    • ruff
    • pytest
    • pytest-cov
    • mypy
    • pre-commit
    • tox
    • tox-uv
    • build
    • twine
  • Added notebook dependency group:
    • ipykernel
    • jupyterlab
    • notebook
  • Added minimal package scaffold under src/qrg/
  • Added smoke test under tests/
  • Added pre-commit configuration for:
    • whitespace/yaml hygiene
    • Ruff lint
    • Ruff format check
    • mypy
  • Added GitHub Actions CI using astral-sh/setup-uv
  • Added tox.ini with:
    • py311
    • lint
    • type
  • Updated .gitignore to ignore:
    • uv.lock
    • .DS_Store
    • *.pt
    • *.pth
    • *.safetensors

Tox / CI Behavior

  • tox is now the main local/CI entrypoint
  • py311 runs tests with coverage
  • lint runs Ruff check and format check
  • type runs mypy
  • CI now runs uv sync --group dev followed by uv run tox

Install Examples

  • Dev only:
    • uv sync --group dev
  • Dev + notebooks:
    • uv sync --group dev --group nb
  • Dev + notebooks + CPU torch:
    • uv sync --group dev --group nb --extra cpu
  • Dev + notebooks + CUDA 12.8 torch:
    • uv sync --group dev --group nb --extra cu128

Notes

  • qten is a required base dependency
  • PyTorch is not installed by default; it is selected through extras
  • Only one backend extra may be installed at a time due to the uv conflict configuration
  • uv.lock is intentionally gitignored for this repository

@Alphaharrius Alphaharrius requested a review from Copilot March 31, 2026 09:14
@Alphaharrius Alphaharrius self-assigned this Mar 31, 2026
@Alphaharrius Alphaharrius added the enhancement New feature or request label Mar 31, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/qrg/__init__.py

__all__ = ["__version__"]

__version__ = "0.1.0"
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__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.

Suggested change
__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"

Copilot uses AI. Check for mistakes.
Comment thread tox.ini
Comment on lines +12 to +18
package = wheel
extras =
cpu
dependency_groups =
dev
commands =
pytest --cov=qrg --cov-report=term-missing tests
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread pyproject.toml
Comment on lines +18 to +38
[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",
]
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@eyjafjallac eyjafjallac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

@eyjafjallac eyjafjallac merged commit dd8c334 into main Apr 2, 2026
1 check passed
@eyjafjallac eyjafjallac deleted the dev/setup branch April 2, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants