Learn modern Python packaging with Poetry, pyproject.toml and PyPI.
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
PyPi Project Page
http://pypi.org/project/learn-pyproject/0.1.1/
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 show --tree
poetry show --all
Libraries
poetry build # sdist (source, .tar.gz), wheel (compiled, .whl)
poetry publish # requires .pypirc credentials, see https://python-poetry.org/docs/repositories/#configuring-credentials
poetry config pypi-token.pypi <token>
poetry publish --build # note published versions are immutable. You have to change the version number to publish again. Use semver.
Commands
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
learn_pyproject-0.1.1.tar.gz
(2.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file learn_pyproject-0.1.1.tar.gz.
File metadata
- Download URL: learn_pyproject-0.1.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.1 Linux/6.8.0-1027-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80c833ac5ee356496bf50ee6693c3876466a498d47f7197e963ba6c5e98e1c84
|
|
| MD5 |
d80d69b535363dc0324a1fe44d20dbb7
|
|
| BLAKE2b-256 |
944197ec27fa202f4c291220704ca9c198c6af9ae31a71043ccc0c94b4b2ffd7
|
File details
Details for the file learn_pyproject-0.1.1-py3-none-any.whl.
File metadata
- Download URL: learn_pyproject-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.1 Linux/6.8.0-1027-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9be3da0a1ec4cd03ea244cd5729b2a0e864b8ccd437f7f66836c0443ef3447d
|
|
| MD5 |
3452993757e426e0bece4d449d65cc5a
|
|
| BLAKE2b-256 |
a371ccf29057229b47764221a02d7f8bb8d6b2a65cd103d4ee8b434921a33464
|