Managing Projects with Poetry
Links and tuturials
Installing and configuring Poetry
Installing Poetry
Configuring Poetry
Configuring poetry settings. Example set default python version:
Understanding projecto.tomlfile
Here's a brief overview of its main sections:
[tool.poetry]: This section contains metadata about the project, such as the name, version, description, authors, and more.[tool.poetry.dependencies]: This section lists the project's dependencies. You can specify the required packages and their versions here.[tool.poetry.dev-dependencies]: This section lists the development dependencies, which are only needed for development and testing.[build-system]: This section defines the build system used by the project, typically specifying Poetry itself.
Adding and Managing Dependencies
Add/remove dependencies:
update dependencies:
update all packages:
Managing the Project
-
poetry install: Installs the project's dependencies as specified in the poetry.lock file. -
poetry build: Builds the project package. -
poetry publish: Publishes the package to a package repository like PyPI. -
poetry run: Executes commands in the virtual environment where the project's dependencies are installed.
Manging Virtual Environments with Poetry
Check env settings:
Activating / Deactivating Virtual Envs
to deactivate: exit
Managing multiple virtual environments
List all environments:
remove: