-
Notifications
You must be signed in to change notification settings - Fork 28
chore: move to packaging with pyproject.toml #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughCI workflow switches to uv for installs, lint, build, and tests. Packaging and dependency files are removed/trimmed (setup.py deleted; requirements and test-requirements pruned/removed). OpenAPI generator ignore/manifests updated to exclude packaging files. Static analysis exclusions corrected in pyproject.toml. Changes
Sequence Diagram(s)Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks (3 passed)✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
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 |
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
c395bec
to
2ed92f5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (70.70%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #220 +/- ##
=======================================
Coverage 70.70% 70.70%
=======================================
Files 134 134
Lines 10881 10881
=======================================
Hits 7693 7693
Misses 3188 3188 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pyproject.toml (1)
139-148
: Replace unsupported "packages" with "files" in [tool.mypy]mypy does not use a top-level
packages
key in pyproject.toml; setfiles = ["openfga_sdk"]
so mypy explicitly checks the package.exclude
accepts either a single regex string or an array — the current list form is valid, so changing it is optional.
File: pyproject.toml (lines 139–148).github/workflows/main.yaml (1)
64-96
: Publish job still uses legacy setup.py and test-requirements; switch to pyproject+uv (hatchling backend).This path will fail after removing setup.py/test-requirements.txt. Build with uv or python -m build, then publish.
publish: @@ - name: Set up Python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.10" - cache: "pip" - cache-dependency-path: | - **/pyproject.toml - **/requirements*.txt - **/test-requirements*.txt + cache: "pip" + cache-dependency-path: | + **/pyproject.toml @@ - - name: Install dependencies - run: pip install -r test-requirements.txt --upgrade pip + - name: Install build tool + run: pip install uv @@ - - name: Build package - run: | - pip install setuptools wheel - python setup.py sdist bdist_wheel + - name: Build package + run: | + export UV_LINK_MODE=copy + uv buildOptionally add a
uvx twine check dist/*
step before publish for validation.
🧹 Nitpick comments (4)
pyproject.toml (3)
13-13
: Versioning source-of-truth: ensure tag/version alignment or switch to dynamic SCM versioning.If releases are triggered by tags like vX.Y.Z (see workflow),
project.version = "0.9.5"
must be kept in sync with tags. Considerdynamic = ["version"]
with hatch-vcs or set version via environment to avoid drift.Proposed change:
[project] name = "openfga-sdk" -version = "0.9.5" +dynamic = ["version"] @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" + +[tool.hatch.version] +source = "vcs"
36-36
: PEP 621 license field: prefer file/text table over bare string.Some build backends expect
license = { file = "LICENSE" }
or{ text = "Apache-2.0" }
. Using a plain string isn’t universally supported.-requires-python=">=3.10" -license="Apache-2.0" +requires-python = ">=3.10" +license = { file = "LICENSE" }
128-135
: CI threshold mismatch with Codecov target.Tests use
--cov-fail-under=60
while Codecov’s project target is 80%, causing confusing mixed signals. Align thresholds (recommend 80)..github/workflows/main.yaml (1)
31-38
: Cache dependency path can drop requirements globs in all jobs.They’re removed repo-wide; keeping them is harmless but noisy.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lock
is excluded by!**/*.lock
📒 Files selected for processing (7)
.github/workflows/main.yaml
(1 hunks).openapi-generator-ignore
(1 hunks).openapi-generator/FILES
(0 hunks)pyproject.toml
(2 hunks)requirements.txt
(0 hunks)setup.py
(0 hunks)test-requirements.txt
(0 hunks)
💤 Files with no reviewable changes (4)
- requirements.txt
- .openapi-generator/FILES
- setup.py
- test-requirements.txt
🔇 Additional comments (3)
pyproject.toml (2)
47-55
: Add pytest to dev group; verify dev-tool pinsFile: pyproject.toml (lines 47-55)
[dependency-groups] dev = [ "griffe>=0.41.2", "mock>=5.1.0", + "pytest>=8", "pytest-asyncio>=0.25", "pytest-cov>=5", "ruff>=0.9", "mypy>=1.14.1", ]
- CI must install the dev dependency-group so
uv run pytest
can find pytest.- Verification failed in the sandbox: 'uv' CLI remained unavailable after install (uv: command not found); cannot confirm pytest-asyncio>=0.25, ruff>=0.9, mypy>=1.14.1 are resolvable on PyPI — run the provided verification locally or relax pins if any package/version is unavailable.
37-42
: CI: inject the matrix urllib3 version into uv-run (don’t rely on a global pip install).uv creates an isolated virtualenv for uv run and won’t pick up a globally pip-installed urllib3 — pass the matrix value into uv with --with so the test environment actually uses the matrixed urllib3. (github.com)
- uv run pytest --cov-report term-missing --cov=openfga_sdk --cov-fail-under=60 test/ && \ + uv run --with "urllib3==${{ matrix.urllib3-version }}" \ + pytest --cov-report term-missing --cov=openfga_sdk --cov-fail-under=80 test/ && \Also remove the global
pip install "urllib3==..."
from the workflow (it installs outside uv’s venv and won’t affect uv run)..openapi-generator-ignore (1)
18-20
: LGTM: generator now ignores legacy packaging manifests.Ignoring setup.py/requirements files prevents regeneration from the SDK generator, which aligns with pyproject-only packaging.
42dbae7
to
119de2d
Compare
119de2d
to
382d028
Compare
This PR is equivalent to: #193 |
Original PR: openfga/sdk-generator#550
Description
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
main
Summary by CodeRabbit
Chores
Build
Dependencies
Bug Fixes