Skip to content

Conversation

@pniedzielski
Copy link
Collaborator

Closes: #68

@pniedzielski pniedzielski requested a review from a team as a code owner January 13, 2026 19:46
@pniedzielski pniedzielski added the bug Something isn't working label Jan 13, 2026
hallfox
hallfox previously approved these changes Jan 13, 2026
@hallfox hallfox added the skip news No news entry is required label Jan 13, 2026
@pniedzielski pniedzielski force-pushed the fix/cython-warnings branch 2 times, most recently from 7fa3e42 to 91b4c5b Compare January 13, 2026 20:28
This patch moves as much package metadata as possible out from
`setup.py` and into the `project` section of `pyproject.toml`.  The
Python community is moving away from the dynamic metadata added to
`setup.py` and towards declarative metadata in `pyproject.toml`.  One
concrete effect of that is that when we build the project with newer
versions of Python/Cython, we get a warning that we should move away
from a free-form license classifier string and to an SPDX expression
in the `pyproject.toml`.  Naïvely doing that, though, causes many more
warnings about metadata being split between `setup.py` and
`pyproject.toml`.  So, this patch moves everything that is not
Cython-related into the `pyproject.toml` file.

There are two things to note about this patch:

    1. First, why we still need a non-trivial `setup.py`, even after
       moving metadata into `pyproject.toml`.  In order to build our
       Cython extension, we need to search for our C++ dependencies
       with pkgconfig, conditionally add compiler flags depending on
       the platform, and call `cythonize` to actually do the build.
       This is necessarily dynamic, and we cannot add it to the
       declarative `pyproject.toml`.  So, we’re left with only the
       parts of the build relating to Cython left in `setup.py`.

    2. Second, how we deal with version numbers.  Before, one of the
       uses of `setup.py` was loading the `src/blazingmq/_about.py`
       file to find the version information of the package.  Luckily,
       `pyproject.toml` provides functionality to automatically load a
       Python file and read from an variable in it, for exactly this
       sort of use case.  By setting the `version` field as “dynamic”
       and adding a `tool.setuptools.dynamic` stanza with the variable
       to read from, we can remove the manual loading we used to do in
       `setup.py`.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
Cython warns that `noexcept` is ignored for functions returning Python
objects.  This patch removes the one instance where we have a
`noexcept` on a Cython function that returns a Python object.

Signed-off-by: Patrick M. Niedzielski <pniedzielski@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working skip news No news entry is required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Cython warnings

2 participants