Modernize Python packaging using uv and pyproject.toml#225
Modernize Python packaging using uv and pyproject.toml#225
Conversation
This PR updates the project to use modern Python packaging standards with uv as the package manager and drops Python 2 support. Changes: - Add pyproject.toml with modern PEP 621 metadata - Replace setup.py, setup.cfg, requirements*.txt with pyproject.toml - Drop Python 2 support (requires Python 3.8+) - Remove 'future' dependency (no longer needed) - Migrate tests from nose to pytest - Remove Python 2 compatibility code from source files - Update .gitignore with modern Python/uv patterns All 10 tests pass with pytest. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR removes Python 2 compatibility shims, migrates packaging to Hatch via Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as "Developer / Push"
participant GH as "GitHub Actions"
participant UV as "setup-uv / uv"
participant Registry as "Package Registry"
Dev->>GH: push tag / release
GH->>GH: checkout repo
GH->>UV: setup-uv (enable-cache)
GH->>UV: run uv build
UV->>Registry: uv publish
Registry-->>GH: publish result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@CLAUDE.md`:
- Around line 101-122: Update the README sections to match this PR’s
modernization: remove the entire "Python 2/3 Compatibility" section, change the
"Testing Notes" text to say tests use pytest instead of nosetests and drop any
mention of the `future` library, and update the "Version Management" section to
state that the project version is defined in pyproject.toml rather than
setup.py; edit the sections titled "Testing Notes", "Python 2/3 Compatibility"
(remove), and "Version Management" accordingly.
- Around line 23-39: Update the Build and Installation command examples in
CLAUDE.md to use the new pyproject/uv workflow instead of removed setup.py and
requirements-testing.txt: replace the "python setup.py sdist bdist_wheel" line
with "uv build", change "pip install -e ." under Build to "uv pip install -e .",
change "pip install ." under Installation to "uv pip install .", and replace the
"pip install -r requirements-testing.txt" test deps line with "uv sync --group
testing" (also adjust the accompanying comment to indicate dev/testing
dependencies).
- Around line 12-21: Update the testing examples in CLAUDE.md to use pytest
instead of nosetests: replace "nosetests test/test_qbatch.py" with "pytest
test/test_qbatch.py", change the specific-test syntax from "nosetests
test/test_qbatch.py:test_run_qbatch_local_piped_commands" to the pytest style
"pytest test/test_qbatch.py::test_run_qbatch_local_piped_commands", and update
the verbose example from "nosetests -v test/test_qbatch.py" to "pytest -v
test/test_qbatch.py"; ensure the three example lines referencing
test/test_qbatch.py are edited accordingly.
In `@pyproject.toml`:
- Around line 50-54: The [project.optional-dependencies] testing group still
lists legacy packages "nose>=1.0" and "ushlex"; remove that stale testing table
or replace its contents to match the modern pytest setup under
[dependency-groups] (testing) so that pip install qbatch[testing] pulls the
correct pytest dependencies—specifically delete or update the
[project.optional-dependencies] testing block to either be removed entirely or
to reference the same pytest packages declared in [dependency-groups] testing.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1d07e11 to
cbb2f27
Compare
The testing group referenced nose and ushlex, which are Python 2-era packages no longer used. The correct pytest dependencies are already declared in [dependency-groups] testing. This addresses the remaining CodeRabbit comment on PR #225. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/publish.yml:
- Around line 19-24: Update the GitHub Actions step that currently uses
astral-sh/setup-uv@v4 (the "Install uv" step) to a newer major version by
replacing the pinned action version with at least `@v7` (preferably `@v7.3.0`); keep
the same inputs (enable-cache: true) and the subsequent "Build package" run step
that invokes uv build unchanged so the workflow uses the latest security fixes
and improvements.
🧹 Nitpick comments (2)
CLAUDE.md (2)
47-48: Hard-coded line count will go stale.Line 47 references "777 lines" for
qbatch.py. This will become inaccurate as the file evolves. Consider removing the exact count or replacing it with a qualitative description (e.g., "single large module").Similarly, lines 52, 57, 64–68 reference specific line numbers for functions and templates — these will drift with edits.
32-39: Minor: Installation section shows bothpipanduv pipwithout guidance on which to prefer.Since this PR adopts uv as the package manager, consider indicating that
uv pip install .is the preferred approach, or consolidate the two options with a brief note (e.g., "either works; uv is recommended").
.github/workflows/publish.yml
Outdated
| @@ -16,16 +16,11 @@ jobs: | |||
| id-token: write | |||
| steps: | |||
| - uses: actions/checkout@v4 | |||
.github/workflows/publish.yml
Outdated
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v4 |
| run: | | ||
| python setup.py sdist bdist_wheel # Could also be python -m build | ||
| run: uv build | ||
| - name: Publish package distributions to PyPI |
There was a problem hiding this comment.
@copilot update this to use the uv publish workflow
| @@ -16,16 +16,11 @@ jobs: | |||
| id-token: write | |||
There was a problem hiding this comment.
Pull request overview
This PR modernizes the repo’s Python packaging by moving to pyproject.toml (Hatchling) with uv-based workflows, while removing Python 2 compatibility code and legacy packaging/testing infrastructure.
Changes:
- Replace legacy packaging files (
setup.py,setup.cfg,requirements*.txt) with a PEP 621pyproject.toml. - Remove Python 2 compatibility shims from the library and tests; drop
future/ushlex/nose-era dependencies. - Update automation/docs/metadata (GitHub publish workflow,
.gitignore, README links, citation metadata, newCLAUDE.md).
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Introduces modern project metadata, build backend (Hatchling), scripts, and dependency groups. |
.github/workflows/publish.yml |
Switches release publishing to uv build / uv publish. |
qbatch/qbatch.py |
Removes Python 2 compatibility imports and environment encoding workaround. |
qbatch/__init__.py |
Drops Python 2 __future__ import. |
test/test_qbatch.py |
Removes Python 2 compatibility setup and updates issue link. |
.gitignore |
Expands ignores for common Python/venv/test/build artifacts and uv files. |
README.md |
Updates Travis badge repository path. |
CITATION.cff |
Updates repository URL. |
CLAUDE.md |
Adds developer-oriented guidance and project architecture notes. |
setup.py |
Removed legacy setuptools packaging entrypoint. |
setup.cfg |
Removed legacy wheel/metadata config. |
requirements.txt |
Removed legacy runtime dependency pin. |
requirements-testing.txt |
Removed legacy test dependency list. |
.travis.yml |
Removes Travis CI configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| version: "2.2" | ||
| date-released: 2020-03-12 |
There was a problem hiding this comment.
repository-code was updated, but version/date-released still reflect the 2020 (2.2) release, which is inconsistent with the current package version in pyproject.toml (2.3.1). Please update these fields (or remove them) so the citation metadata matches the current release.
| version: "2.2" | |
| date-released: 2020-03-12 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR updates the project to use modern Python packaging standards with uv as the package manager and drops Python 2 support.
Changes:
All 10 tests pass with pytest.
Summary by CodeRabbit
Chores
Documentation