Skip to main content

Poetry lock package generator

Simple script that will take a pyproject.toml and a poetry.lock and generate a new poetry project where all the lock versions are pinned dependencies.

In theory this will allow you to transport your lock file to any system that is able to install python packages and dependencies.

After installation, the command poetry-lock-package should be run next to your pyproject.toml and poetry.lock files and will generate a subdirectory with a pyproject.toml requiring all the dependencies of the lock file.

Simply enter the subdirectory, build and publish the package and you have a '-lock' package that depends on all the exact versions from your lock file.

Example workflow

The example workflow below will add poetry-lock-package as a dev dependency, allowing poetry run to find the command.

First create a new poetry project

poetry new example-package
cd example-package

Add some dependencies, and see what we have build so far

poetry add loguru click
poetry install
poetry build
ls dist

Add poetry-lock-package to allow for poetry run to find the entry point script:

poetry add --dev poetry-lock-package

Finally build the lock package and see what we have gotten

poetry run poetry-lock-package --build
ls -al dist

You will now have two wheel files in your dist folder: one with the project code, one name example-package-lock which depends on the exact version of all the packages specified in your poetry.lock file.

Using --no-root

Default behavior is to have the lock package depend on the original package the lock was created for. If you have a private repository, this will allow you to publish both packages to the private repository and only require you to point at one package to install everything.

If you want to be able to install the dependencies, but not the package itself, you can use the --no-root command line argument to stop poetry-lock-package from adding your root project to the lock package dependencies.

Using --ignore

If you want to allow pip to have freedom in selecting a package, or you expect to deploy in an environment that already has the right version installed, you can opt to use --ignore to remove that dependency from the lock package pinned dependencies.

Because poetry-lock-package is aware of the dependency graph, it will not only skip locking the dependency but also transitive dependencies.

Contributing code

  • Open an issue

  • Create an associated PR

  • Make sure to black format the proposed change

    poetry run pre-commit install

  • Add tests where possible

License

GPLv3, use at your own risk.

Metadata

Release files for poetry-lock-package 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-lock-package 0.5.3
File Size Uploaded
poetry_lock_package-0.5.3.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poetry-lock-package 0.5.3
File Interpreter ABI Platform
poetry_lock_package-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / poetry_lock_package-0.5.3.tar.gz

Download URL poetry_lock_package-0.5.3.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7bf01a2230df3dad9b7c7265f5b763f57c3f3621aa7604f0d4cb922cc400f2d4
BLAKE2b-256 checksum
How to use checksums
0726a038e234315ad8a01a19f3c305016a78f6b3e16d01a6fc3f8958811a3b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / poetry_lock_package-0.5.3-py3-none-any.whl

Download URL poetry_lock_package-0.5.3-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffb16a8b9b7ba35961a1601c11cea391dafd3fd4df95cdf72c7b037b55d557da
BLAKE2b-256 checksum
How to use checksums
e30aefc02c262e1e991740eec0cab891abf82c2987d43f8b51f148400761c9e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page