11## pyproject.toml: project table
22
3+ <!-- [[[cog
4+ from cog_helpers import code_fence, render_cookie, TOMLMatcher
5+ with render_cookie(backend="uv") as package:
6+ pyproject = TOMLMatcher.from_file(package / "pyproject.toml")
7+ ]]] -->
8+ <!-- [[[end]]] -->
9+
310The metadata is specified in a [ standards-based] [ metadata ] format:
411
12+ <!-- [[[cog
13+ with code_fence("toml"):
14+ print(pyproject.get_source("project"))
15+ ]]] -->
16+ <!-- prettier-ignore-start -->
517``` toml
618[project ]
719name = " package"
820version = " 0.1.0"
21+ authors = [
22+ {
name =
" My Name" ,
email =
" [email protected] " },
23+ ]
924description = " A great package."
1025readme = " README.md"
1126license = " BSD-3-Clause"
1227license-files = [" LICENSE" ]
13- authors = [
14- {
name =
" My Name" ,
email =
" [email protected] " },
15- ]
16- maintainers = [
17- {
name =
" My Organization" ,
email =
" [email protected] " },
18- ]
1928requires-python = " >=3.10"
20-
21- dependencies = [
22- " typing_extensions" ,
23- ]
24-
2529classifiers = [
26- " Development Status :: 4 - Beta" ,
30+ " Development Status :: 1 - Planning" ,
31+ " Intended Audience :: Science/Research" ,
32+ " Intended Audience :: Developers" ,
33+ " Operating System :: OS Independent" ,
34+ " Programming Language :: Python" ,
35+ " Programming Language :: Python :: 3" ,
2736 " Programming Language :: Python :: 3 :: Only" ,
2837 " Programming Language :: Python :: 3.10" ,
2938 " Programming Language :: Python :: 3.11" ,
3039 " Programming Language :: Python :: 3.12" ,
3140 " Programming Language :: Python :: 3.13" ,
3241 " Programming Language :: Python :: 3.14" ,
33- " Topic :: Scientific/Engineering :: Physics" ,
42+ " Topic :: Scientific/Engineering" ,
43+ " Typing :: Typed" ,
3444]
45+ dependencies = []
3546
3647[project .urls ]
37- Homepage = " https://github.com/organization/package"
38- Documentation = " https://package.readthedocs.io/"
39- "Bug Tracker" = " https://github.com/organization/package/issues"
40- Discussions = " https://github.com/organization/package/discussions"
41- Changelog = " https://package.readthedocs.io/en/latest/changelog.html"
48+ Homepage = " https://github.com/org/package"
49+ "Bug Tracker" = " https://github.com/org/package/issues"
50+ Discussions = " https://github.com/org/package/discussions"
51+ Changelog = " https://github.com/org/package/releases"
4252```
53+ <!-- prettier-ignore-end -->
54+ <!-- [[[end]]] -->
4355
4456You can read more about each field, and all allowed fields, in
4557[ packaging.python.org] [ metadata ] ,
4658[ Flit] ( https://flit.readthedocs.io/en/latest/pyproject_toml.html#new-style-metadata )
47- or [ Whey] ( https://whey.readthedocs.io/en/latest/configuration.html ) . Note that
48- "Homepage" is special, and replaces the old url setting.
59+ or [ Whey] ( https://whey.readthedocs.io/en/latest/configuration.html ) . Only the
60+ ` name ` and ` version ` fields are strictly required. Note that "Homepage" is
61+ special, and replaces the old url setting.
62+
63+ If you use the above configuration, you need ` README.md ` and ` LICENSE ` files,
64+ since they are explicitly specified.
4965
5066### License
5167
@@ -55,15 +71,17 @@ The modern way is to use the `license` field and an [SPDX identifier
5571expression] [ spdx ] . You can specify a list of files globs in ` license-files ` . You
5672need ` hatchling>=1.26 ` , ` flit-core>=1.11 ` (1.12 for complex license statements),
5773` pdm-backend>=2.4 ` , ` setuptools>=77 ` , ` meson-python>=0.18 ` , ` maturin>=1.9.2 ` ,
58- ` poetry-core>=2.2 ` , or ` scikit-build-core>=0.12 ` to support this.
74+ ` poetry-core>=2.2 ` , or ` scikit-build-core>=0.12 ` to support this. You can also
75+ specify ` license-files ` as a list with globs for license files. If you don't,
76+ most backends will discover common license file names by default.
5977
6078The classic convention uses one or more [ Trove Classifiers] [ ] to specify the
6179license. There also was a ` license.file ` field, required by ` meson-python ` , but
6280other tools often did the wrong thing (such as load the entire file into the
6381metadata's free-form one line text field that was intended to describe
6482deviations from the classifier license(s)).
6583
66- ```
84+ ``` toml
6785classifiers = [
6886 " License :: OSI Approved :: BSD License" ,
6987]
@@ -122,15 +140,30 @@ your package); the `dev` group is even installed, by default, when using `uv`'s
122140high level commands like ` uv run ` and ` uv sync ` . {% rr PP0086 %} Here is an
123141example:
124142
143+ <!-- [[[cog
144+ with code_fence("toml"):
145+ print(pyproject.get_source("dependency-groups"))
146+ ]]] -->
147+ <!-- prettier-ignore-start -->
125148``` toml
126149[dependency-groups ]
127150test = [
128- " pytest >=6.0" ,
151+ " pytest >=6" ,
152+ " pytest-cov >=3" ,
129153]
130154dev = [
131155 { include-group = " test" },
132156]
157+ docs = [
158+ " sphinx>=7.0" ,
159+ " myst_parser>=0.13" ,
160+ " sphinx_copybutton" ,
161+ " sphinx_autodoc_typehints" ,
162+ " furo>=2023.08.17" ,
163+ ]
133164```
165+ <!-- prettier-ignore-end -->
166+ <!-- [[[end]]] -->
134167
135168You can include one dependency group in another. Most tools allow you to install
136169groups using ` --group ` , like ` pip ` (25.1+), ` uv pip ` , and the high level ` uv `
0 commit comments