Additional Dependency Constraints
Extras
Some packages come with optional features that you can enable using extras:
[tool.poetry.dependencies]
requests = { version = "^2.25.1", extras = ["security"] }
URL Dependencies
Poetry also supports specifying dependencies from URLs:
[tool.poetry.dependencies]
requests = { url = "https://example.com/requests-2.25.1.tar.gz" }
Git Dependencies
You can specify dependencies from a Git repository:
[tool.poetry.dependencies]
requests = { git = "https://github.com/psf/requests.git", branch = "main" }
Understanding Versions, Ranges, and Constraints in Python Poetry
Managing dependencies is a fundamental aspect of maintaining a Python project. Poetry, a powerful dependency management tool, simplifies this process by providing a clear and concise way to declare, manage, and resolve dependencies. Here we check how to specify dependencies in Poetry, adding, removing, updating dependencies, and the use of versions, ranges, and constraints.