1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983
|
---
title: "The pyproject.toml file"
draft: false
type: docs
layout: single
menu:
docs:
weight: 90
---
# The `pyproject.toml` file
In package mode, the only required fields are `name` and `version`
(either in the `project` section or in the `tool.poetry` section).
Other fields are optional.
In non-package mode, the `name` and `version` fields are required
if using the `project` section.
{{% note %}}
Run `poetry check` to print warnings about deprecated fields.
{{% /note %}}
## The `project` section
The `project` section of the `pyproject.toml` file according to the
[specification of the PyPA](https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table).
### name
The name of the package. **Always required when the `project` section is specified**
This should be a valid name as defined by [PEP 508](https://peps.python.org/pep-0508/#names).
```toml
name = "my-package"
```
### version
The version of the package. **Always required when the `project` section is specified**
This should be a valid [PEP 440](https://peps.python.org/pep-0440/) string.
```toml
version = "0.1.0"
```
If you want to set the version dynamically via `poetry build --local-version`
or you are using a plugin, which sets the version dynamically, you should add `version`
to dynamic and define the base version in the `tool.poetry` section, for example:
```toml
[project]
name = "my-package"
dynamic = [ "version" ]
[tool.poetry]
version = "1.0" # base version
```
### description
A short description of the package.
```toml
description = "A short description of the package."
```
### license
An [SPDX expression](https://packaging.python.org/en/latest/glossary/#term-License-Expression)
representing the license of the package.
The recommended notation for the most common licenses is (alphabetical):
* Apache-2.0
* BSD-2-Clause
* BSD-3-Clause
* BSD-4-Clause
* GPL-2.0-only
* GPL-2.0-or-later
* GPL-3.0-only
* GPL-3.0-or-later
* LGPL-2.1-only
* LGPL-2.1-or-later
* LGPL-3.0-only
* LGPL-3.0-or-later
* MIT
Optional, but it is highly recommended to supply this.
More identifiers are listed at the [SPDX Open Source License Registry](https://spdx.org/licenses/).
```toml
license = "MIT"
```
{{% warning %}}
Specifying license as a table, e.g. `{ text = "MIT" }` is deprecated.
If you used to specify a license file, e.g. `{ file = "LICENSE" }`,
use `license-files` instead.
{{% /warning %}}
### license-files
A list of glob patterns that match the license files of the package
relative to the root of the project source tree.
```toml
[project]
# ...
license-files = [
"*-LICENSE",
"CONTRIBUTORS",
"MY-SPECIAL-LICENSE-DIR/**/*"
]
```
By default, Poetry will include the following files:
- `LICENSE*`
- `LICENCE*`
- `COPYING*`
- `AUTHORS*`
- `NOTICE*`
- `LICENSES/**/*`
{{% note %}}
The default applies only if the `license-files` field is not specified.
Specifying an empty list results in no license files being included.
{{% /note %}}
### readme
A path to the README file or the content.
```toml
readme = "README.md"
```
{{% note %}}
If you want to define multiple README files, you have to add `readme` to `dynamic`
and define them in the `tool.poetry` section.
{{% /note %}}
```toml
[project]
# ...
dynamic = [ "readme" ]
[tool.poetry]
# ...
readme = ["docs/README1.md", "docs/README2.md"]
```
### requires-python
The Python version requirements of the project.
```toml
requires-python = ">=3.8"
```
{{% note %}}
If you need an upper bound for locking, but do not want to define an upper bound
in your package metadata, you can omit the upper bound in the `requires-python` field
and add it in the `tool.poetry.dependencies` section.
{{% /note %}}
```toml
[project]
# ...
requires-python = ">=3.8"
[tool.poetry.dependencies]
python = ">=3.8,<4.0"
```
### authors
The authors of the package.
This is a list of authors and should contain at least one author.
```toml
authors = [
{ name = "Sébastien Eustace", email = "sebastien@eustace.io" },
]
```
### maintainers
The maintainers of the package.
This is a list of maintainers and should be distinct from authors.
```toml
maintainers = [
{ name = "John Smith", email = "johnsmith@example.org" },
{ name = "Jane Smith", email = "janesmith@example.org" },
]
```
### keywords
A list of keywords that the package is related to.
```toml
keywords = [ "packaging", "poetry" ]
```
### classifiers
A list of PyPI [trove classifiers](https://pypi.org/classifiers/) that describe the project.
```toml
classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
]
```
{{% warning %}}
Note that suitable classifiers based on your `python` requirement
are **not** automatically added for you if you define classifiers statically
in the `project` section.
If you want to enrich classifiers automatically, you should add `classifiers` to `dynamic`
and use the `tool.poetry` section instead.
{{% /warning %}}
```toml
[project]
# ...
dynamic = [ "classifiers" ]
[tool.poetry]
# ...
classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
]
```
### urls
The URLs of the project.
```toml
[project.urls]
homepage = "https://python-poetry.org/"
repository = "https://github.com/python-poetry/poetry"
documentation = "https://python-poetry.org/docs/"
"Bug Tracker" = "https://github.com/python-poetry/poetry/issues"
```
If you publish your package on PyPI, they will appear in the `Project Links` section.
### scripts
This section describes the console scripts that will be installed when installing the package.
```toml
[project.scripts]
my_package_cli = 'my_package.console:run'
```
Here, we will have the `my_package_cli` script installed which will execute the `run` function in the `console` module in the `my_package` package.
{{% note %}}
When a script is added or updated, run `poetry install` to make them available in the project's virtualenv.
{{% /note %}}
{{% note %}}
To include a file as a script, use [`tool.poetry.scripts`]({{< relref "#scripts-1" >}}) instead.
{{% /note %}}
### gui-scripts
This section describes the GUI scripts that will be installed when installing the package.
```toml
[project.gui-scripts]
my_package_gui = 'my_package.gui:run'
```
Here, we will have the `my_package_gui` script installed which will execute the `run` function in the `gui` module in the `my_package` package.
{{% note %}}
When a script is added or updated, run `poetry install` to make them available in the project's virtualenv.
{{% /note %}}
### entry-points
Entry points can be used to define plugins for your package.
Poetry supports arbitrary plugins, which are exposed as the ecosystem-standard
[entry points](https://packaging.python.org/en/latest/specifications/entry-points/)
and discoverable using `importlib.metadata`.
This is similar to (and compatible with) the entry points feature of `setuptools`.
The syntax for registering a plugin is:
```toml
[project.entry-points] # Optional super table
[project.entry-points."A"]
B = "C:D"
```
Which are:
- `A` - type of the plugin, for example `poetry.plugin` or `flake8.extension`
- `B` - name of the plugin
- `C` - python module import path
- `D` - the entry point of the plugin (a function or class)
Example (from [`poetry-plugin-export`](http://github.com/python-poetry/poetry-plugin-export)):
```toml
[project.entry-points."poetry.application.plugin"]
export = "poetry_plugin_export.plugins:ExportApplicationPlugin"
```
### dependencies
The `dependencies` of the project.
```toml
dependencies = [
"requests>=2.13.0",
]
```
These are the dependencies that will be declared when building an sdist or a wheel.
See [Dependency specification]({{< relref "dependency-specification" >}}) for more information
about the relation between `project.dependencies` and `tool.poetry.dependencies`.
### optional-dependencies
The optional dependencies of the project (also known as extras).
```toml
[project.optional-dependencies]
mysql = [ "mysqlclient>=1.3,<2.0" ]
pgsql = [ "psycopg2>=2.9,<3.0" ]
databases = [ "mysqlclient>=1.3,<2.0", "psycopg2>=2.9,<3.0" ]
```
{{% note %}}
You can enrich optional dependencies for locking in the `tool.poetry` section
analogous to `dependencies`.
{{% /note %}}
## The `tool.poetry` section
The `tool.poetry` section of the `pyproject.toml` file is composed of multiple sections.
### package-mode
Whether Poetry operates in package mode (default) or not.
See [basic usage]({{< relref "basic-usage#operating-modes" >}}) for more information.
```toml
package-mode = false
```
### name
**Deprecated**: Use `project.name` instead.
The name of the package. **Required in package mode if not defined in the project section**
This should be a valid name as defined by [PEP 508](https://peps.python.org/pep-0508/#names).
```toml
name = "my-package"
```
### version
{{% note %}}
If you do not want to set the version dynamically via `poetry build --local-version`
and you are not using a plugin, which sets the version dynamically,
prefer `project.version` over this setting.
{{% /note %}}
The version of the package. **Required in package mode if not defined in the project section**
This should be a valid [PEP 440](https://peps.python.org/pep-0440/) string.
```toml
version = "0.1.0"
```
{{% note %}}
If you would like to use semantic versioning for your project, please see
[here]({{< relref "libraries#versioning" >}}).
{{% /note %}}
### description
**Deprecated**: Use `project.description` instead.
A short description of the package.
```toml
description = "A short description of the package."
```
### license
**Deprecated**: Use `project.license` instead.
The license of the package.
The recommended notation for the most common licenses is (alphabetical):
* Apache-2.0
* BSD-2-Clause
* BSD-3-Clause
* BSD-4-Clause
* GPL-2.0-only
* GPL-2.0-or-later
* GPL-3.0-only
* GPL-3.0-or-later
* LGPL-2.1-only
* LGPL-2.1-or-later
* LGPL-3.0-only
* LGPL-3.0-or-later
* MIT
Optional, but it is highly recommended to supply this.
More identifiers are listed at the [SPDX Open Source License Registry](https://spdx.org/licenses/).
```toml
license = "MIT"
```
### authors
**Deprecated**: Use `project.authors` instead.
The authors of the package.
This is a list of authors and should contain at least one author. Authors must be in the form `name <email>`.
```toml
authors = [
"Sébastien Eustace <sebastien@eustace.io>",
]
```
### maintainers
**Deprecated**: Use `project.maintainers` instead.
The maintainers of the package.
This is a list of maintainers and should be distinct from authors. Maintainers may contain an email and be in the form `name <email>`.
```toml
maintainers = [
"John Smith <johnsmith@example.org>",
"Jane Smith <janesmith@example.org>",
]
```
### readme
{{% note %}}
If you do not want to set multiple README files, prefer `project.readme` over this setting.
{{% /note %}}
A path, or list of paths corresponding to the README file(s) of the package.
The file(s) can be of any format, but if you intend to publish to PyPI keep the
[recommendations for a PyPI-friendly README](
https://packaging.python.org/en/latest/guides/making-a-pypi-friendly-readme/) in
mind. README paths are implicitly relative to `pyproject.toml`.
{{% note %}}
Whether paths are case-sensitive follows platform defaults, but it is recommended to keep cases.
To be specific, you can set `readme = "rEaDmE.mD"` for `README.md` on macOS and Windows, but Linux users can't `poetry install` after cloning your repo. This is because macOS and Windows are case-insensitive and case-preserving.
{{% /note %}}
The contents of the README file(s) are used to populate the [Description
field](https://packaging.python.org/en/latest/specifications/core-metadata/#description-optional)
of your distribution's metadata (similar to `long_description` in setuptools).
When multiple files are specified they are concatenated with newlines.
```toml
[tool.poetry]
# ...
readme = "README.md"
```
```toml
[tool.poetry]
# ...
readme = ["docs/README1.md", "docs/README2.md"]
```
### homepage
**Deprecated**: Use `project.urls` instead.
An URL to the website of the project.
```toml
homepage = "https://python-poetry.org/"
```
### repository
**Deprecated**: Use `project.urls` instead.
An URL to the repository of the project.
```toml
repository = "https://github.com/python-poetry/poetry"
```
### documentation
**Deprecated**: Use `project.urls` instead.
An URL to the documentation of the project.
```toml
documentation = "https://python-poetry.org/docs/"
```
### keywords
**Deprecated**: Use `project.keywords` instead.
A list of keywords that the package is related to.
```toml
keywords = ["packaging", "poetry"]
```
### classifiers
A list of PyPI [trove classifiers](https://pypi.org/classifiers/) that describe the project.
```toml
[tool.poetry]
# ...
classifiers = [
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules"
]
```
{{% note %}}
Note that Python classifiers are automatically added for you
and are determined by your `python` requirement.
If you do not want Poetry to automatically add suitable classifiers
based on the `python` requirement, use `project.classifiers` instead of this setting.
{{% /note %}}
### packages
A list of packages and modules to include in the final distribution.
If packages are not automatically detected, you can specify the packages you want
to include in the final distribution.
{{% note %}}
Poetry automatically detects a single **module** or **package** whose name matches the
[normalized](https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization)
project name with `-` replaced with `_`.
The detected module or package must be located either:
- at the same level as the `pyproject.toml` file (flat layout), or
- inside a `src/` directory (src layout).
{{% /note %}}
```toml
[tool.poetry]
# ...
packages = [
{ include = "my_package" },
{ include = "extra_package/**/*.py" },
]
```
If your package is stored inside a "lib" directory, you must specify it:
```toml
[tool.poetry]
# ...
packages = [
{ include = "my_package", from = "lib" },
]
```
The `to` parameter is designed to specify the relative destination path
where the package will be located upon installation. This allows for
greater control over the organization of packages within your project's structure.
```toml
[tool.poetry]
# ...
packages = [
{ include = "my_package", from = "lib", to = "target_package" },
]
```
If you want to restrict a package to a specific build format, you can specify
it by using `format`:
```toml
[tool.poetry]
# ...
packages = [
{ include = "my_package" },
{ include = "my_other_package", format = "sdist" },
]
```
From now on, only the `sdist` build archive will include the `my_other_package` package.
{{% note %}}
Using `packages` disables the package auto-detection feature meaning you have to
**explicitly** specify the "default" package.
For instance, if you have a package named `my_package` and you want to also include
another package named `extra_package`, you will need to specify `my_package` explicitly:
```toml
packages = [
{ include = "my_package" },
{ include = "extra_package" },
]
```
{{% /note %}}
{{% note %}}
Poetry is clever enough to detect Python subpackages.
Thus, you only have to specify the directory where your root package resides.
{{% /note %}}
### exclude and include
{{% 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`.
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 = "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`.
{{% 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 %}}
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 %}}
VCS ignore settings can be negated by adding entries in `include`; be sure to explicitly set the `format` as above.
{{% /note %}}
### dependencies and dependency groups
Poetry is configured to look for dependencies on [PyPI](https://pypi.org) by default.
Only the name and a version string are required in this case.
```toml
[tool.poetry.dependencies]
requests = "^2.13.0"
```
If you want to use a [private repository]({{< relref "repositories#using-a-private-repository" >}}),
you can add it to your `pyproject.toml` file, like so:
```toml
[[tool.poetry.source]]
name = "private"
url = "http://example.com/simple"
```
If you have multiple repositories configured, you can explicitly tell poetry where to look for a specific package:
```toml
[tool.poetry.dependencies]
requests = { version = "^2.13.0", source = "private" }
```
You may also specify your project's compatible python versions in this section, instead of or in addition to `project.requires-python`.
```toml
[tool.poetry.dependencies]
python = "^3.7"
```
{{% note %}}
If you specify the compatible python versions in both `tool.poetry.dependencies` and in `project.requires-python`, then Poetry will use the information in `tool.poetry.dependencies` for locking, but the python versions must be a subset of those allowed by `project.requires-python`.
For example, the following is invalid and will result in an error, because versions `4.0` and greater are allowed by `tool.poetry.dependencies`, but not by `project.requires-python`.
```toml
[project]
# ...
requires-python = ">=3.8,<4.0"
[tool.poetry.dependencies]
python = ">=3.8" # not valid!
```
{{% /note %}}
You can organize your dependencies in [groups]({{< relref "managing-dependencies#dependency-groups" >}})
to manage them in a more granular way.
```toml
[tool.poetry.group.test.dependencies]
pytest = "*"
[tool.poetry.group.docs.dependencies]
mkdocs = "*"
```
See [Dependency groups]({{< relref "managing-dependencies#dependency-groups" >}}) for a more in-depth look
at how to manage dependency groups and [Dependency specification]({{< relref "dependency-specification" >}})
for more information on other keys and specifying version ranges.
### scripts
{{% note %}}
**Deprecated**: Use [`project.scripts`]({{< relref "#scripts" >}}) instead for `console` and `gui` scripts. Use
`[tool.poetry.scripts]` only for scripts of type `file`.
{{% /note %}}
This section describes the scripts or executables that will be installed when installing the package
```toml
[tool.poetry.scripts]
my_package_cli = 'my_package.console:run'
```
Here, we will have the `my_package_cli` script installed which will execute the `run` function in the `console` module in the `my_package` package.
{{% note %}}
When a script is added or updated, run `poetry install` to make them available in the project's virtualenv.
{{% /note %}}
```toml
[tool.poetry.scripts]
my_executable = { reference = "some_binary.exe", type = "file" }
```
This tells Poetry to include the specified file, relative to your project directory, in distribution builds. It will then be copied to the appropriate installation directory for your operating system when your package is installed.
* On Windows the file is placed in the `Scripts/` directory.
* On *nix system the file is placed in the `bin/` directory.
In its table form, the value of each script can contain a `reference` and `type`. The supported types are
`console` and `file`. When the value is a string, it is inferred to be a `console` script.
### extras
**Deprecated**: Use `project.optional-dependencies` instead.
Poetry supports extras to allow expression of:
* optional dependencies, which enhance a package, but are not required; and
* clusters of optional dependencies.
```toml
[tool.poetry]
name = "awesome"
[tool.poetry.dependencies]
# These packages are mandatory and form the core of this package’s distribution.
mandatory = "^1.0"
# A list of all of the optional dependencies, some of which are included in the
# below `extras`. They can be opted into by apps.
psycopg2 = { version = "^2.9", optional = true }
mysqlclient = { version = "^1.3", optional = true }
[tool.poetry.extras]
mysql = ["mysqlclient"]
pgsql = ["psycopg2"]
databases = ["mysqlclient", "psycopg2"]
```
When installing packages with Poetry, you can specify extras by using the `-E|--extras` option:
```bash
poetry install --extras "mysql pgsql"
poetry install -E mysql -E pgsql
```
Any extras you don't specify will be removed. Note this behavior is different from
[optional dependency groups]({{< relref "managing-dependencies#optional-groups" >}}) not
selected for installation, e.g., those not specified via `install --with`.
You can install all extras with the `--all-extras` option:
```bash
poetry install --all-extras
```
{{% note %}}
Note that `install --extras` and the variations mentioned above (`--all-extras`, `--extras foo`, etc.) only work on dependencies defined in the current project. If you want to install extras defined by dependencies, you'll have to express that in the dependency itself:
```toml
[tool.poetry.dependencies]
pandas = {version="^2.2.1", extras=["computation", "performance"]}
```
```toml
[tool.poetry.group.dev.dependencies]
fastapi = {version="^0.92.0", extras=["all"]}
```
{{% /note %}}
When installing or specifying Poetry-built packages, the extras defined in this section can be activated
as described in [PEP 508](https://www.python.org/dev/peps/pep-0508/#extras).
For example, when installing the package using `pip`, the dependencies required by
the `databases` extra can be installed as shown below.
```bash
pip install awesome[databases]
```
{{% note %}}
The dependencies specified for each `extra` must already be defined as project dependencies.
Dependencies listed in [dependency groups]({{< relref "managing-dependencies#dependency-groups" >}}) cannot be specified as extras.
{{% /note %}}
### plugins
**Deprecated**: Use `project.entry-points` instead.
Poetry supports arbitrary plugins, which are exposed as the ecosystem-standard [entry points](https://packaging.python.org/en/latest/specifications/entry-points/) and discoverable using `importlib.metadata`. This is similar to (and compatible with) the entry points feature of `setuptools`.
The syntax for registering a plugin is:
```toml
[tool.poetry.plugins] # Optional super table
[tool.poetry.plugins."A"]
B = "C:D"
```
Which are:
- `A` - type of the plugin, for example `poetry.plugin` or `flake8.extension`
- `B` - name of the plugin
- `C` - python module import path
- `D` - the entry point of the plugin (a function or class)
Example (from [`poetry-plugin-export`](http://github.com/python-poetry/poetry-plugin-export)):
```toml
[tool.poetry.plugins."poetry.application.plugin"]
export = "poetry_plugin_export.plugins:ExportApplicationPlugin"
```
### urls
**Deprecated**: Use `project.urls` instead.
In addition to the basic urls (`homepage`, `repository` and `documentation`), you can specify
any custom url in the `urls` section.
```toml
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/python-poetry/poetry/issues"
```
If you publish your package on PyPI, they will appear in the `Project Links` section.
### requires-poetry
A constraint for the Poetry version that is required for this project.
If you are using a Poetry version that is not allowed by this constraint,
an error will be raised.
```toml
[tool.poetry]
requires-poetry = ">=2.0"
```
### requires-plugins
In this section, you can specify that certain plugins are required for your project:
```toml
[tool.poetry.requires-plugins]
my-application-plugin = ">=1.0"
my-plugin = ">=1.0,<2.0"
```
See [Project plugins]({{< relref "plugins#project-plugins" >}}) for more information.
### build-constraints
In this section, you can specify additional constraints to apply when creating the build
environment for a dependency. This is useful if a package does not provide wheels
(or shall be built from source for other reasons)
and specifies too loose build requirements (without an upper bound)
and is not compatible with current versions of one of its build requirements.
For example, if your project depends on `some-package`, which only provides an sdist
and defines its build requirements as `build-requires = ["setuptools"]`,
but is incompatible with `setuptools >= 78`, building the package will probably fail
because per default the latest setuptools will be chosen. In this case, you can
work around this issue of `some-package` as follows:
```toml
[tool.poetry.build-constraints]
some-package = { setuptools = "<78" }
```
The syntax for specifying constraints is the same as for specifying dependencies
in the `tool.poetry` section.
## Poetry and PEP-517
[PEP-517](https://www.python.org/dev/peps/pep-0517/) introduces a standard way
to define alternative build systems to build a Python project.
Poetry is compliant with PEP-517, by providing a lightweight core library,
so if you use Poetry to manage your Python project, you should reference
it in the `build-system` section of the `pyproject.toml` file like so:
```toml
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
```
{{% note %}}
When using the `new` or `init` command this section will be automatically added.
{{% /note %}}
{{% note %}}
If your `pyproject.toml` file still references `poetry` directly as a build backend,
you should update it to reference `poetry-core` instead.
{{% /note %}}
|