Add Python feature to Maturin configuration in pyproject.toml #347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem is this trying to solve
While developing an application in Python that uses Hifitime I moved from Python 3.12 to 3.13.
This resulted in errors at update of the dependencies:
Even after adding
cffi
to my pyenv-based Python I would get other errors:Exploration
To solve this issue I tried multiple things, to the point of cloning the Hifitime repository and build the project there using maturin. When using the instructions in the repository's readme everything would build fine, however, when using the ones that were executed by Poetry they would fail with the same errors.
The README's instructions:
Poetry's instructions:
Poetry's instructions seemed a bit off, especially given what the README warns the users about in the first few lines:
This, in conjunction with the fact that Poetry's lock file reported built packages only up till
3.12
made me think that there was something wrong with the way Hifitime's package was built.Proposed solution
Add the required Python package to maturin's configuration inside
pyproject.toml
as that is read by thepep517
build process.This is allowing me to build the packages by just running