If you accidentally install a dependency in poetry as a main dependency (i.e. poetry add ...
), is there a way to quickly transfer it to dev dependencies (i.e. poetry add --dev ...
), or do you have to uninstall it and reinstall with poetry add --dev
?
lock file, Poetry will create one after dependency resolution. You can specify to the command that you do not want the development dependencies installed by passing the --no-dev option. If you want to remove old dependencies no longer present in the lock file, use the --remove-untracked option.
As mentioned above, the poetry. lock file prevents you from automatically getting the latest versions of your dependencies. To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your pyproject.
You can move the corresponding line in the pyproject.toml
from the [tool.poetry.dependencies]
section to [tool.poetry.dev-dependencies]
by hand and run poetry lock --no-update
afterwards.
You can also poetry add -D <dep>
and poetry remove <dep>
in either order. Just be sure to use the same version constraint. Poetry stops/warns you if you use different constraints as they'd conflict.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With