|
| 1 | +--- |
| 2 | +layout: single |
| 3 | +title: "Announcing Poetry 2.2.0" |
| 4 | +date: 2025-09-14 |
| 5 | +categories: [releases] |
| 6 | +tags: ["2.x", "2.2"] |
| 7 | +--- |
| 8 | + |
| 9 | +The Poetry team is pleased to announce the immediate availability of Poetry **2.2.0**. |
| 10 | + |
| 11 | +<!--more--> |
| 12 | + |
| 13 | +If you have a previous version of Poetry installed via `pipx`, |
| 14 | +getting Poetry **2.2.0** is as easy as: |
| 15 | + |
| 16 | +```bash |
| 17 | +$ pipx upgrade poetry |
| 18 | +``` |
| 19 | + |
| 20 | +If you used the [official installer](/docs/#installation), you can run: |
| 21 | + |
| 22 | +```bash |
| 23 | +$ poetry self update |
| 24 | +``` |
| 25 | + |
| 26 | +## Highlights |
| 27 | + |
| 28 | +### Normalizing dependency group names and nesting dependency groups |
| 29 | + |
| 30 | +By nesting dependency groups, you can include dependencies from one group in another group. |
| 31 | +This is useful when you want to aggregate dependencies from multiple groups into a single group, e.g.: |
| 32 | + |
| 33 | +```toml |
| 34 | +[tool.poetry.group.test.dependencies] |
| 35 | +pytest = "^8.0.0" |
| 36 | + |
| 37 | +[tool.poetry.group.lint.dependencies] |
| 38 | +ruff = "^0.11" |
| 39 | + |
| 40 | +[tool.poetry.group.dev] |
| 41 | +include-groups = [ |
| 42 | + "test", |
| 43 | + "lint", |
| 44 | +] |
| 45 | + |
| 46 | +[tool.poetry.group.dev.dependencies] |
| 47 | +tox = "*" |
| 48 | +``` |
| 49 | + |
| 50 | +In this example, the `dev` group includes all dependencies from the `test` and `lint` groups. |
| 51 | + |
| 52 | +In order to support nesting groups, Poetry will normalize group names. |
| 53 | +This has the side effect that it is no more possible to define two groups with names |
| 54 | +that will result in the same normalized name, e.g. `Test` and `test`. |
| 55 | + |
| 56 | +### Add support for PEP 735 dependency groups |
| 57 | + |
| 58 | +Instead of using Poetry's custom syntax for defining dependency groups, you can now also use |
| 59 | +[PEP 735](https://peps.python.org/pep-0735/) syntax. |
| 60 | + |
| 61 | +For example, instead of |
| 62 | + |
| 63 | +```toml |
| 64 | +[tool.poetry.group.test.dependencies] |
| 65 | +pytest = "^6.0.0" |
| 66 | +pytest-mock = "*" |
| 67 | +``` |
| 68 | + |
| 69 | +you can now also write |
| 70 | + |
| 71 | +```toml |
| 72 | +[dependency-groups] |
| 73 | +test = [ |
| 74 | + "pytest (>=6.0.0,<7.0.0)", |
| 75 | + "pytest-mock", |
| 76 | +] |
| 77 | +``` |
| 78 | + |
| 79 | +You can also nest dependency groups via `include-group`: |
| 80 | + |
| 81 | +```toml |
| 82 | +[dependency-groups] |
| 83 | +test = [ |
| 84 | + "pytest (>=8.0.0,<9.0.0)", |
| 85 | +] |
| 86 | +lint = [ |
| 87 | + "ruff (>=0.11.0,<0.12.0)", |
| 88 | +] |
| 89 | +dev = [ |
| 90 | + { include-group = "test" }, |
| 91 | + { include-group = "lint" }, |
| 92 | + "tox", |
| 93 | +] |
| 94 | +``` |
| 95 | + |
| 96 | +{{% note %}} |
| 97 | +As with `project.dependencies` and `tool.poetry.dependencies`, you can also |
| 98 | +add additional information about a dependency of a group in the Poetry specific section |
| 99 | +even when using PEP 735 syntax. However, pay attention that you cannot add additional |
| 100 | +dependencies in the Poetry specific section when using PEP 735 syntax; |
| 101 | +you can only add additional information to dependencies. |
| 102 | +{{% /note %}} |
| 103 | + |
| 104 | +### Add support for PEP 639 licencse clarity |
| 105 | + |
| 106 | +With [PEP 639](https://peps.python.org/pep-0639/), table values for the `project.license` |
| 107 | +as well as license classifiers are deprecated. |
| 108 | +`project.license` should be a string representing a valid |
| 109 | +[SPDX expression](https://packaging.python.org/en/latest/glossary/#term-License-Expression). |
| 110 | +License files can be specified in the `project.license-files` table. |
| 111 | + |
| 112 | +Example: |
| 113 | + |
| 114 | +```toml |
| 115 | +[project] |
| 116 | +# ... |
| 117 | +license = "MIT" |
| 118 | +license-files = [ |
| 119 | + "*-LICENSE", |
| 120 | + "CONTRIBUTORS", |
| 121 | + "MY-SPECIAL-LICENSE-DIR/**/*" |
| 122 | +] |
| 123 | +``` |
| 124 | + |
| 125 | +Further, license files are not anymore put into top-level into the `dist-info` directory |
| 126 | +but into a `licenses` subdirectory. |
| 127 | + |
| 128 | +{{% note %}} |
| 129 | +If you do not specify license files explicitly, |
| 130 | +Poetry will include common license file names by default as before. |
| 131 | +{{% /note %}} |
| 132 | + |
| 133 | +## Upcoming Changes |
| 134 | + |
| 135 | +### Defaulting to `setuptools` instead of `poetry-core` if no build system is defined |
| 136 | + |
| 137 | +Per [PEP 517](https://peps.python.org/pep-0517/), a build tool should fall back to `setuptools` if no build system is |
| 138 | +defined in the `[build-system]` section of `pyproject.toml`. However, to avoid immediate disruption, Poetry will |
| 139 | +currently issue a **warning** in such cases and continue using the built-in `poetry-core` backend by default. |
| 140 | +This behavior will change in a future minor release so that Poetry will default to `setuptools` |
| 141 | +if no `[build-system]` section is defined. |
| 142 | + |
| 143 | +## Changelog |
| 144 | + |
| 145 | +TODO |
0 commit comments