Skip to content

BLD: specify build-system and move project metadata to pyproject.toml#7279

Open
mwtoews wants to merge 5 commits into
cylc:masterfrom
mwtoews:pep-621
Open

BLD: specify build-system and move project metadata to pyproject.toml#7279
mwtoews wants to merge 5 commits into
cylc:masterfrom
mwtoews:pep-621

Conversation

@mwtoews

@mwtoews mwtoews commented Apr 17, 2026

Copy link
Copy Markdown

This is a build refactor to take advantage of modern Python package builds and metadata. Other motivation for this is that modern tools like uv could be used, e.g. uv sync --all-extras (resolved with this PR, but not on master).

Refer to Configuring setuptools using pyproject.toml files for some of the changes, and PEP-621 for Storing project metadata in pyproject.toml.

Firstly, this now specifies a build-system PEP-517 based on setuptools, done at the top of pyproject.toml.

Migrate metadata from setup.cfg to pyproject.toml, with a few notes:

  • Add author email
  • Clarify GLP licence to SPDX-compatible short identifier: GPL-3.0-or-later
  • Specify licence files: ["COPYING", "CONTRIBUTING.md"]
  • Remove licence from classifiers, as this is deprecated
  • Keep all extras, although the "all" extra has a slightly esoteric syntax that might not be universally accepted (but works with modern pip versions)

The entry points mostly transition over, with an exception of the extras specifier, which is converted to a comment. There are two reasons for removing the extras argument:

  1. E.g. a build message is shown: "cylc.flow.scripts.report_timings:main [report-timings] - using extras for entry points is not recommended"
  2. It is fragile, e.g. log_data_store = "cylc.flow.main_loop.log_data_store [main_loop-log_data_store]" raises a format error.

If the extras specifier is important for these entry points, then I suggest to check their requirements in the script at runtime. For now, a comment of the extra is retained in pyproject.toml.

Finally, there is no need to keep either setup.py or setup.cfg, so they are cleaned up. There was an old "bdist_rpm" entry in setup.cfg that has been abandoned a while ago (PEP-527).

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@oliver-sanders

Copy link
Copy Markdown
Member

@oliver-sanders oliver-sanders left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mwtoews, thanks for your interest in the Cylc project.

Unfortunately, the package does not build, producing a ModuleNotFoundError: No module named 'cylc' error. This might be to do with package finding, note, cylc.flow is a namespace package.

Please could you rebase this branch to resolve the conflict in the CHANGES file (rebase not merge).

I've gone through and marked all of the changes (beyond the expected) I could find for the benefit of other reviewers.

Comment thread pyproject.toml
[project]
name = "cylc-flow"
authors = [
{name = "Hilary Oliver", email = "hilary.j.oliver@gmail.com"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change: email scraped from .mailmap file.

@hjoliver, preferences?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @gmail.com address appears to be @hjoliver 's primary email contact in .mailmap. Two related notes: email is optional, so it can be removed; and multiple authors and maintainers can be specified. (The decade old setup.py format only allowed one author and one maintainer).

Comment thread pyproject.toml
Comment thread pyproject.toml
Comment thread pyproject.toml
Comment thread pyproject.toml
Comment thread setup.cfg Outdated

@mwtoews mwtoews left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An outstanding issue with Dockerfile is now resolved, I'd expect this to pass all CI tests. A few remaining comments follow.

Comment thread setup.cfg
name = cylc-flow
version = attr: cylc.flow.__version__
author = Hilary Oliver
url=https://cylc.org/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not have an equivalent for PEP 621, but is better done with pyproject.toml:

[project.urls]
Home = "https://cylc.org/"

Comment thread setup.cfg
scheduling
license = GPL
license_file = COPYING
platforms = any

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platforms does not have a PEP 621 equivalent, so not migrated. As far as I can tell, it's a left-over from deprecated distutils here.

@oliver-sanders oliver-sanders requested a review from MetRonnie May 20, 2026 14:46
@oliver-sanders oliver-sanders added this to the 8.7.0 milestone May 20, 2026

@oliver-sanders oliver-sanders left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, cheers.

@hjoliver, one question about the optional "author" field: #7279 (comment)

@oliver-sanders

Copy link
Copy Markdown
Member

87.10% (target 92.00%)

Coverage has randomly dropped, hopefully random/unrelated, kicking tests

@oliver-sanders

oliver-sanders commented May 22, 2026

Copy link
Copy Markdown
Member

(coverage recovered on re-run, was just a random error)

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.

setup: update to SPDX license expression Remove setup.py (in due course)

2 participants