Create a new Poetry project:
# poetry new <project-name>
# Ex:
poetry new rocketshipThis creates a Poetry project with the following directory structure:
Activate the Python virtual environment:
cd ./rocketship
poetry shellDeactivate the Python virtual environment:
exitInstall a Python package (
pip install):# poetry add <package_name>
# Ex:
poetry add requestsUninstall a Python package (
pip uninstall):# poetry remove <package_name>
# Ex:
poetry remove requests
Installing dependencies:
poetry installDisplay the package information:
poetry showLock the project dependencies:
poetry lock
Update the dependencies according to the
pyproject.toml file:poetry update
List the existing Python virtual environments associated with a Poetry project:
cd rocketship
poetry env list
Example:
Delete the Python environment:
# poetry env remove <python-environment-name>
# Ex:
poetry env remove rocketship-DKQKySEf-py3.8
Follow this space (Vikas Z's blog) for more on Python Poetry usage and hacks.
Also published on Hashnode.