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

Uploaded Python 3

File details

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

File metadata

  • Download URL: test_pkg_poetry_binlecode-0.1.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.11 Darwin/21.6.0

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b1d38ccbd57fd7e35ef8fd778d8730cb74e4361487fed68d273df9e297fa4f02
MD5 19035e1d9c9a518f412acdb851427b3d
BLAKE2b-256 5b2f0c52fe09e46d11f94ecd19c0726dd4fafb5e656fdafc85638daba9ab0d01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for test_pkg_poetry_binlecode-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58ed1e12f441c3b9b3e945605a55e2643aca27e23eea06aa0d5fb8f2187afe99
MD5 faabdb1751e03006af8d60c8b9d88583
BLAKE2b-256 14a1f3bb6af2b6a8b9cb960684aa6b2b1ec914be4f7c84b1b3efd284ff7a3ed6

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