Skip to content

Package for PyPI - #16

Merged
artem-ogre merged 8 commits into
masterfrom
pypi-packaging
Oct 6, 2026
Merged

artem-ogre merged 8 commits into
masterfrom
pypi-packaging

Conversation

@artem-ogre

@artem-ogre artem-ogre commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Package the bindings for PyPI and publish them from GitHub releases.

Packaging

  • setup.py is replaced by scikit-build-core; the metadata is in pyproject.toml.
  • The package is renamed to pythoncdt, with the compiled module as pythoncdt._core.
  • Type stubs (_core.pyi, py.typed) are included. CI checks them against the module with mypy.stubtest.
  • The sdist includes the CDT submodule and builds on its own.
  • pybind11 comes from the build requirements, not a submodule.
  • numpy is a dependency. Python 3.10 or newer is required.

Releases

  • The version comes from git tags (setuptools-scm).
  • Release Drafter keeps a draft of the next release. Pull request labels choose the version: major, minor, or patch when unlabeled.
  • Publishing the release builds wheels with cibuildwheel for Linux, macOS and Windows and uploads them to PyPI with trusted publishing.

CI

  • ruff lints and formats the code, through pre-commit locally and in CI.
  • Tests run on several threads at once on free-threaded Python.
  • Dependabot keeps the GitHub Actions up to date.

import PythonCDT becomes import pythoncdt.

Replace setup.py with scikit-build-core and move the metadata into
pyproject.toml. The setuptools sdist contained no sources; the new one
includes the CDT submodule and builds on its own. pybind11 now comes from
the build requirements instead of a submodule, numpy is declared as a
dependency, and Python 3.10 or newer is required.

Rename the package to pythoncdt and make it a package with the compiled
module as pythoncdt._core, so that it can ship type stubs (_core.pyi and
py.typed). CI checks the stubs against the module with mypy.stubtest.

Build wheels with cibuildwheel for Linux, macOS and Windows, and publish
them to PyPI with trusted publishing when a GitHub release is published.
Run the tests on several threads at once on free-threaded Python.

Declare the package and its free-threading support stable.
The version is no longer set in pyproject.toml: setuptools-scm takes it
from the git tag, so publishing a GitHub release tagged 2.1.0 publishes
version 2.1.0 to PyPI. Builds between releases get dev versions.

Release Drafter keeps a draft of the next release, listing the merged
pull requests and choosing the version from their labels: major, minor,
or patch when unlabeled. Publishing the draft releases it.
Add pre-commit hooks running ruff's linter and formatter, and a CI job
running the same hooks so that unformatted or failing code can't be
merged. Fix what the linter found and reformat the tests.
CMake passes the version as a string literal, so the stringify macros and
the "dev" fallback are gone. The tests hash the OFF text in memory instead
of writing it to a temporary file.
@artem-ogre artem-ogre self-assigned this Oct 6, 2026
The update only bumps CDT's version and its docs, so the bindings need no
changes.
@artem-ogre artem-ogre added the major Next release bumps the major version label Oct 6, 2026
artem-ogre and others added 2 commits October 7, 2026 00:11
The V2d and Edge buffers had twice the item size as stride, so the second
item was read past the end of the object, and Edge reported its items as
doubles. Their constructors read past short buffers and ignored strides.
They now reuse the checks of the insert overloads, and the Edge buffer is
read-only so that it can't break the v1 < v2 order.

The stubs declare __buffer__ for both classes, so type checkers accept
them as buffers.

CI fetches the full history, so the test builds get the version from the
git tags.
Their pull requests (#8, #14 and #15) shaped how PythonCDT is packaged
and published to PyPI.

Co-authored-by: Mauricio Souza de Alencar <856825+mdealencar@users.noreply.github.com>
Co-authored-by: Aidan Newsome <32934243+aidannewsome@users.noreply.github.com>
@artem-ogre

Copy link
Copy Markdown
Owner Author

Finalizes #15 #8

@artem-ogre
artem-ogre merged commit ab92c53 into master Oct 6, 2026
17 checks passed
@aidannewsome aidannewsome mentioned this pull request Oct 7, 2026
@artem-ogre
artem-ogre deleted the pypi-packaging branch October 12, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Next release bumps the major version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants