Skip to main content

No project description provided

Project description

test package build with poetry

Comparing to setuptools, poetry is all-in-one shop and with less manual configuration in python package development cycle. For example, pyproject.toml is created by poetry with format of PEP 518 package specs with poetry new command.

pyenv shell 3.9.11
python -m venv ./venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install poetry

package initialization

Use poetry to initialzes a package under project root:

poetry new test_pkg_poetry_binlecode

Use poetry to add dependencies, they are added to pyproject.toml by poetry automatically.

# add pytest as dev dependency
poetry add pytest --dev
# show dependency tree
poetry show --tree
# generate lock file
poetry lock

# The install command reads the pyproject.toml file from the current project,
# resolves the dependencies, and installs them.
# If poetry.lock exists, the lock file is used instead of resolving dependencies.
poetry install

poetry export --output requirements.txt

testing with pytest

Run pytest at project root level, it will scan tests folder and test scripts.

poetry run pytest

source code formatting with black

poetry run black .

build distribution and publish

Check package and build distribution. Poetry builds both source and wheel distributions.

poetry check
poetry build

To publish to pypi, config api token first.

poetry config pypi-token.pypi <my-token>

Poetry can use token to publish:

poetry publish

Publishing test-pkg-poetry-binlecode (0.1.0) to PyPI
 - Uploading test-pkg-poetry-binlecode-0.1.0.tar.gz 100%
 - Uploading test_pkg_poetry_binlecode-0.1.0-py3-none-any.whl 100%

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

test_pkg_poetry_binlecode-0.1.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

test_pkg_poetry_binlecode-0.1.2-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file test_pkg_poetry_binlecode-0.1.2.tar.gz.

File metadata

  • Download URL: test_pkg_poetry_binlecode-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1020-azure

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.2.tar.gz
Algorithm Hash digest
SHA256 60f94896ab348db22ffe7673aa6d765cf47755c6234139ee7f52211000f5a249
MD5 e5e664afde4e65d7b6cd2feff49cc85e
BLAKE2b-256 cdf17eefe7c9eb68e84016e0e5961a5d8c75c899c122a3bace6dd4576aef253d

See more details on using hashes here.

File details

Details for the file test_pkg_poetry_binlecode-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 596631116437bf7569a87fa072c2ca296afcfe034125644438013251bdd5d256
MD5 92f686c96c32c88397f4038786b31118
BLAKE2b-256 8b047bea175af65c485fea9aee7426e0dd9433462bb02e75f3ac3aae18057572

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