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.3.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.3-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6e5554c2474b75b98645cc730f00e9527591b69c0b076a2a73d2f2a353770327
MD5 2dcd28a220b1e4464b8147a71750faca
BLAKE2b-256 e2530a1cfe74de63d2f3f8f0f1f20e56e7541e78f26dde597f71e75675668a95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d1ed89ba8ab8af119a99dea56bf45acedaed4eb8702c04374bbe10c6d319ed28
MD5 bf4b792ed0171778aac3d7604d717f77
BLAKE2b-256 46b3001e91e2407062c66435149c58311597d824c9397a2e6964e3bb3f289ac9

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