Skip to main content

Learn modern Python packaging with Poetry and PyProject

Project description

learn-pyproject

Experiments with modern python project tooling.

https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ https://python-poetry.org/docs

Install Poetry

curl -sSL https://install.python-poetry.org | python3 -
poetry completions bash >> ~/.bashrc
echo "source /etc/bash_completion" >> ~/.bashrc
poetry --version

Basic Usage

# create venv and install dependencies
poetry install
# activate venv
$(poetry env activate)
# list all venvs
poetry env list
# delete the current venv (and all installed dependencies)
poetry env remove $(poetry env list | grep Activated | awk '{ print $1 }')
# alternatively, use `poetry run` which will use the venv
poetry run python src/learn_pyproject/hello.py

Managing Dependencies

# discard lockfile and resolve dependencies again
poetry update
# fix lockfile
poetry lock
# make sure only the dependencies in the lockfile are installed
poetry sync
# add dependencies
poetry add requests
# add optional dependencies in a group
poetry add pytest --group test
# install the optional group dependencies
poetry install --with test
# exclude optional dependencies
poetry install --without test,docs
# explicitly select groups to install
poetry install --only main # runtime deps are implicitly named main
poetry build # sdist (source, .tar.gz), wheel (compiled, .whl)
poetry publish # requires .pypirc credentials, see https://python-poetry.org/docs/repositories/#configuring-credentials
poetry show --tree
poetry show --all

Libraries

Project details


Download files

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

Source Distribution

learn_pyproject-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

learn_pyproject-0.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file learn_pyproject-0.1.0.tar.gz.

File metadata

  • Download URL: learn_pyproject-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for learn_pyproject-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bcc11be7a282460b2e09bcf93d6ca3e3d0e67a29e4c984b1b565b470bba92b12
MD5 7d42ca91d04733a2fb64e4d126b8263d
BLAKE2b-256 f91a858d7758772565734cde2fb2987f67d25565b73632da18cf9471bd3dc151

See more details on using hashes here.

File details

Details for the file learn_pyproject-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for learn_pyproject-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed65b6d958006959afc98476987ad97c9fa044d62a203e1ddec09b417c6b0c75
MD5 22bbffcf988f82dbc16946dcd836f260
BLAKE2b-256 e5154439c8f7ce362b98a8bf34513984e2d9504bf743e8156ac48b1cf7781c02

See more details on using hashes here.

Supported by

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