Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions docs/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -622,43 +622,53 @@ Poetry is clever enough to detect Python subpackages.
Thus, you only have to specify the directory where your root package resides.
{{% /note %}}

### include and exclude
### exclude and include
Comment thread
Secrus marked this conversation as resolved.

A list of patterns that will be included in the final package.
{{% note %}}
If you just want to include a package or module, which is not picked up automatically,
use [packages]({{< relref "#packages" >}}) instead of `include`.
{{% /note %}}

A list of patterns that will be excluded or included in the final package.

```toml
[tool.poetry]
# ...
exclude = ["my_package/excluded.py"]
include = ["CHANGELOG.md"]
```

You can explicitly specify to Poetry that a set of globs should be ignored or included for the purposes of packaging.
The globs specified in the exclude field identify a set of files that are not included when a package is built.
`include` has priority over `exclude`.

If a VCS is being used for a package, the exclude field will be seeded with the VCS’ ignore settings (`.gitignore` for git for example).

{{% note %}}
Explicitly declaring entries in `include` will negate VCS' ignore settings.
{{% /note %}}

```toml
[tool.poetry]
# ...
include = ["CHANGELOG.md"]
```

You can also specify the formats for which these patterns have to be included, as shown here:

```toml
[tool.poetry]
# ...
include = [
{ path = "tests", format = "sdist" },
{ path = "for_wheel.txt", format = ["sdist", "wheel"] }
{ path = "my_package/for_sdist_and_wheel.txt", format = ["sdist", "wheel"] }
]
```

If no format is specified, `include` defaults to only `sdist`.

In contrast, `exclude` defaults to both `sdist` and `wheel`.

```toml
exclude = ["my_package/excluded.py"]
```
{{% warning %}}
When a wheel is installed, its includes are unpacked straight into the `site-packages` directory.
Pay attention to include top level files and directories with common names like
`CHANGELOG.md`, `LICENSE`, `tests` or `docs` only in sdists and **not** in wheels.
{{% /warning %}}


### dependencies and dependency groups

Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.