Skip to content

BLD: Add modern pyproject.toml file to automate dependencies for pip workflow - #811

Open
MargotHTeunisse wants to merge 12 commits into
soft-matter:masterfrom
MargotHTeunisse:build-automation
Open

MargotHTeunisse wants to merge 12 commits into
soft-matter:masterfrom
MargotHTeunisse:build-automation

Conversation

@MargotHTeunisse

@MargotHTeunisse MargotHTeunisse commented Oct 28, 2026 •

Copy link
Copy Markdown

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 install is run.

Note that the build backend is explicitly specified under the build-system keyword. 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 as test or fast.

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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant