Skip to content

Commit 972dbf2

Browse files
Apply suggestions from code review
thank you @willingc! Co-authored-by: Carol Willing <[email protected]>
1 parent 9ce4bc1 commit 972dbf2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tutorials/pyproject-toml.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ license = {file = "LICENSE"}
297297
### Step 3: Specify Python version with `requires-python`
298298

299299
Add the `requires-python` field to your `pyproject.toml` `[project]` table.
300-
The `requires-python` field, helps pip understand which versions of Python that you package supports when it's installed.
301-
It is thus a single value.
302-
`requires-python` supports the dependency specification syntax discussed in the next section - typically this will be
303-
a lower bound specifying the oldest version of python that can run your package, but you may also need to specify an upper bound in some more advanced cases.
300+
The `requires-python` field helps pip identify which Python versions that your package supports.
301+
It is set to a single value.
302+
The [packaging specification](https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata-requires-python) defines`requires-python` as a string that uses version specifiers. Most projects will specify the oldest Python version supported by the package. In some advanced cases, an upper bound is set to indicate which future Python versions, if any, will be supported.
303+
304304

305305
{emphasize-lines="22"}
306306
```toml
@@ -344,8 +344,8 @@ dependencies are added in an array (similar to a Python list) structure.
344344
dependencies = ["numpy", "requests", "pandas", "pydantic"]
345345
```
346346

347-
Dependencies can, and usually should come with a **version specifier.**
348-
A plain dependency says that your package can work with any version of that dependent package.
347+
A dependency can be limited to specific versions using a **version specifier.**
348+
If the dependency has no version specifier after the dependency name, your package can use any version of the dependent package.
349349
Code changes over time, bugs are fixed, APIs change, and so it's good to be clear about which version of the dependency you wrote your code to be compatible with - a package you wrote this year probably isn't compatible with numpy v0.0.1!
350350

351351
[Learn more about various ways to specify ranges of package versions here.](https://packaging.python.org/en/latest/specifications/version-specifiers/#id5)
@@ -359,7 +359,7 @@ Lower bounds look like this:
359359
dependencies = [ "numpy>=1.0" ]
360360
```
361361

362-
You can combine specifiers with commas, and use different kinds of specifiers for each package in your `dependencies` section:
362+
Commas are used to separate individual dependencies, and each package in your `dependencies` section can use different types of version specifiers:
363363

364364
```toml
365365
dependencies = [
@@ -401,7 +401,7 @@ dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
401401
```
402402

403403
:::{admonition} Pin dependencies with caution
404-
"Pinning" dependencies refers to specifying a specific version of a dependency like this:
404+
"Pinning" a dependency means setting it to a specific version, like this:
405405

406406
`numpy == 1.0`.
407407

0 commit comments

Comments
 (0)