77[ ![ PyPI version] [ pypi-version ]] [ pypi-link ]
88[ ![ PyPI platforms] [ pypi-platforms ]] [ pypi-link ]
99
10- A cookiecutter template for new Python projects based on the Scientific Python
11- Developer Guide. What makes this different from other cookie cutter templates
12- for Python packages?
10+ A [ copier ] [ ] / [ cookiecutter] [ ] template for new Python projects based on the
11+ Scientific Python Developer Guide. What makes this different from other
12+ templates for Python packages?
1313
1414- Lives with the [ Scientific-Python Development Guide] [ ] : Every decision is
15- clearly documented and every tool described.
15+ clearly documented and every tool described, and everything is kept in sync .
1616- Twelve different backends to choose from for building packages.
1717- Template generation tested in GitHub Actions using nox.
18- - Includes several compiled backends using pybind11, with wheels produced for
19- all platforms using cibuildwheel.
20- - Follows PyPA best practices and regularly updated .
18+ - Supports generation with both [ copier ] [ ] and [ cookiecutter ] [ ] .
19+ - Includes several compiled backends using [ pybind11 ] [ ] , with wheels produced
20+ for all platforms using [ cibuildwheel ] [ ] .
2121- Provides [ ` sp-repo-review ` ] [ pypi-link ] to evaluate existing repos against the
2222 guidelines, with a WebAssembly version integrated with the guide. All checks
2323 cross-linked.
24+ - Follows PyPA best practices and regularly updated.
2425
2526Be sure you have read the [ Scientific-Python Development Guide] [ ] first, and
2627possibly used them on a project or two. This is _ not_ a minimal example or
@@ -33,36 +34,62 @@ During generation you can select from the following backends for your package:
33341 . [ hatch] [ ] : This uses hatchling, a modern builder with nice file inclusion,
3435 extendable via plugins, and good error messages. ** (Recommended for pure
3536 Python projects)**
36- 2 . [ setuptools] [ ] : The classic build system. Most powerful, but high learning
37- curve and lots of configuration required.
38- 3 . [ setuptools621] [ setuptools ] : The classic build system, but with the new
39- standardized configuration. Python 3.7+.
40- 4 . [ pybind11] [ ] : This is setuptools but with an C++ extension written in
41- [ pybind11] [ ] and wheels generated by [ cibuildwheel] [ ] .
42- 5 . [ scikit-build] [ ] : A scikit-build (CMake) project also using pybind11, using
43- scikit-build-core. ** (Recommended for C++ projects)**
44- 6 . [ meson-python] [ ] : A Meson project also using pybind11.
45- 7 . [ poetry] [ ] : An all-in-one solution to pure Python projects. Replaces
46- setuptools, venv/pipenv, pip, wheel, and twine. Higher learning curve, but is
47- all-in-one. Makes some bad default assumptions for libraries.
48- 8 . [ flit] [ ] : A modern, lightweight [ PEP 621] [ ] build system for pure Python
37+ 2 . [ flit] [ ] : A modern, lightweight [ PEP 621] [ ] build system for pure Python
4938 projects. Replaces setuptools, no MANIFEST.in, setup.py, or setup.cfg. Low
5039 learning curve. Easy to bootstrap into new distributions. Difficult to get
5140 the right files included, little dynamic metadata support.
52- 9 . [ pdm] [ ] : A modern, less opinionated all-in-one solution to pure Python
41+ 3 . [ pdm] [ ] : A modern, less opinionated all-in-one solution to pure Python
5342 projects supporting standards. Replaces setuptools, venv/pipenv, pip, wheel,
5443 and twine. Supports [ PEP 621] [ ] .
55- 10 . [ trampolim] [ ] : A modern [ PEP 621] [ ] builder with support for tasks, allowing
56- arbitrary Python to run during the build process if needed.
57- 11 . [ whey] [ ] : A modern [ PEP 621] [ ] builder with some automation options for
58- Trove classifiers. Development seems to be stalled, possibly.
44+ 4 . [ trampolim] [ ] : A modern [ PEP 621] [ ] builder with support for tasks, allowing
45+ arbitrary Python to run during the build process if needed.
46+ 5 . [ whey] [ ] : A modern [ PEP 621] [ ] builder with some automation options for Trove
47+ classifiers. Development seems to be stalled, possibly.
48+ 6 . [ poetry] [ ] : An all-in-one solution to pure Python projects. Replaces
49+ setuptools, venv/pipenv, pip, wheel, and twine. Higher learning curve, but is
50+ all-in-one. Makes some bad default assumptions for libraries. The only one
51+ with a non-standard pyproject.toml config.
52+ 7 . [ setuptools621] [ setuptools ] : The classic build system, but with the new
53+ standardized configuration. Python 3.7+.
54+ 8 . [ setuptools] [ ] : The classic build system. Most powerful, but high learning
55+ curve and lots of configuration required.
56+ 9 . [ pybind11] [ ] : This is setuptools but with an C++ extension written in
57+ [ pybind11] [ ] and wheels generated by [ cibuildwheel] [ ] .
58+ 10 . [ scikit-build] [ ] : A scikit-build (CMake) project also using pybind11, using
59+ scikit-build-core. ** (Recommended for C++ projects)**
60+ 11 . [ meson-python] [ ] : A Meson project also using pybind11.
596112 . [ maturin] [ ] : A [ PEP 621] [ ] builder for Rust binary extensions.
6062 ** (Recommended for Rust projects)**
6163
6264Currently, the best choice is probably hatch for pure Python projects, and
6365setuptools (such as the pybind11 choice) for binary projects.
6466
65- #### To use:
67+ #### To use (modern copier version)
68+
69+ Install ` copier ` and ` copier-templates-extensions ` . Using [ pipx] [ ] , that's:
70+
71+ ``` bash
72+ pipx install copier
73+ pipx inject copier copier-templates-extensions
74+ ```
75+
76+ Now, run copier to generate your project:
77+
78+ ``` bash
79+ copier copy gh:scientific-python/cookie < pkg> --UNSAFE --vcs-ref=HEAD
80+ ```
81+
82+ (` <pkg> ` is the path to put the new project.)
83+
84+ You will get a much, much nicer CLI experience with helpful descriptions and
85+ answer validation. You will also get a ` .copier-answers.yml ` file, which will
86+ allow you to perform updates in the future.
87+
88+ > Note: Add ` --vcs-ref=HEAD ` to get the latest version instead of the last
89+ > tagged version; this is required until there's a tagged version, and still
90+ > recommended after that.
91+
92+ #### To use (classic cookiecutter version)
6693
6794Install cookiecutter, ideally with ` brew install cookiecutter ` if you use brew,
6895otherwise with ` pipx install cookiecutter ` (or prepend ` pipx run ` to the command
@@ -72,8 +99,6 @@ below, and skip installation). Then run:
7299cookiecutter gh:scientific-python/cookie
73100```
74101
75- You can also use ` pipx run cookiecutter ` without installing.
76-
77102Check the key setup files, ` pyproject.toml ` , and possibly ` setup.cfg ` and
78103` setup.py ` (pybind11 example). Update README.md. Also update and add docs to
79104` docs/ ` .
@@ -125,9 +150,6 @@ You can test locally with [nox][]:
125150# See all commands
126151nox -l
127152
128- # Run all tests and checks (takes several minutes)
129- nox
130-
131153# Run a specific check
132154nox -s "lint(setuptools)"
133155
@@ -160,7 +182,9 @@ NSLS-II guide during the 2023 Scientific-Python Developers Summit.
160182
161183[ actions-badge ] : https://github.com/scikit-hep/cookie/workflows/CI/badge.svg
162184[ actions-link ] : https://github.com/scikit-hep/cookie/actions
163- [ cibuildwheel ] : https://cibuildwheel.readthedocs.io/en/stable/
185+ [ cibuildwheel ] : https://cibuildwheel.readthedocs.io
186+ [ cookiecutter ] : https://cookiecutter.readthedocs.io
187+ [ copier ] : https://copier.readthedocs.io
164188[ flit ] : https://flit.readthedocs.io/en/latest/
165189[ github-discussions-badge ] : https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
166190[ github-discussions-link ] : https://github.com/scikit-hep/cookie/discussions
@@ -173,16 +197,16 @@ NSLS-II guide during the 2023 Scientific-Python Developers Summit.
173197[ pep 621 ] : https://www.python.org/dev/peps/pep-0621
174198[ pipx ] : https://pypa.github.io/pipx/
175199[ poetry ] : https://python-poetry.org
176- [ pybind11 ] : https://pybind11.readthedocs.io/en/stable/
200+ [ pybind11 ] : https://pybind11.readthedocs.io
177201[ pypi-link ] : https://pypi.org/project/sp-repo-review/
178202[ pypi-platforms ] : https://img.shields.io/pypi/pyversions/sp-repo-review
179203[ pypi-version ] : https://badge.fury.io/py/sp-repo-review.svg
180204[ rtd-badge ] : https://readthedocs.org/projects/scientific-python-cookie/badge/?version=latest
181205[ rtd-link ] : https://scientific-python-cookie.readthedocs.io/en/latest/?badge=latest
182206[ scientific-python development guide ] : https://learn.scientific-python.org/development
183- [ scikit-build ] : https://scikit-build.readthedocs.io/en/latest/
184- [ setuptools ] : https://setuptools.readthedocs.io/en/latest/
185- [ trampolim ] : https://trampolim.readthedocs.io/en/latest/
186- [ whey ] : https://whey.readthedocs.io/en/latest/
207+ [ scikit-build ] : https://scikit-build.readthedocs.io
208+ [ setuptools ] : https://setuptools.readthedocs.io
209+ [ trampolim ] : https://trampolim.readthedocs.io
210+ [ whey ] : https://whey.readthedocs.io
187211
188212<!-- prettier-ignore-end -->
0 commit comments