Skip to main content

Pin all dependencies in pyproject.toml to their currently installed versions

Project description

pin-versions

A CLI tool and pre-commit hook that pins all unpinned dependencies in pyproject.toml to their currently installed versions.

Installation

pip install pin-versions

Or with uv:

uv add pin-versions

Usage

Run in a project directory with a pyproject.toml and a virtual environment:

pin-versions

This pins dependencies in [project].dependencies, [project.optional-dependencies], and [dependency-groups].

Options

Flag Description
--operator, -o Version pin operator (default: ==). Supports >=, ~=, etc.
--pyproject, -p Path to pyproject.toml (default: ./pyproject.toml)
--venv Path to the virtual environment (default: .venv)
--pin-latest Pin uninstalled packages to their latest version on PyPI
--dry-run Preview changes without modifying the file

Pre-commit hook

Add to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/kjaymiller/pin-versions
    rev: v0.1.0
    hooks:
      - id: pin-versions

Contributing

  1. Fork the repo and clone it locally.
  2. Create a virtual environment and install the project in editable mode:
    uv venv && uv pip install -e ".[dev]"
    
  3. Create a branch for your changes:
    git checkout -b my-feature
    
  4. Make your changes and ensure they work by running:
    pin-versions --dry-run
    
  5. Open a pull request against main.

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

pin_versions-0.0.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

pin_versions-0.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pin_versions-0.0.0.tar.gz.

File metadata

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

File hashes

Hashes for pin_versions-0.0.0.tar.gz
Algorithm Hash digest
SHA256 18303f43f320015bd10582bf0bf3ac3e4bde7a04cb91f346ff1ae7c8aa85167e
MD5 0a922145269666d65528f0166601e7ff
BLAKE2b-256 5290a47d2aa98a3f5166bfd5ea166ac07e832fc16e6f6fd6056ac2a2b80d47ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pin_versions-0.0.0.tar.gz:

Publisher: publish.yml on kjaymiller/pin-versions

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

File details

Details for the file pin_versions-0.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pin_versions-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5195e8a829ae07401f7966c66ed2c203c581ecb5a24770c94dc0944695014a42
MD5 dbdabab955c008bcf66ef6abf207e116
BLAKE2b-256 de738aae4e20100fdc9b340b097d477e30df0a32c39e3a7c87ce0d652ba4e35b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pin_versions-0.0.0-py3-none-any.whl:

Publisher: publish.yml on kjaymiller/pin-versions

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