Skip to main content

Convert, sync, and validate dependency intent between pyproject.toml, dependency groups, and pylock.toml.

Project description

pylock-bridge

pylock-bridge is a production-ready Python library and CLI for converting, syncing, and validating dependency intent between:

  • project.dependencies
  • project.optional-dependencies
  • top-level [dependency-groups]
  • pylock.toml metadata and target naming

It is designed for CI pipelines, multi-lock workflows, and monorepos that want one place to reason about standardized packaging data without taking over dependency resolution.

What it does

  • inspects dependency intent from pyproject.toml
  • plans standardized pylock.toml target filenames
  • syncs lockfile metadata from pyproject.toml into existing or new pylock*.toml files
  • preserves existing [[packages]], tool.*, and unrelated lockfile content while updating bridge-managed metadata
  • validates drift between project metadata and lockfile metadata
  • scans monorepos and reports project-by-project plans
  • exposes a clean Python API for automation

pylock-bridge does not resolve dependencies or generate package entries. It keeps project intent and lockfile metadata aligned so your resolver or build pipeline can do the actual solving.

Install

pip install pylock-bridge

For local development:

pip install -e .
python -m unittest discover -s tests

CLI

Inspect a project:

pylock-bridge inspect
pylock-bridge inspect --project path/to/pyproject.toml --format json

Plan lock targets:

pylock-bridge plan
pylock-bridge plan --workspace .

Validate drift:

pylock-bridge validate
pylock-bridge validate --workspace . --strict

Sync a target into a lockfile:

pylock-bridge sync --target default --write
pylock-bridge sync --target dev --format toml
pylock-bridge sync --target dev --check

Discover projects in a monorepo:

pylock-bridge discover --workspace .

Python API

from pylock_bridge import plan_project, sync_project_lock, validate_workspace

targets = plan_project("pyproject.toml")
result = sync_project_lock("pyproject.toml", target_name="default", write=True)
issues = validate_workspace(".", check_lockfiles=True)

Planning configuration

You can customize how lock targets are planned using [tool.pylock-bridge]:

[tool.pylock-bridge]
default-lock = "pylock.toml"
include-optionals-by-default = false
include-groups-by-default = false
default-groups = ["dev"]

[tool.pylock-bridge.targets.dev]
dependency-groups = ["dev"]
default-groups = ["dev"]

[tool.pylock-bridge.targets.docs]
optional-dependencies = ["docs"]

[tool.pylock-bridge.targets.ci]
include-runtime = true
dependency-groups = ["lint", "test"]
filename = "pylock.ci.toml"

Sync model

When you run sync, the tool updates lockfile metadata based on the selected target:

  • requires-python
  • extras
  • dependency-groups
  • default-groups
  • metadata.pylock-bridge

Existing [[packages]] entries are preserved so lockfile metadata can be refreshed without discarding solved package state.

Monorepo support

Workspace scanning walks the tree for pyproject.toml files while ignoring common generated directories such as .git, .venv, dist, build, and node_modules.

This makes it suitable for:

  • repository-wide validation in CI
  • reporting planned lock targets for many packages
  • standardizing lock metadata conventions across multiple subprojects

Validation rules

Validation currently checks:

  • group/extra normalization collisions
  • target filename collisions
  • nonstandard pylock filenames
  • missing lockfiles
  • drift between pyproject.toml metadata and existing pylock*.toml metadata

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

pylock_bridge-1.0.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

pylock_bridge-1.0.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file pylock_bridge-1.0.1.tar.gz.

File metadata

  • Download URL: pylock_bridge-1.0.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylock_bridge-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e3de15416f796d85f913456fa5e4eb4a52193e3076f6745f65334f0f73125a73
MD5 8d423c2f6d5a4260f2e1ed97659d53a1
BLAKE2b-256 076ca8a09a264439e0b00946637b74d451582e32ab59dbf02d3f52691948f619

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylock_bridge-1.0.1.tar.gz:

Publisher: publish.yml on Halfblood-Prince/pylock-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylock_bridge-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pylock_bridge-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylock_bridge-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2bbcffc43bb0462279f0ce2a1557990ca0044c0d3becde06f8a30affa613228e
MD5 c9933377d57cdb1e120a7904a77ee6b8
BLAKE2b-256 4a2adc81afb901a46007915bc8ca0d29e017daa06a04529ebb4cf8944b2420b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylock_bridge-1.0.1-py3-none-any.whl:

Publisher: publish.yml on Halfblood-Prince/pylock-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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