Skip to content

Commit 5d27795

Browse files
VladimirFokowchrysledi
authored
Update pyproject.toml (#204)
* Update pyproject.toml - extend descriptions of build-system table - add useful links - edit other comments * Update pyproject.toml - be more clear that the values in [build-system] may be generated by the command line interface of the build backend, so the [build-system] table is not required - reorganize comments to better correspond to their sections * add changes from #197 add the changes authored by thomasbbrunner in #197 * implement changes from code review - separate links to guide and specification - remove text that can already be found by following the provided links - more accurate comment about the `build-backend` key * minor: ":" * better comment about extras Co-authored-by: chrysle <[email protected]> * remove # Optional coments, because instead of them we'll mark the REQUIRED fields --------- Co-authored-by: chrysle <[email protected]> Co-authored-by: Dustin Ingram <[email protected]>
1 parent b1dfa48 commit 5d27795

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

pyproject.toml

+36-24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# Guide (user-friendly):
2+
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
3+
4+
# Specification (technical, formal):
5+
# https://packaging.python.org/en/latest/specifications/pyproject-toml/
6+
7+
8+
# Choosing a build backend:
9+
# https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend
10+
[build-system]
11+
# A list of packages that are needed to build your package:
12+
requires = ["setuptools"] # REQUIRED if [build-system] table is used
13+
# The name of the Python object that frontends will use to perform the build:
14+
build-backend = "setuptools.build_meta" # If not defined, then legacy behavior can happen.
15+
16+
117
[project]
218
# This is the name of your project. The first time you publish this
319
# package, this name will be registered for you. It will determine how
@@ -10,19 +26,19 @@
1026
# There are some restrictions on what makes a valid project name
1127
# specification here:
1228
# https://packaging.python.org/specifications/core-metadata/#name
13-
name = "sampleproject" # Required
29+
name = "sampleproject" # REQUIRED, is the only field that cannot be marked as dynamic.
1430

1531
# Versions should comply with PEP 440:
1632
# https://www.python.org/dev/peps/pep-0440/
1733
#
1834
# For a discussion on single-sourcing the version, see
1935
# https://packaging.python.org/guides/single-sourcing-package-version/
20-
version = "3.0.0" # Required
36+
version = "3.0.0" # REQUIRED, although can be dynamic
2137

2238
# This is a one-line description or tagline of what your project does. This
2339
# corresponds to the "Summary" metadata field:
2440
# https://packaging.python.org/specifications/core-metadata/#summary
25-
description = "A sample Python project" # Optional
41+
description = "A sample Python project"
2642

2743
# This is an optional longer description of your project that represents
2844
# the body of text which users will see when they visit PyPI.
@@ -32,45 +48,45 @@ description = "A sample Python project" # Optional
3248
#
3349
# This field corresponds to the "Description" metadata field:
3450
# https://packaging.python.org/specifications/core-metadata/#description-optional
35-
readme = "README.md" # Optional
51+
readme = "README.md"
3652

3753
# Specify which Python versions you support. In contrast to the
38-
# 'Programming Language' classifiers, 'pip install' will check this
54+
# 'Programming Language' classifiers in this file, 'pip install' will check this
3955
# and refuse to install the project if the version does not match. See
4056
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
41-
requires-python = ">=3.8" # Optional
57+
requires-python = ">=3.8"
4258

4359
# This is either text indicating the license for the distribution, or a file
4460
# that contains the license.
4561
# https://packaging.python.org/en/latest/specifications/core-metadata/#license
46-
license = {file = "LICENSE.txt"} # Optional
62+
license = {file = "LICENSE.txt"}
4763

4864
# This field adds keywords for your project which will appear on the
4965
# project page. What does your project relate to?
5066
#
5167
# Note that this is a list of additional keywords, separated
5268
# by commas, to be used to assist searching for the distribution in a
5369
# larger catalog.
54-
keywords = ["sample", "setuptools", "development"] # Optional
70+
keywords = ["sample", "setuptools", "development"]
5571

5672
# This should be your name or the name of the organization who originally
5773
# authored the project, and a valid email address corresponding to the name
5874
# listed.
5975
authors = [
60-
{name = "A. Random Developer", email = "[email protected]" } # Optional
76+
{name = "A. Random Developer", email = "[email protected]" }
6177
]
6278

6379
# This should be your name or the names of the organization who currently
6480
# maintains the project, and a valid email address corresponding to the name
6581
# listed.
6682
maintainers = [
67-
{name = "A. Great Maintainer", email = "[email protected]" } # Optional
83+
{name = "A. Great Maintainer", email = "[email protected]" }
6884
]
6985

7086
# Classifiers help users find your project by categorizing it.
7187
#
7288
# For a list of valid classifiers, see https://pypi.org/classifiers/
73-
classifiers = [ # Optional
89+
classifiers = [
7490
# How mature is this project? Common values are
7591
# 3 - Alpha
7692
# 4 - Beta
@@ -86,7 +102,7 @@ classifiers = [ # Optional
86102

87103
# Specify the Python versions you support here. In particular, ensure
88104
# that you indicate you support Python 3. These classifiers are *not*
89-
# checked by "pip install". See instead "requires-python".
105+
# checked by "pip install". See instead "requires-python" key in this file.
90106
"Programming Language :: Python :: 3",
91107
"Programming Language :: Python :: 3.8",
92108
"Programming Language :: Python :: 3.9",
@@ -102,7 +118,7 @@ classifiers = [ # Optional
102118
#
103119
# For an analysis of this field vs pip's requirements files see:
104120
# https://packaging.python.org/discussions/install-requires-vs-requirements/
105-
dependencies = [ # Optional
121+
dependencies = [
106122
"peppercorn"
107123
]
108124

@@ -112,9 +128,10 @@ dependencies = [ # Optional
112128
#
113129
# $ pip install sampleproject[dev]
114130
#
115-
# Similar to `dependencies` above, these must be valid existing
116-
# projects.
117-
[project.optional-dependencies] # Optional
131+
# Optional dependencies the project provides. These are commonly
132+
# referred to as "extras". For a more extensive definition see:
133+
# https://packaging.python.org/en/latest/specifications/dependency-specifiers/#extras
134+
[project.optional-dependencies]
118135
dev = ["check-manifest"]
119136
test = ["coverage"]
120137

@@ -128,7 +145,7 @@ test = ["coverage"]
128145
# issues, where the source is hosted, where to say thanks to the package
129146
# maintainers, and where to support the project financially. The key is
130147
# what's used to render the link text on PyPI.
131-
[project.urls] # Optional
148+
[project.urls]
132149
"Homepage" = "https://github.com/pypa/sampleproject"
133150
"Bug Reports" = "https://github.com/pypa/sampleproject/issues"
134151
"Funding" = "https://donate.pypi.org"
@@ -137,18 +154,13 @@ test = ["coverage"]
137154

138155
# The following would provide a command line executable called `sample`
139156
# which executes the function `main` from this package when invoked.
140-
[project.scripts] # Optional
157+
[project.scripts]
141158
sample = "sample:main"
142159

160+
143161
# This is configuration specific to the `setuptools` build backend.
144162
# If you are using a different build backend, you will need to change this.
145163
[tool.setuptools]
146164
# If there are data files included in your packages that need to be
147165
# installed, specify them here.
148166
package-data = {"sample" = ["*.dat"]}
149-
150-
[build-system]
151-
# These are the assumed default build requirements from pip:
152-
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
153-
requires = ["setuptools>=43.0.0", "wheel"]
154-
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)