Skip to content

Feature/issue 1333 pyproject modernize#1381

Open
rosspeili wants to merge 2 commits into
quantumlib:mainfrom
rosspeili:feature/issue-1333-pyproject-modernize
Open

Feature/issue 1333 pyproject modernize#1381
rosspeili wants to merge 2 commits into
quantumlib:mainfrom
rosspeili:feature/issue-1333-pyproject-modernize

Conversation

@rosspeili

@rosspeili rosspeili commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Moved project metadata from setup.py into pyproject.toml (PEP 621), modeled on qsim: [project] metadata, dynamic version/deps from dev_tools/requirements/deps/*.txt, resources optional extra, and a PEP 735 dev dependency group for uv sync --group dev. Removed setup.py, and updated MANIFEST.in and _version.py accordingly.

Tested with python -m build (sdist + wheel), pip install -e ., and full pytest (2196 passed; 6 Windows-only parallel-test failures also on main), also updated CONTRIBUTING.md to point at pyproject.toml as the canonical config and document the uv sync --group dev workflow.

Intentionally deferred:

  • Migrating .pylintrc / other dotfile tool configs into pyproject.toml
  • Adding a committed uv.lock (if we want that workflow?)
  • Changing CI to use uv sync instead of locked dev_tools/requirements/envs/*.txt (those files and create-env-files.sh are unchanged)

Closes #1333

)

Model packaging on qsim: PEP 621 [project] metadata, setuptools dynamic version and dependencies from requirement files, optional resources extra, and a PEP 735 dev dependency group for uv. Remove setup.py; keep locked CI env files via create-env-files.sh.
Add resource-estimate deps to dev group for uv parity. Document pyproject.toml and uv sync in CONTRIBUTING.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the project's build configuration and metadata from setup.py to pyproject.toml, updating documentation, packaging scripts, and manifest files accordingly. Feedback on the changes suggests correcting the license field format in pyproject.toml to comply with PEP 621 and restoring the missing Apache Software License classifier to maintain parity with the previous setup.

Comment thread pyproject.toml
name = "openfermion"
description = "The electronic structure package for quantum computers."
readme = {file = "README.md", content-type = "text/markdown"}
license = "Apache-2.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Under PEP 621, the license field must be a table containing either a text or file key (e.g., license = {text = "Apache-2.0"}). Providing a plain string is invalid under the PEP 621 specification and can cause validation errors with strict packaging tools.

license = {text = "Apache-2.0"}

Comment thread pyproject.toml
Comment on lines +45 to +60
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Quantum Computing",
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The classifier "License :: OSI Approved :: Apache Software License" is missing from the classifiers list. To maintain functional equivalence with the original setup.py configuration and ensure proper categorization on PyPI, please include it.

classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Intended Audience :: Education",
    "Intended Audience :: Science/Research",
    "License :: OSI Approved :: Apache Software License",
    "Operating System :: MacOS",
    "Operating System :: Microsoft :: Windows",
    "Operating System :: POSIX :: Linux",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Scientific/Engineering :: Chemistry",
    "Topic :: Scientific/Engineering :: Quantum Computing",
]
References
  1. When migrating configuration, keep the settings functionally equivalent to the original to maintain a clean change history.

@rosspeili

Copy link
Copy Markdown
Contributor Author

@mhucka keeping license = "Apache-2.0" (SPDX, PEP 639) per qsim. Adding the License trove classifier back causes setuptools to fail the build (License classifiers have been superseded by license expressions). Verified with python -m build. Should I ignore Gemini assist's recommendations?

@mhucka mhucka added the priority/after-1.7.2 Things to do after the next release label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/after-1.7.2 Things to do after the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move setup.py metadata and as many tool configurations into pyproject.toml as possible

2 participants