diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac4662e8..dceda902 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,9 @@ jobs: - name: Lint hatch run: pipx run nox --forcecolor -s 'lint(hatch)' + - name: Lint setuptools PEP 621 + run: pipx run nox --forcecolor -s 'lint(setuptools621)' + checks: name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} @@ -93,6 +96,9 @@ jobs: - name: Test hatch run: nox --forcecolor -s 'tests(hatch)' + - name: Test setuptools PEP 621 + run: nox --forcecolor -s 'tests(setuptools621)' + - name: Native poetry tooling run: nox --forcecolor -s 'native(poetry)' @@ -153,6 +159,11 @@ jobs: pipx run nox --forcecolor -s 'nox(hatch)' pipx run nox --forcecolor -s 'nox(hatch)' -- docs + - name: Test setuptools PEP 621 + run: | + pipx run nox --forcecolor -s 'nox(setuptools621)' + pipx run nox --forcecolor -s 'nox(setuptools621)' -- docs + dist: name: Distribution build diff --git a/README.md b/README.md index c09dc83d..1514ab03 100644 --- a/README.md +++ b/README.md @@ -30,26 +30,28 @@ During generation you can select from the following backends for your package: 1. [setuptools][]: The classic build system. Most powerful, but high learning curve and lots of configuration required. -2. [pybind11][]: This is setuptools but with an C++ extension written in [pybind11][] +2. [setuptools621][setuptools]: The classic build system, but with the new standardized + configuration. EXPERIMENTAL. +3. [pybind11][]: This is setuptools but with an C++ extension written in [pybind11][] and wheels generated by [cibuildwheel][]. -3. [poetry][]: An all-in-one solution to pure Python projects. Replaces +4. [poetry][]: An all-in-one solution to pure Python projects. Replaces setuptools, venv/pipenv, pip, wheel, and twine. Higher learning curve, but is all-in-one. Makes some bad default assumptions for libraries. -4. [flit][]: A modern, lightweight [PEP 621][] build system for pure Python +5. [flit][]: A modern, lightweight [PEP 621][] build system for pure Python projects. Replaces setuptools, no MANIFEST.in, setup.py, or setup.cfg. Low learning curve. Easy to bootstrap into new distributions. 5. [pdm][]: A modern, less opinionated all-in-one solution to pure Python projects supporting standards. Replaces setuptools, venv/pipenv, pip, wheel, and twine. Supports [PEP 621][], and also the unaccepted [PEP 582][]. -6. [trampolim][]: A modern [PEP 621][] builder with support for tasks, allowing +7. [trampolim][]: A modern [PEP 621][] builder with support for tasks, allowing arbitrary Python to run during the build process if needed. -7. [whey][]: A modern [PEP 621][] builder with some automation options for Trove +8. [whey][]: A modern [PEP 621][] builder with some automation options for Trove classifiers. Development seems to be stalled, possibly. -8. [maturin][]: A [PEP 621][] builder for Rust binary extensions. -9. [hatch][]: A package manager similar to Poetry/PDM. Hatchling (the backend) is +9. [maturin][]: A [PEP 621][] builder for Rust binary extensions. +10. [hatch][]: A package manager similar to Poetry/PDM. Hatchling (the backend) is a modern builder with nice error messages. -Currently, the best choices are probalby flit, PDM, or hatch for pure python projects, +Currently, the best choices are probably flit, PDM, or hatch for pure python projects, and setuptools (such as the pybind11 choice) for binary projects. #### To use: diff --git a/cookiecutter.json b/cookiecutter.json index d003cf03..98e522d2 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -3,7 +3,7 @@ "org": "Scikit-HEP", "url": "https://github.com/{{ cookiecutter.org }}/{{ cookiecutter.project_name }}", "full_name": "My Name", - "project_type": ["setuptools", "pybind11", "poetry", "flit", "pdm", "trampolim", "whey", "maturin", "hatch"], + "project_type": ["setuptools", "pybind11", "poetry", "flit", "pdm", "trampolim", "whey", "maturin", "hatch", "setuptools621"], "email": "me@email.com", "maintainer": "The Scikit-HEP admins", "maintainer_email": "scikit-hep-admins@googlegroups.com", diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index a48627e0..e46133a1 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -2,7 +2,7 @@ project_name = "{{ cookiecutter.project_name }}" project_type = "{{ cookiecutter.project_type }}" -project_types = {"setuptools", "pybind11", "poetry", "flit", "trampolim", "whey", "pdm", "maturin", "hatch"} +project_types = {"setuptools", "pybind11", "poetry", "flit", "trampolim", "whey", "pdm", "maturin", "hatch", "setuptools621"} other_project_types = project_types - {project_type} project_underscore_name = project_name.replace("-", "_") diff --git a/{{cookiecutter.project_name}}/pyproject^setuptools,pybind11,poetry.toml b/{{cookiecutter.project_name}}/pyproject^setuptools,pybind11,poetry.toml index 716ff1cc..00c7136d 100644 --- a/{{cookiecutter.project_name}}/pyproject^setuptools,pybind11,poetry.toml +++ b/{{cookiecutter.project_name}}/pyproject^setuptools,pybind11,poetry.toml @@ -14,6 +14,9 @@ build-backend = "maturin" {%- elif cookiecutter.project_type == "hatch" %} requires = ["hatchling>=0.7"] build-backend = "hatchling.build" +{%- elif cookiecutter.project_type == "setuptools621" %} +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" {%- else %} requires = ["flit_core >=3.4"] build-backend = "flit_core.buildapi" @@ -80,7 +83,7 @@ dev = [ "pytest >=6", ] docs = [ - "Sphinx~=3.0", + "Sphinx>=4.0", "myst_parser>=0.13", "sphinx-book-theme>=0.1.0", "sphinx_copybutton",