Update the Python module to the latest version with poetry.
Table of contents
Open Table of contents
TL;DR
If you want to update the package to the latest or a specific version, use the following command.
$ poetry add <package-name>@<version>
# or
$ poetry add <package-name>@latest
Issue
I am using poetry to manage a few of my Python projects. Recently I had to update the mysql-connector-python
package to the latest version.
I found the following command to update the package to the latest version.
poetry update <package-name>
However, it didn’t work properly and it showed the following message.
$ poetry update mysql-connector-python
# Updating dependencies
# Resolving dependencies... (1.0s)
# No dependencies to install or update
Solution
After some research, I found the following command to update the package to the latest version. And the command is not actually update
but add
with the latest or specific version.
Update the package to the latest version
$ poetry add mysql-connector-python@latest
It worked and updated the package to the latest version.
Update the package to a specific version
$ poetry add mysql-connector-python==9.3.0
It worked and updated the package to the specific version.
Conclusion
We can use the following command to update the package to the latest or a specific version.
$ poetry add <package-name>@<version>