Python Poetry - update -dev dependencies only to latest
Asked Answered
H

4

13

How do I get Poetry to update dev dependencies only to latest?

I originally had:

[tool.poetry.dev-dependencies]
pytest = "^4.6"

But I wanted:

[tool.poetry.dev-dependencies]
pytest = "^6.0"

I achieved it by manual editing the pyproject.toml file.

When I ran poetry update it ( brilliantly ) bumped all my normal ( non-dev ) dependencies.

Hilaria answered 10/8, 2022 at 8:54 Comment(0)
S
15

With latest poetry version you should use

poetry add pytest@latest --group dev

Shavonda answered 9/1, 2023 at 16:13 Comment(0)
M
9

Since poetry 1.2 supports plugins, and there is a plugin to update all packages at once, you can

  • update poetry
poetry self update
  • install up plugin
poetry self add poetry-plugin-up
  • up your dev packages to the latest ⬅
poetry up --only=dev --latest
Myself answered 13/4, 2023 at 10:57 Comment(0)
H
3
# June 2024 update
poetry add pytest@latest --group dev
Hilaria answered 10/8, 2022 at 8:54 Comment(1)
Note this is now deprecated see --group dev insteadOniskey
M
0

When I ran poetry update it ( brilliantly ) bumped all my normal (non-dev ) dependencies

Re manually updating the pyproject.toml file.

You're changes were likely overwritten because you didn't update the .lock file.

Make your changes to the .toml, then run

poetry lock --no-update
Malta answered 27/8, 2024 at 9:45 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.