You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Step 3: Specify Python version with `requires-python`
298
298
299
299
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
+
304
304
305
305
{emphasize-lines="22"}
306
306
```toml
@@ -344,8 +344,8 @@ dependencies are added in an array (similar to a Python list) structure.
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.
349
349
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!
350
350
351
351
[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:
359
359
dependencies = [ "numpy>=1.0" ]
360
360
```
361
361
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:
0 commit comments