Skip to content

Fix editable install failure: migrate packaging metadata to PEP 621 (pyproject.toml)#1538

Merged
thinkall merged 5 commits intomainfrom
copilot/fix-github-actions-install-package
Apr 27, 2026
Merged

Fix editable install failure: migrate packaging metadata to PEP 621 (pyproject.toml)#1538
thinkall merged 5 commits intomainfrom
copilot/fix-github-actions-install-package

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

setuptools 81.x (within the <82 pin) introduced a breaking validation: any [tool.setuptools.*] section in pyproject.toml now requires a valid [project] table with a version field. PR #1530 added [tool.setuptools.package-data] without a [project] table, causing pip install -e . to fail with:

ValueError: invalid pyproject.toml config: `project`.
configuration error: `project` must contain ['version'] properties

Changes

  • pyproject.toml — Full PEP 621 migration:

    • Switched build backend from setuptools.build_meta:__legacy__setuptools.build_meta
    • Added [project] table with all package metadata (name, description, readme, license, authors, classifiers, dependencies, optional-dependencies, requires-python)
    • Version stays in flaml/version.py — surfaced via dynamic = ["version"] + [tool.setuptools.dynamic]
    • Added [tool.setuptools.packages.find], [tool.setuptools.package-data] (covers py.typed and flaml.default JSON files)
    • Added missing Programming Language :: Python :: 3.13 classifier
    • Removed dead pandas>=1.1.4,<2.0.0; python_version<'3.10' condition (unreachable given requires-python = ">=3.10")
  • setup.py — Reduced to a stub (setuptools.setup()) now that all metadata lives in pyproject.toml

  • flaml/py.typed — Added PEP 561 marker file (original intent of PR feat: add py.typed marker for PEP 561 compliance #1530)

Original prompt

Fix the failing GitHub Actions job from https://github.com/microsoft/FLAML/actions/runs/24983041742/job/73149559247?pr=1530.

Failure details:

  • Repository: microsoft/FLAML
  • Workflow: Build (.github/workflows/python-package.yml)
  • Run/job: run 24983041742, job 73149559247, PR 1530
  • Failing step: Install packages and dependencies
  • Command that fails: pip install -e .
  • Error:
    Getting requirements to build editable did not run successfully.
    ValueError: invalid pyproject.toml config: `project`.
    configuration error: `project` must contain ['version'] properties
    ERROR: Failed to build 'file:///home/runner/work/FLAML/FLAML' when getting requirements to build editable
    

Relevant files observed at commit cbd5e48ecf18834689836309ae8a44ee1274d235:

  • .github/workflows/python-package.yml: install step upgrades pip wheel "setuptools<82", then runs pip install -e ., imports flaml, then runs pip install -e .[test].
  • pyproject.toml: contains [build-system] with requires = ["setuptools>=64", "wheel"] and build-backend = "setuptools.build_meta:__legacy__", plus tool config. The CI error indicates the current PR/job state has a [project] table that is invalid because it lacks a required version field.

Task:

  1. Inspect the packaging metadata (pyproject.toml, setup.py, package version source such as flaml/__init__.py, and any recent PR changes if available).
  2. Fix the editable install failure by making the project metadata valid for setuptools/PEP 621.
  3. Prefer a minimal, maintainable packaging fix that keeps the package version source consistent. If the project version is already defined in code or setup.py, use an appropriate PEP 621 dynamic = ["version"] / [tool.setuptools.dynamic] configuration or otherwise ensure [project] includes a valid version matching the existing package version strategy.
  4. Avoid masking the problem by only pinning dependencies unless that is truly the correct repository policy.
  5. Validate, where possible, that pip install -e . and pip install -e .[test] can resolve/build under the workflow’s Python/setuptools constraints.

Please open a pull request with the fix and include a concise explanation referencing the failing job and root cause.

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 . (editable install) because the build backend is trying to validate PEP 621 metadata and finds a [project] table without a required version field:

ValueError: invalid pyproject.toml config: project. configuration error: project must contain ['version'] properties

This happens while pip is “Getting requirements to build editable”, i.e., before tests run. The workflow step that triggers it is in .github/workflows/python-package.yml at the “Install packages and dependencies” step (the pip install -e . line).

Fix options (pick one)

Option A (recommended): Add version to [project] in pyproject.toml

If your repo now contains a [project] table (even implicitly via other changes), ensure it includes a valid version.

Patch (example):

# pyproject.toml
[project]
name = "flaml"
version = "2.3.0"  # set to the correct current version

If you already manage the version in setup.py, duplicate it here (or move fully to PEP 621 metadata to keep a single source of truth).

Option B: Use setuptools “dynamic version” (if you don’t want to hardcode)

If your version is defined in Python (e.g., flaml/__init__.py), you can declare it dynamically:

[project]
name = "flaml"
dynamic = ["version"]

[tool.setuptools.dynamic]
version = {attr = "flaml.__version__"}

This satisfies the validator while keeping version in code.

Option C: Stop setuptools from trying to validate PEP 621 by using a non-legacy backend

Right now pyproject.toml uses:

[build-system]
build-backend = "setuptools.build_meta:__legacy__"

If the repository has started relying on modern pyproject metadata, switch to the modern backend:

[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"

However, this doesn’t replace the need for valid metadata if you have a [project] table—so typically you still need Option A or B.

Why this fixes the CI

The workflow installs with editable mode (pip install -e .). pip/setuptools validate the pyproject.toml configuration early. Adding project.version (or making it dynamic) satisfies the required field and allows installation to proceed, unblocking the rest of the job (dependency install + pytest).

Minimal, safe change to unblock immediately

If you want the ...

This pull request was created from Copilot chat.

Copilot AI and others added 2 commits April 27, 2026 08:00
Copilot AI changed the title [WIP] Fix failing GitHub Actions job for package installation Fix editable install failure: migrate packaging metadata to PEP 621 (pyproject.toml) Apr 27, 2026
Copilot AI requested a review from thinkall April 27, 2026 08:05
@thinkall thinkall marked this pull request as ready for review April 27, 2026 08:44
@thinkall thinkall requested a review from Copilot April 27, 2026 08:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates FLAML’s packaging metadata to PEP 621 in pyproject.toml to fix pip install -e . failures caused by newer setuptools validating the presence of a compliant [project] table (including version via dynamic).

Changes:

  • Add a full [project] table in pyproject.toml, switch build backend to setuptools.build_meta, and source version dynamically from flaml/version.py.
  • Move package discovery and package-data configuration into pyproject.toml (including py.typed and default JSON assets).
  • Simplify setup.py to a minimal setuptools.setup() shim and add flaml/py.typed for PEP 561.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Adds PEP 621 metadata + dynamic version + setuptools package discovery/package-data to unblock editable installs.
setup.py Reduces setup script to a stub now that metadata is in pyproject.toml.
flaml/py.typed Adds PEP 561 marker file to ship typing information.

Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
thinkall and others added 2 commits April 27, 2026 19:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@thinkall thinkall merged commit 8af67d1 into main Apr 27, 2026
16 checks passed
@thinkall thinkall deleted the copilot/fix-github-actions-install-package branch April 27, 2026 13:46
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.

4 participants