Skip to content

build(packages/py): restructure for PyPI publishing - #403

Merged
Ryan-Millard merged 7 commits into
mainfrom
first-release/python
May 28, 2026
Merged

build(packages/py): restructure for PyPI publishing#403
Ryan-Millard merged 7 commits into
mainfrom
first-release/python

Conversation

@Ryan-Millard

@Ryan-Millard Ryan-Millard commented May 28, 2026

Copy link
Copy Markdown
Owner

What was changed & why

packages/py/pyproject.toml and similar were updated to build from the root to enable smoother scikit-build-core builds that are ready for publishing to PyPI.

Fixes: none

Motivation: scikit-build/scikit-build-core#647

Changes

Testing & Verification

Additional Resources

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Root pyproject.toml now contains package metadata, build-system and scikit-build/CMake configuration, uv workspace and ruff settings; the removed packages/py/pyproject.toml is consolidated. CI Python job now builds with uv and uploads artifacts from dist/.

Changes

Build Configuration Consolidation

Layer / File(s) Summary
Package metadata and build backend
pyproject.toml
Top-level [project] section (img2num metadata, Python ≥3.10, numpy>=1.23.5) and [build-system] (scikit-build-core, pybind11, numpy; scikit_build_core.build backend); dev extras include ruff.
CMake and scikit-build configuration
pyproject.toml
[tool.scikit-build] added: CMake source dir, Release build type, CMake args enabling Python build and disabling virtualenv discovery, wheel package inclusion, and sdist include globs.
Workspace and code quality tools
pyproject.toml
[tool.uv] set to package = true and workspace members limited to example-apps/*-py; [tool.ruff] gains exclude, explicit lint rule groups, and per-file __init__.py ignores.
CI build and artifact upload
.github/workflows/cmake-build.yml
Python job “Build wheel” runs ./img2num run uv build, lists dist/, adds a “Verify import” step, and artifact upload path updated to dist/.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

python, build-system

Poem

🐰 From scattered tomls to one high crest,

I hopped the folders, did my best.
CMake and uv now sing in root,
Ruff tidied up each little foot.
Wheels spin in dist — a build well-done!

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Title check ✅ Passed The title 'build(packages/py): restructure for PyPI publishing' clearly describes the main change—restructuring the Python package build configuration to prepare for PyPI publishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No Ai Slop Pr Description ✅ Passed PR description is specific and technical, explaining what was changed (package layout/build config) and why (scikit-build-core, PyPI publishing). No generic AI boilerplate.
No Strangely-Named Root Markdown Files ✅ Passed PR contains no unconventional markdown files at root. Only approved files (README.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md) exist. All changes are configuration files.
Coderabbit Config Needs Update ✅ Passed .coderabbit.yaml is added in this PR with coverage for Python files, ruff tool, and workflows. All new languages/tools are properly covered.
Description check ✅ Passed The PR description clearly explains the changes (restructuring pyproject.toml files and build configuration) and the motivation (enabling smoother scikit-build-core builds for PyPI publishing).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch first-release/python
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch first-release/python

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added build-system python changes to python bindings or python code labels May 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyproject.toml`:
- Line 26: The inline comment "Python package lives HERE (unchanged code
location)" in pyproject.toml is misleading; either remove that comment entirely
or replace it with a correct clarification referencing the actual location of
the Python sources (e.g., that source packages are under packages/py/img2num/).
Locate the exact comment string "Python package lives HERE (unchanged code
location)" and delete or update it so the file no longer suggests the package is
in the repository root.
- Around line 1-8: The [project] section in pyproject.toml is missing essential
metadata required for PyPI; update the [project] table by adding a license field
(e.g., SPDX identifier via license = { text = "..." } or license-expression), a
readme entry pointing to your README file and content-type, authors or
maintainers list with names and emails, a classifiers array (development status,
intended audience, license, Python versions), and a urls table with
repository/homepage/docs links; also replace the placeholder version = "0.0.0"
with the actual release version before publishing.
- Around line 11-15: Pin and constrain NumPy in both the build-system and
project dependencies: update the "numpy" entry in [build-system].requires and
the "numpy" entry in [project].dependencies to a specific constrained range
(e.g. "numpy>=<min_supported>,<<=optional_upper>") so the PEP 517 isolated build
environment uses the same compatible NumPy as runtime; ensure the same version
spec is used in both the requires list and the dependencies list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 36bd8d7b-9536-4170-9b19-89de8dc933df

📥 Commits

Reviewing files that changed from the base of the PR and between b7207b0 and 4cdd65b.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • packages/py/pyproject.toml
  • pyproject.toml
💤 Files with no reviewable changes (1)
  • packages/py/pyproject.toml
📜 Review details
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build C/C++ / Build WASM (bindings/js)
  • GitHub Check: Build C/C++ / Build Python
  • GitHub Check: Build C/C++ / Build C & C++
  • GitHub Check: Build Documentation Site / Build Docusaurus Site
  • GitHub Check: Lint & Validate Code
  • GitHub Check: Analyze (c-cpp)
🔇 Additional comments (2)
pyproject.toml (2)

36-43: LGTM!


45-68: LGTM!

Comment thread pyproject.toml
Comment thread pyproject.toml
Comment thread pyproject.toml Outdated
@github-actions github-actions Bot added the ci label May 28, 2026
@Ryan-Millard
Ryan-Millard force-pushed the first-release/python branch from ab65c7f to 6f8946c Compare May 28, 2026 21:17
@Ryan-Millard
Ryan-Millard force-pushed the first-release/python branch from 74b7238 to fb02440 Compare May 28, 2026 21:54
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

@Ryan-Millard

Copy link
Copy Markdown
Owner Author

Hi @Krasner

I have moved the Python package to be at the root because scikit-build-core has very poor monorepo support.

You can see what I mean here: scikit-build/scikit-build-core#647

@Ryan-Millard

Copy link
Copy Markdown
Owner Author

@coderabbitai suggest a conventional commit and description.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@Ryan-Millard Here's a suggested conventional commit message and description:


Subject line:

build(python): move pyproject.toml to repo root for PyPI publishing

Full commit message:

build(python): move pyproject.toml to repo root for PyPI publishing

Relocate the Python package build configuration from packages/py/ to
the repository root to work around scikit-build-core's lack of monorepo
support (see scikit-build/scikit-build-core#647).

- Move all [project] metadata, [build-system], [tool.scikit-build], and
  [tool.uv] settings into the root pyproject.toml
- Pin numpy>=1.23.5 as a runtime dependency
- Update [tool.uv.workspace] to remove the packages/py member entry and
  point workspace members to example-apps/*-py only
- Expand ruff configuration with explicit rule selections and per-file
  ignores for __init__.py
- Update cmake-build CI workflow to run `uv build` via `./img2num run`,
  upload artifacts from dist/ instead of packages/py/build-py/, and add
  a wheel import verification step

BREAKING CHANGE: example-apps/console-py build is affected and requires
a follow-up fix in a subsequent PR.

A few notes:

  • I used build(python) as the scope since the change spans the root pyproject.toml and CI rather than being scoped purely to packages/py — but build(packages/py) (matching your PR title) is equally valid if you want to stay consistent with the branch naming.
  • The BREAKING CHANGE footer signals the console-py regression you mentioned in the PR description, which would bump the semver major if you're following semver strictly.

@Ryan-Millard
Ryan-Millard merged commit 25fa565 into main May 28, 2026
18 checks passed
@Ryan-Millard
Ryan-Millard deleted the first-release/python branch May 28, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-system ci python changes to python bindings or python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant