Skip to main content

Python dependency management and packaging made easy.

Project description

Poetry: Dependency Management for Python

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

Poetry Install

It supports Python 3.7+.

Tests Status Stable Version Pre-release Version Downloads Discord

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 the newly added 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"  # Markdown files are supported

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

keywords = ["packaging", "poetry"]

[tool.poetry.dependencies]
python = "~2.7 || ^3.2"  # Compatible python versions must be declared here
toml = "^0.9"
# Dependencies with extras
requests = { version = "^2.13", extras = [ "security" ] }
# Python specific dependencies with prereleases allowed
pathlib2 = { version = "^2.2", python = "~2.7", allow-prereleases = true }
# Git dependencies
cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" }

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

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

[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 the newly added 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.0b2.tar.gz (803.0 kB view details)

Uploaded Source

Built Distribution

poetry-1.2.0b2-py3-none-any.whl (211.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: poetry-1.2.0b2.tar.gz
  • Upload date:
  • Size: 803.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.13 Linux/5.13.0-1025-azure

File hashes

Hashes for poetry-1.2.0b2.tar.gz
Algorithm Hash digest
SHA256 875552acd2b658cf12356acc2ff6ba454639a983b6150e0d8b093554d87e4983
MD5 916e70151a1cfbdef3c0b58802674ccb
BLAKE2b-256 c228d41441be25d07c48f26309d4c63d924c3f7d9378cd0c31478f60489fccab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: poetry-1.2.0b2-py3-none-any.whl
  • Upload date:
  • Size: 211.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.13 Linux/5.13.0-1025-azure

File hashes

Hashes for poetry-1.2.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 af57193839fdf6040ba37100cf03b7c380c62234b4d7bd5d4a48557297c9fd5f
MD5 bd1a001abda2c8256c48c8de6aed16e5
BLAKE2b-256 9096d7723f49ad06c4be74daf4694190ea56bacd5328b5e4939ba46b632c5952

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