Skip to main content

Poetry plugin that adds support for building wheel files using the poetry.lock file, and data_files just like in setup.py

Project description

poeblix

Poetry Plugin that adds various features deemed unfit for the official release, but makes sense to me

Overview

These contain custom poetry plugins that enable functionality not available in the official distribution of poetry. These include:

  1. Using the Lock file to build a wheel file with pinned dependencies
  2. Support for data_files (like with setup.py) such as jupyter extensions or font files
  3. Validating a wheel file is consistent with dependencies specified in pyproject.toml/poetry.lock
  4. Validating a docker container's pip freeze contains dependencies as specified in pyproject.toml/poetry.lock

These are not supported in Poetry due to debate in the community: https://github.com/python-poetry/poetry/issues/890, https://github.com/python-poetry/poetry/issues/4013, https://github.com/python-poetry/poetry/issues/2778

How to Use

Installation

You can add the plugin via poetry's CLI:

poetry plugin add poeblix

Or install directly from source/wheel, then add with the same above command using the path to the built dist

Usage

  1. To build a wheel from your package:
poetry blixbuild
  1. Validate a wheel file has consistent dependencies and data_files as specified in pyproject.toml/poetry.lock
poetry blixvalidatewheel <path-to-wheel>

Note: this validates consistency in both directions

  1. Validate a docker container contains dependencies in a pip freeze as specified in pyproject.toml/poetry.lock
poetry blixvalidatedocker <docker-container-ID>

Note: this only validates the docker container contains dependencies in the project, but not the other direction

Here's an example series of commands to start up a temporary docker container using its tag, validate it, then stop the temporary container

# This will output the newly running container id
docker run --entrypoint=bash -it -d <docker-image-tag>

# Then validate the running docker container, and stop it when done
poetry blixvalidatedocker <container-id>
docker stop <container-id>
  1. Adding data_files to pyproject.toml to mimic data_files in setup.py:
...
  
[tool.blix.data]
data_files = [
    { destination = "share/data/", from = [ "data_files/test.txt", "data_files/anotherfile" ] },
    { destination = "share/data/threes", from = [ "data_files/athirdfile" ] }
]
  
...

data_files should be under the [tool.blix.data] category and is a list of objects, each containing the destination data folder, and a from list of files to add to the destination data folder.

  1. For more help on each command, use the --help argument
poetry blixbuild --help
poetry blixvalidatewheel --help
poetry blixvalidatedocker --help

Development

mkvirtualenv -p python3.9 venv
# installs the plugin in editable mode for easier testing via `poetry install`
./devtool bootstrap

# Lint checks
./devtool lint

# Run all checks
./devtool all

plugins.py : contains our plugin that adds the poetry blix command for building our wheel file

validateplugin.py : adds a command that validates a docker file contains dependencies as specified in pyproject.toml and poetry.lock. This does NOT validate that they are exactly matching, but rather that all dependencies in pyproject.toml/poetry.lock exist in the docker container on the correct versions. The docker image may contain more extra dependencies

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

poeblix-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

poeblix-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file poeblix-0.1.0.tar.gz.

File metadata

  • Download URL: poeblix-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for poeblix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca7be10a80bb6f6f082db2aeaedeea87eb1c22b5672bc07af84a327b04805c40
MD5 444683215c9702fcff6de8ce7365b71c
BLAKE2b-256 49c1d02135188d6c2de0c820f67b36c52037763a32f19918cf07a676f00734e4

See more details on using hashes here.

File details

Details for the file poeblix-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: poeblix-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for poeblix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98672ca3ce0a19638af091630fb47fd738d5f50662850e280ac96f49b8201631
MD5 1ee8ec5c85ffccb4b5555ba9c1a47c46
BLAKE2b-256 c995653462a335419b2fd6e4beba008638caa5f453f3a537924778535803cb7f

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