Poetry plugin to freeze a wheel's dependencies per lock file
Project description
Freeze Wheel Plugin
Poetry plugin for creating frozen wheels using lockfiles.
Why
A common issue when publishing a Python application's release into PyPI, is whether or not the dependencies specified will continue to work over time. This tends to happen due to a confluence of reasons, poor dependency specification, bad observance of semantic versioning, or poor release management by the dependency. That translates to a reality where installing an older release of the application is unlikely to work, due to changes in the underlying dependency graph.
The dependency ecosystem is both complex and fragile. The emergence of lock files to ensure repeatability is testimony both to the problem and one solution. Yet when we go to publish in the packaging ecosystem we do so with non frozen dependencies specifications not with lockfiles. That means the testing pipelines that goes to produce and validate a release is against a lockfile but the release artifact is divorced of the lockfile contents, and starts to diverge from the moment of publication.
The various language package distribution channels (npm, pypi, rubygems, etc) are used for two different primary distribution purposes, for both libraries and applications. Generally speaking the extant behavior is reasonable for a library. Libraries should be relatively liberal on their own dependencies baring perhaps major versions to minimize conflicts for applications depending on them and ideally consist of minimal dependencies graphs. But for applications distribution, repeatable and verifyable installs are fundamental goals with potentially large dependency graphs. Using a frozen dependency graph versus version specifications is the only way to ensure repeatiblity of installation over time. Fundamentally the two different distribution purposes have different audiences, ie. libraries have developers and applications as consumers, applications have users as consumers.
What
A post build / pre publish command to allow for creating wheels with frozen dependencies. Basically we update wheel metadata for Requires-Dist to replace the pyproject.toml based version specification to a frozen (ie. ==version) one based on the version from the poetry lock information.
Usage
# install plugin
poetry self install poetry-plugin-freeze
# build per normal
poetry build
# add freeze step
poetry freeze-wheel
# publish per normal
poetry publish
Mono-Repo Support
To support mono repos consisting of multiple libraries/applications, when creating a frozen wheel, dev dependencies specified by path can be optionally substituted out for references to their release artifact versions.
This assumes automation to run build and publish across the various subpackages, ie typically via make or just.
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
Built Distribution
Hashes for poetry_plugin_freeze-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebfaa6cc7727ef219c07dee535407b47b399c16a84ab47e441b2228f00278772 |
|
MD5 | 4840db5a04abbeb6b6669b686cbdffab |
|
BLAKE2b-256 | 74f2ca534b44cdc85285ccd9c8add2bdf0480ceda57da9adc554b19c5428fb56 |
Hashes for poetry_plugin_freeze-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1ec75cbfaa0ca4858412bf4acf0c938748ad2b40cd0e6a721d0f4626ba4f9fe |
|
MD5 | 7d01c677ac2ba8833d9d510f00c6e701 |
|
BLAKE2b-256 | 6b4130c2c72ea76ea9e833a36a279612892e6bedc1edc32c999373c9db2bce53 |