Fix pyproject.toml: add build-system section to unblock editable installs#1531
Merged
Fix pyproject.toml: add build-system section to unblock editable installs#1531
Conversation
…e installs Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/c14543a0-cc16-4a5a-9d4d-c8163a6e56e5 Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix packaging configuration for editable installs
Fix pyproject.toml: add PEP 621 build-system and project sections to unblock editable installs
Apr 20, 2026
thinkall
approved these changes
Apr 25, 2026
There was a problem hiding this comment.
Pull request overview
Adds minimal PEP 621 metadata to pyproject.toml so modern pip/setuptools (notably on Python 3.13) can perform editable installs without failing validation, while aiming to keep setup.py/flaml/version.py as the source of truth.
Changes:
- Add
[build-system]withsetuptools+wheelbackend configuration. - Add a minimal
[project]table with dynamic metadata fields. - Add
[tool.setuptools.dynamic]mapping to sourceversionfromflaml.version.__version__.
…standard metadata section Agent-Logs-Url: https://github.com/microsoft/FLAML/sessions/df35ec46-67c3-4ab9-8949-700102d5b1a7 Co-authored-by: thinkall <3197038+thinkall@users.noreply.github.com>
Copilot
AI
changed the title
Fix pyproject.toml: add PEP 621 build-system and project sections to unblock editable installs
Fix pyproject.toml: add build-system section to unblock editable installs
Apr 25, 2026
thinkall
approved these changes
Apr 27, 2026
jianglibigdata
approved these changes
Apr 27, 2026
Collaborator
|
@copilot sync with main branch |
Contributor
Author
The branch is already in sync with |
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.
pip install -e .fails on Python 3.13 because newer pip/setuptools strictly validatespyproject.toml— the file had[tool.*]config but no[build-system]table, triggeringconfiguration error: project must contain ['version'] properties.Changes
[build-system]— declaressetuptools>=64+wheelwith thesetuptools.build_meta:__legacy__backend, which keepssetup.pyfully authoritative for all metadata (name, version, description, readme, dependencies, classifiers, extras)[metadata]— this was asetup.cfgconvention with no effect inpyproject.tomlThe version remains defined solely in
flaml/version.pyand is read bysetup.py— no duplication. All existing[tool.*]configuration is preserved unchanged.Original prompt
The GitHub Actions job failed in microsoft/FLAML in workflow
.github/workflows/python-package.ymlduring theInstall packages and dependenciesstep when runningpip install -e .on Python 3.13.Failure details from job 72079181022 in run 24645772957:
invalid pyproject.toml config: projectconfiguration error: project must contain ['version'] propertiesRelevant files at commit
9d54e5832b158fe5e732372b59a6d49f09b4b80a:pyproject.tomlcurrently contains tool configuration and legacy[metadata], but no valid[build-system]/[project]configuration for editable builds.setup.pycurrently reads the package version fromflaml/version.pyand passes it tosetuptools.setup(...).flaml/version.pycontains the canonical version string:__version__ = "2.5.0".Please create a pull request that fixes the packaging/build configuration so editable installs succeed in CI, while keeping the only version definition in
flaml/version.pyif possible.Requirements:
flaml/version.py.pyproject.tomlandversion.pyunless absolutely necessary.pyproject.toml.Likely approach:
[build-system]section.[project]section.flaml.version.__version__(or an equivalent supported mechanism), instead of hardcoding it inpyproject.toml.Please include a concise PR title and implement the fix directly in the repository.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The job is failing during
pip install -e .on Python 3.13 because the repository has apyproject.tomlthat is not a valid PEP 621 project definition, but pip/setuptools treats it as such when building an editable install. The log shows:ValueError: invalid pyproject.toml config: projectconfiguration error: project must contain ['version'] propertiesRoot cause
Your
pyproject.toml(at ref9d54e5832b158fe5e732372b59a6d49f09b4b80a) contains only tool config sections plus a legacy[metadata]table:pyproject.tomlhas[metadata] ...and[tool.*] ...[project]table with aversion(or adynamic = ["version"]declaration)Newer build behavior (and especially Python 3.13 + recent packaging tooling) is stricter: if a
pyproject.tomlis present, editable builds validate it and expect proper PEP 621 metadata.Fix (recommended): add a minimal PEP 621
[project]section (and build-system)Update
pyproject.tomlto include valid packaging metadata. Minimal example (adjust name/requirements as appropriate for FLAML):If you don’t want to hardcode the version in
pyproject.toml, you can make it dynamic (only if your setuptools config is set up to provide it):…but then you must ensure setuptools can resolve the version from your existing packaging setup (e.g., via
setup.py/setuptools_scm/ an attribute). If you don’t already have dynamic version wiring, the simplest and most robust fix is to setversion = "..."directly.
Why this solves the CI failure
The workflow (
.github/workflows/python-package.ymlat the same ref) runs:That editable install triggers “getting requirements to build editable”, which currently fails because
pyproject.tomlis invalid. Adding a valid[project](withversionordynamic) makes the config pass validation and allows the editable install to proceed on Python 3.13 (and the other matrix versions).Alternative (less ideal): remove/rename
pyproject.tomlIf you’re not ready to adopt PEP 621 yet, removing
pyproject.tomlwould avoid the validation path—but you’d lose the tool configuration currently stored there (ruff,black,pytestoptions). The better long-term approach is to keeppyproject.tomland make it PEP 621-compliant as shown above.User: Please find a solution for this failing job. Use the logs, job def...
This pull request was created from Copilot chat.