Skip to content

Commit

Permalink
docs: wip update docs to reflect PEP 621 more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
finswimmer committed Nov 26, 2024
1 parent f3deb4c commit 0a7c222
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions docs/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ authors = [
{name = "Sébastien Eustace", email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"

[tool.poetry]
packages = [{include = "poetry_demo"}]
Expand All @@ -57,11 +57,11 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
```

Poetry assumes your package contains a package with the same name as `tool.poetry.name` located in the root of your
Poetry assumes your package contains a package with the same name as `project.name` located in the root of your
project. If this is not the case, populate [`tool.poetry.packages`]({{< relref "pyproject#packages" >}}) to specify
your packages and their locations.

Similarly, the traditional `MANIFEST.in` file is replaced by the `tool.poetry.readme`, `tool.poetry.include`, and
Similarly, the traditional `MANIFEST.in` file is replaced by the `project.readme`, `tool.poetry.include`, and
`tool.poetry.exclude` sections. `tool.poetry.exclude` is additionally implicitly populated by your `.gitignore`. For
full documentation on the project format, see the [pyproject section]({{< relref "pyproject" >}}) of the documentation.

Expand All @@ -79,11 +79,11 @@ Again, it's important to remember that -- unlike other dependencies -- setting a
For example, in this `pyproject.toml` file:

```toml
[tool.poetry.dependencies]
python = "^3.7.0"
[project]
requires-python = ">=3.9"
```

we are allowing any version of Python 3 that is greater than `3.7.0`.
we are allowing any version of Python 3 that is greater than `3.9.0`.

When you run `poetry install`, you must have access to some version of a Python interpreter that satisfies this constraint available on your system.
Poetry will not install a Python interpreter for you.
Expand Down Expand Up @@ -122,11 +122,14 @@ In the [pyproject section]({{< relref "pyproject" >}}) you can see which fields
{{% /note %}}

### Specifying dependencies
See the [Dependency specification]({{< relref "dependency-specification" >}})
for detailed information.

{{< tabs tabTotal="2" tabID1="pep621-dependencies" tabID2="legacy-dependencies" tabName1="Default (PEP 621)" tabName2="Legacy">}}

{{< tab tabID="pep621-dependencies" >}}
If you want to add dependencies to your project, you can specify them in the
`project` or `tool.poetry.dependencies` section.
See the [Dependency specification]({{< relref "dependency-specification" >}})
for more information.
`project` section.

```toml
[project]
Expand All @@ -135,13 +138,18 @@ dependencies = [
"pendulum (>=2.1,<3.0)"
]
```
{{< /tab >}}

or
{{< tab tabID="legacy-dependencies" >}}
If you want to add dependencies to your project, you can specify them in the
`tool.poetry.dependencies` section.

```toml
[tool.poetry.dependencies]
pendulum = "^2.1"
```
{{< /tab >}}
{{< /tabs >}}

As you can see, it takes a mapping of **package names** and **version constraints**.

Expand Down

0 comments on commit 0a7c222

Please sign in to comment.