Repository navigation
BLD: Add modern pyproject.toml file to automate dependencies for pip workflow - #811
Open
MargotHTeunisse wants to merge 12 commits into
Open
MargotHTeunisse wants to merge 12 commits into
MargotHTeunisse wants to merge 12 commits into
Conversation
Add basic descriptors based on available information; should be checked by core maintainers. No dependencies added yet. Version is missing as yet; might be able to use versioneer?
Dependencies are based on existing pip workflow. No distinction yet between core/optional dependencies, except for pytest which is designated 'test'.
Remove explicit dependencies in version matrix
Currently, this dependency group only contains pytest; not indicating a version, as this is not indicated in the original configuration.
This is in response to Numpy 2.x.x incompatibility with Pandas for this Python version.
In workflow, run all matrix rows as 'fast' except 'Python 3.13 (no numba)' Add test to dependency-groups in workflow Too easy to make errors in punctuation otherwise Add missing dependency-groups for Python 3.11 workflow
Seems best to keep these consistent with setup.py for now
Change 'build' to correct keyword 'build-system' Remove uv requirement from build, since I don't currently use it in the workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi trackpy contributors,
some context: I'm Margot, a PhD in soft matter in Leiden who's now looking to continue in research software engineering. I've used trackpy in the past, and asked @nkeim whether I might be able to contribute to the package. He suggested that I might look at modernizing the workflow, as I have some experience using a modern build in my own project.
This PR changes the pip workflow, so please take extra care when reviewing it.
What?
I've automated the dependencies for the pip workflow by moving them to a pyproject.toml file. I've designated most dependencies as mandatory dependencies. The exceptions are numba, which is in the optional dependency group 'fast', and pytest, which is in 'test'.
This PR only touches the pip workflow; it doesn't change the conda workflow, as conda is still based on setup.py.
How?
pyproject.toml file is a standard file which contains the metadata for a modern Python project. It's automatically recognized by pip when
pip installis run.Note that the build backend is explicitly specified under the
build-systemkeyword. I've kept to the old setuptools backend for now, as is also recommended by the official Python documentation.Although pyproject.toml is the first place where pip looks, it doesn't conflict with setup.py. To let properties be determined by setup.py, you can set them as dynamic in pyproject.toml. If a property is not set as dynamic in pyproject.toml, then the definition in setup.py is ignored.
I've set most of the metadata as dynamic for now, to keep them consistent with the existing setup.py. You can set these explicitly in pyproject.toml if you prefer, though 'version' is probably best kept dynamic.
Why?
As I've discussed with @nkeim, in the old version many of the dependencies are installed manually in the workflow, rather than being included in the build process. This indicates that real users would also need to install these packages manually.
By including the dependencies in the pyproject.toml file, I can reduce the workflow to a simple
pip install ., optionally with extra dependency groups such astestorfast.Further notes
I've tried to keep the workflow as close as possible to the old workflow. I would suggest further iterating upon this, for example to clearly define optional dependencies, or work towards a more modern uv-based build. For now though, automating the dependencies was my priority.