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

Move project metadata from setup.py to pyproject.toml #20427

Merged
merged 5 commits into from
Nov 1, 2024

Conversation

mwtoews
Copy link
Contributor

@mwtoews mwtoews commented Oct 30, 2024

This PR take's on PEP 621 as supported by setuptools to move the project's metadata from setup.py to pyproject.toml.

Dynamic features that are supported fetch the version from keras.src.version.__version__ and the common dependencies from requirements-common.txt (it cannot read requirements.txt, as only a subset of the requirements format is supported).

Modern projects shouldn't need setup.py anymore, so this file is removed. But if it is expected, a shim with from setuptools import setup; setup() can be added.

pip_build.py is updated to support the changes, as well as a few GHA workflows.

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.99%. Comparing base (4ba7d6f) to head (44456bf).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20427      +/-   ##
==========================================
+ Coverage   77.41%   81.99%   +4.58%     
==========================================
  Files         514      514              
  Lines       47118    47180      +62     
  Branches     7400     7409       +9     
==========================================
+ Hits        36478    38687    +2209     
+ Misses       8916     6704    -2212     
- Partials     1724     1789      +65     
Flag Coverage Δ
keras 81.85% <ø> (+4.56%) ⬆️
keras-jax 64.90% <ø> (+0.02%) ⬆️
keras-numpy 59.86% <ø> (?)
keras-tensorflow 65.89% <ø> (+0.02%) ⬆️
keras-torch 64.85% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pyproject.toml Show resolved Hide resolved
Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

pip_build.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
dependencies = {file = "requirements-common.txt"}

[tool.setuptools.packages.find]
include = ["keras", "keras.*"]
Copy link
Member

Choose a reason for hiding this comment

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

No excludes?

Copy link
Contributor Author

@mwtoews mwtoews Oct 30, 2024

Choose a reason for hiding this comment

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

setup.py had exclude=("*_test.py", "benchmarks"), but this didn't do anything, so was dropped with the transition. The reason why it didn't do anything is that only Python modules under "keras" are found (thus "benchmarks" was already excluded), and individual Python files cannot be excluded -- only modules can be excluded. But I see that pip_build.py has logic to ignore the "_test.py" files.

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Nov 1, 2024
@fchollet fchollet merged commit cfa32a3 into keras-team:master Nov 1, 2024
6 checks passed
@google-ml-butler google-ml-butler bot removed ready to pull Ready to be merged into the codebase kokoro:force-run labels Nov 1, 2024
@mwtoews mwtoews deleted the pyproject-build branch November 1, 2024 02:16
wang-xianghao pushed a commit to wang-xianghao/keras-dev that referenced this pull request Nov 20, 2024
* Move project metadata from setup.py to pyproject.toml

* Override black target version (for now) to avoid other changes

* PR feedback

* Move explicit list of dependencies from setup.py to pyproject.toml

* pathlib was already imported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants