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.5.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: test_pkg_poetry_binlecode-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 b11cc5c761097cc6a96ff05bcb4a9bbba72008186c5509ae7c5ce6b6dc331ad8
MD5 d7464aa9ae375640f31bc1ca66edc0a9
BLAKE2b-256 0d6a0caa4064a687874b3339e1cec302b05fbcfd9a8f90e8c02912639ca64c44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 57dad15230435f6270b88483a56e49f00f06b83fafa7f9268620806d69b23040
MD5 054d6c957cab64e1281adb9f3108b21e
BLAKE2b-256 a1bb006806359e92ca4c851ca72cfd3eed63919d61289beaa597b7baf188e59e

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page