Skip to main content

Python dependency management and packaging made easy.

Project description

Poetry: Dependency Management for Python

Tests Status Stable Version Pre-release Version Downloads Discord

Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.

It requires Python 3.7+ to run.

Poetry Install

Documentation

The complete documentation is available on the official website.

Installation

Instructions on how to install poetry can be found here. You can also refer here for information on how to enable tab completion in your environment.

Introduction

poetry is a tool to handle dependency installation as well as building and packaging of Python packages. It only needs one file to do all of that: the new, standardized pyproject.toml.

In other words, poetry uses pyproject.toml to replace setup.py, requirements.txt, setup.cfg, MANIFEST.in and Pipfile.

[tool.poetry]
name = "my-package"
version = "0.1.0"
description = "The description of the package"

license = "MIT"

authors = [
    "Sébastien Eustace <sebastien@eustace.io>"
]

readme = "README.md"

repository = "https://github.com/python-poetry/poetry"
homepage = "https://python-poetry.org"

keywords = ["packaging", "poetry"]

[tool.poetry.dependencies]
python = "^3.8"  # Compatible python versions must be declared here
aiohttp = "^3.8.1"
# Dependencies with extras
requests = { version = "^2.28", extras = [ "security" ] }
# Python specific dependencies with prereleases allowed
tomli = { version = "^2.0.1", python = "<3.11", allow-prereleases = true }
# Git dependencies
cleo = { git = "https://github.com/python-poetry/cleo.git", branch = "master" }

# Optional dependencies (extras)
pendulum = { version = "^2.1.2", optional = true }

[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
pytest-cov = "^3.0"

[tool.poetry.scripts]
my-script = "my_package:main"

There are some things we can notice here:

  • It will try to enforce semantic versioning as the best practice in version naming.
  • You can specify the readme, included and excluded files: no more MANIFEST.in. poetry will also use VCS ignore files (like .gitignore) to populate the exclude section.
  • Keywords can be specified and will act as tags on the packaging site.
  • The dependencies sections support caret, tilde, wildcard, inequality and multiple requirements.
  • You must specify the python versions for which your package is compatible.

poetry will also detect if you are inside a virtualenv and install the packages accordingly. So, poetry can be installed globally and used everywhere.

poetry also comes with a full fledged dependency resolution library.

Why?

Packaging systems and dependency management in Python are rather convoluted and hard to understand for newcomers. Even for seasoned developers it might be cumbersome at times to create all files needed in a Python project: setup.py, requirements.txt, setup.cfg, MANIFEST.in and Pipfile.

So I wanted a tool that would limit everything to a single configuration file to do: dependency management, packaging and publishing.

It takes inspiration in tools that exist in other languages, like composer (PHP) or cargo (Rust).

And, finally, I started poetry to bring another exhaustive dependency resolver to the Python community apart from Conda's.

Resources

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry-1.2.0rc2.tar.gz (818.1 kB view details)

Uploaded Source

Built Distribution

poetry-1.2.0rc2-py3-none-any.whl (210.8 kB view details)

Uploaded Python 3

File details

Details for the file poetry-1.2.0rc2.tar.gz.

File metadata

  • Download URL: poetry-1.2.0rc2.tar.gz
  • Upload date:
  • Size: 818.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.9.13 Linux/5.15.0-1017-azure

File hashes

Hashes for poetry-1.2.0rc2.tar.gz
Algorithm Hash digest
SHA256 137c8a2f48cdbbc211909f8ea1f244955657a1039a81900ab857a604d70048b1
MD5 1b7951bfad77dd934f87d2c1e3808073
BLAKE2b-256 a2668a6bae17d100b97fdc2c6ad34a4bc32b96135de9c9d85e1e66fb86fb6e59

See more details on using hashes here.

File details

Details for the file poetry-1.2.0rc2-py3-none-any.whl.

File metadata

  • Download URL: poetry-1.2.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 210.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.9.13 Linux/5.15.0-1017-azure

File hashes

Hashes for poetry-1.2.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 2bc21502c08c9e62412f33f8e09750233b89ad7e7c5016e85bb6f739a98e0451
MD5 646545a99ae8700e08b58580ed14fc3f
BLAKE2b-256 7df46f7fa67b4bd9440a8ebfd5200e1658802dcbeb43888346c70eb921a87559

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page