Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: [python-package] [ci] use setup.cfg and pyproject.toml for package-building configuration #5625

Closed
wants to merge 9 commits into from

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Dec 7, 2022

Contributes to #5061 .

This PR proposes moving some of the configuration for how to build the Python package out of setup.py and into the two configuration files mentioned in PEP 517 and PEP 518.

  • setup.cfg: package metadata like license file, requirements, trove classifiers, etc.
  • pyproject.toml: description of which "build backend" to use and what is required to build sdists and wheels

This shouldn't break anything about LightGBM's existing Python package source distributions or wheels. But it gets the project a bit closer to supporting the package-building standards described in PEP 517 and PEP 518.

Shouldn't cmake be a build dependency?

Probably, but I'm proposing deferring that to a later PR. Including cmake as a build dependency in pyproject.toml causes installation of the cmake from PyPI, regardless of whether or not you had separately installed cmake another way.

If you're on a system that PyPI doesn't have a cmake wheel for, that means building lightgbm from source will also require building cmake from source. See for example the failed CUDA CI jobs from an earlier state of this PR (build link).

Failed to build cmake
ERROR: Could not build wheels for cmake, which is required to install pyproject.toml-based projects
error: subprocess-exited-with-error

How I tested this

References

  • PEP 517: "PEP 517 – A build-system independent format for source trees"
  • PEP 518: "Specifying Minimum Build System Requirements for Python Projects"
  • "Dependencies management in setuptools" (link to setuptools docs)
  • PyPA docs on pyproject.toml (link)

@jameslamb
Copy link
Collaborator Author

I've learned a lot since first opening this.I'm going to close it, lock it, and open a new PR with a different proposal in the next few days.

@jameslamb jameslamb closed this Feb 11, 2023
@microsoft microsoft locked as resolved and limited conversation to collaborators Feb 11, 2023
@jameslamb jameslamb deleted the python/static-metadata branch June 11, 2023 03:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant