{"id":18743569,"url":"https://github.com/stephen-ra-king/piptools-sync","last_synced_at":"2025-04-12T21:32:20.240Z","repository":{"id":53937353,"uuid":"520581946","full_name":"Stephen-RA-King/piptools-sync","owner":"Stephen-RA-King","description":"A pre-commit plugin that syncs the pre-commit package versions with the versions generated by pip-tools ","archived":false,"fork":false,"pushed_at":"2025-04-07T20:18:40.000Z","size":169,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T07:44:47.340Z","etag":null,"topics":["dependency-manager","pip-tools","pre-commit","pre-commit-hooks","python3","version-sync"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stephen-RA-King.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-02T17:01:43.000Z","updated_at":"2024-01-20T23:18:29.000Z","dependencies_parsed_at":"2023-02-14T17:35:15.050Z","dependency_job_id":"b0d2abb1-3979-4a66-9292-c8537dd4b758","html_url":"https://github.com/Stephen-RA-King/piptools-sync","commit_stats":{"total_commits":107,"total_committers":4,"mean_commits":26.75,"dds":0.03738317757009346,"last_synced_commit":"d35acb42ffc81442825352e57652d741b9f11b5c"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephen-RA-King%2Fpiptools-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephen-RA-King%2Fpiptools-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephen-RA-King%2Fpiptools-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephen-RA-King%2Fpiptools-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stephen-RA-King","download_url":"https://codeload.github.com/Stephen-RA-King/piptools-sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248636036,"owners_count":21137358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-manager","pip-tools","pre-commit","pre-commit-hooks","python3","version-sync"],"created_at":"2024-11-07T16:11:49.546Z","updated_at":"2025-04-12T21:32:19.940Z","avatar_url":"https://github.com/Stephen-RA-King.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Piptools-sync\n\n---\n\n_**A pre-commit plugin to align pre-commit repository versions with those derived by pip-tools.**_\n\n[![PyPI][pypi-image]][pypi-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Status][status-image]][pypi-url]\n[![Python Version][python-version-image]][pypi-url]\n[![tests][tests-image]][tests-url]\n[![Codecov][codecov-image]][codecov-url]\n[![CodeQl][codeql-image]][codeql-url]\n[![pre-commit.ci status][pre-commit.ci-image]][pre-commit.ci-url]\n[![readthedocs][readthedocs-image]][readthedocs-url]\n[![CodeFactor][codefactor-image]][codefactor-url]\n[![Codeclimate][codeclimate-image]][codeclimate-url]\n[![Imports: isort][isort-image]][isort-url]\n[![Code style: black][black-image]][black-url]\n[![Checked with mypy][mypy-image]][mypy-url]\n[![security: bandit][bandit-image]][bandit-url]\n[![Commitizen friendly][commitizen-image]][commitizen-url]\n[![Conventional Commits][conventional-commits-image]][conventional-commits-url]\n[![DeepSource][deepsource-image]][deepsource-url]\n[![license][license-image]][license-url]\n[![pydough][pydough-image]][pydough-url]\n\n\u003c!-- [![OpenSSFScorecard][openssf-image]][openssf-url] --\u003e\n\n[**pip-tools**][pip-tools-url] and [**Pre-Commit**][pre-commit-url] are two of my favourite development tools. However, they don't always necessarily agree\non what versions of packages should be installed.\nThis lack of consolidation can lead to problems with pre-commit.\nThis pre-commit plugin syncs the pre-commit package versions with the versions generated by pip-tools' compile process.\n\n![](assets/header.png)\n\n## Introduction\n\n---\n\n### Project Rationale\n\nA while ago I came across an issue committing files to my local git repository. The issue occured at the flake8 linting stage using pre-commit.\nThere was however no problem manually running flake8 from the command line. Upon investigation It was found that flake8 had an\nincompatibility issue with one of its plugins.\nWith further investigation I noticed that pip-tools had pinned flake8 to an earlier version to what pre-commit was caching.\n\nIn short - pip-tools does a spectacularly good job pinning your dependencies and the dependencies of these dependencies. It has one job to do and it does it perfectly.\nThe pre-commit autoupdate command just updates the \"rev\" for the \"repo\" in the .pre-commit-config.yaml file to the latest version available and ignores the dependencies.\n\nThe following example displays the way flake8 and a few plugins are configured by the two tools :\n\n-   pip-tools (via requirements.txt)\n\n```shell\nflake8==4.0.1\n    # via ...\nflake8-bugbear==22.8.23\n    # via ...\nflake8-comprehensions==3.10.0\n    # via ...\nflake8-eradicate==1.3.0\n    # via ...\nflake8-simplify==0.19.3\n    # via ...\n```\n\n-   pre-commit (via .pre-commit-config.yaml)\n\n```shell\n  - repo: https://github.com/pycqa/flake8\n    rev 5.0.4\n    hooks:\n      - id: flake8\n        additional_dependencies:\n          - flake8-bugbear\n          - flake8-comprehensions\n          - flake8-eradicate\n          - flake8-simplify\n        args: [\"--ignore=E800,F842,F841,W503\"]\n```\n\nIf we force pip-tools to use a later version of flake8 (e,g 5.0.4) by manually pinning the version in the \".in\" file and recompiling it is clear pip-tools is unhappy... A quick look at the dependencies shows why.\n\n```shell\nCould not find a version that matches flake8!=3.2.0,\u003c5.0.0,\u003c6,==5.0.4,\u003e=3.0.0,\u003e=3.3.0,\u003e=3.5,\u003e=3.7,\u003e=3.9.1,\u003e=4.0.1 (from -r requirements\\development.in (line 12))\nTried: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.3.1, 1.4, 1.5, 1.6, 1.6.1, 1.6.2, 1.7.0, 2.0, 2.1.0, 2.2.0, 2.2.0, 2.2.1, 2.2.1, 2.2.2, 2.2.2, 2.2.3, 2.2.3, 2.2.4, 2.2.5, 2.3.0, 2.3.0, 2.4.0, 2.4.0, 2.4.1, 2.4.1, 2.5.0, 2.5.0, 2.5.1, 2.5.1, 2.5.2, 2.5.2, 2.5.3, 2.5.3, 2.5.4, 2.5.4, 2.5.5, 2.5.5, 2.6.0, 2.6.0, 2.6.1, 2.6.1, 2.6.2, 2.6.2, 3.0.0, 3.0.0, 3.0.1, 3.0.1, 3.0.2, 3.0.2, 3.0.3, 3.0.3, 3.0.4, 3.0.4, 3.1.0, 3.1.0, 3.1.1, 3.1.1, 3.2.0, 3.2.0, 3.2.1, 3.2.1, 3.3.0, 3.3.0, 3.4.0, 3.4.0, 3.4.1, 3.4.1, 3.5.0, 3.5.0, 3.6.0, 3.6.0, 3.7.0, 3.7.0, 3.7.1, 3.7.1, 3.7.2, 3.7.2, 3.7.3, 3.7.3, 3.7.4, 3.7.4, 3.7.5, 3.7.5, 3.7.6, 3.7.6, 3.7.7, 3.7.7, 3.7.8, 3.7.8, 3.7.9, 3.7.9, 3.8.0, 3.8.0, 3.8.1, 3.8.1, 3.8.2, 3.8.2, 3.8.3, 3.8.3, 3.8.4, 3.8.4, 3.9.0, 3.9.0, 3.9.1, 3.9.1, 3.9.2, 3.9.2, 4.0.0, 4.0.0, 4.0.1, 4.0.1, 5.0.0, 5.0.0, 5.0.1, 5.0.1, 5.0.2, 5.0.2, 5.0.3, 5.0.3, 5.0.4, 5.0.4\nSkipped pre-versions: 3.0.0b1, 3.0.0b1, 3.0.0b2, 3.0.0b2, 3.0.2.dev0, 3.0.2.dev0, 3.0.2.dev1, 3.3.0.dev0, 3.8.0a1, 3.8.0a1, 3.8.0a2, 3.8.0a2\nThere are incompatible versions in the resolved dependencies:\n  flake8==5.0.4 (from -r requirements\\development.in (line 12))\n  flake8\u003e=3.7 (from flake8-simplify==0.19.3-\u003e-r requirements\\development.in (line 20))\n  flake8\u003c5.0.0 (from flake8-bugbear==22.8.23-\u003e-r requirements\\development.in (line 14))\n  flake8!=3.2.0,\u003e=3.0 (from flake8-comprehensions==3.10.0-\u003e-r requirements\\development.in (line 15))\n  flake8\u003c6,\u003e=3.5 (from flake8-eradicate==1.3.0-\u003e-r requirements\\development.in (line 17))\n```\n\nThe tools store packages in different areas on the file system. Pre-commit uses a cache area in the user folder, whereas pip-tools uses the usual site-packages area.\n\nIt should be noted that not all pre-commit hooks are written in Python for Python, so it makes sense that it has its own cache file system independent of pip.\nTherefore, not all pre-commit repositories have an entry in PyPI. They can simply be defined by a GitHub repository URL.\n\nLastly, browsing the internet looking for a solution I came across the following issue raised under the pip-tools project (dated 24 Jun 2021).\nThe issue is still open and describes the exact same problem.\n\nhttps://github.com/jazzband/pip-tools/issues/1437\n\n## Installation\n\n---\n\n### 1 - Install into pre-commit\n\nJust add to the pre-commit configuration file (.pre-commit-config.yaml).\nI have configured it to run at every commit at the pre-commit stage of git.\n\n```shell\n  - repo: https://github.com/Stephen-RA-King/piptools-sync\n    rev: 0.3.1\n    hooks:\n      - id: piptools_sync\n```\n\n### 2 - Install by pip\n\nInstalling by pip enables the package to be run from the command line at any time.\n\n```sh\npip install piptools-sync\n```\n\n## Usage\n\n---\n\n### 1 - Automatic running by pre-commit\n\nPassing example.\n\n```shell\npiptools_sync............................................................Passed\n```\n\nFailing example.\n\n```shell\npiptools_sync............................................................Failed\n- hook id: piptools_sync\n- exit code: 1\n- files were modified by this hook\n\nINFO:init:flake8          - piptools: 4.0.1      !=     pre-commit: 5.0.4\n```\n\nNote: In this case piptools-sync will automatically update the pre-commit config file with pip-tools version.\nHowever, the commit with fail and will need to be re-run.\n\n### 2 - Running from the command line\n\nPassing example.\n\n```shell\n$ piptools_sync\nSuccess! - pre-commit is in sync with piptools\n```\n\nFailing example.\n\n```shell\n$ piptools_sync\nflake8          - piptools: 4.0.1      !=     pre-commit: 5.0.4\n```\n\nNote: In this case piptools-sync will automatically update the pre-commit config file with pip-tools version\n\n_For more examples and usage, please refer to the [Wiki][wiki]._\n\n## Documentation\n\n---\n\n[**Read the Docs**](https://piptools-sync.readthedocs.io/en/latest/?)\n\n-   [**Example Usage**](https://piptools-sync.readthedocs.io/en/latest/example.html)\n-   [**Credits**](https://piptools-sync.readthedocs.io/en/latest/example.html)\n-   [**Changelog**](https://piptools-sync.readthedocs.io/en/latest/changelog.html)\n-   [**API Reference**](https://piptools-sync.readthedocs.io/en/latest/autoapi/index.html)\n\n[**Wiki**](https://github.com/Stephen-RA-King/piptools-sync/wiki)\n\n## Future Enhancements\n\n---\n\n-   Move some global variables into a separate settings file (toml).\n-   Settings configurable from the command line (and therefore configurable from the pre-commit.yaml file).\n-   Improve web request performance with asyncio / aiohttp libraries.\n\n## Meta\n\n---\n\n[![](assets/linkedin.png)](https://www.linkedin.com/in/sr-king)\n[![](assets/github.png)](https://github.com/Stephen-RA-King)\n[![](assets/pypi.png)](https://pypi.org/project/piptools-sync)\n[![](assets/www.png)](https://stephen-ra-king.github.io/justpython/)\n[![](assets/email.png)](mailto:sking.github@gmail.com)\n\nStephen R A King : [sking.github@gmail.com](mailto:sking.github@gmail.com)\n\nDistributed under the MIT license. See [![][license-image]][license-url] for more information.\n\nCreated with Cookiecutter template: [![pydough][pydough-image]][pydough-url] version 1.2.1\n\nDigital Object Identifier: [![DOI](https://zenodo.org/badge/520581946.svg)](https://zenodo.org/badge/latestdoi/520581946)\n\n\u003c!-- Markdown link \u0026 img dfn's --\u003e\n\n[bandit-image]: https://img.shields.io/badge/security-bandit-yellow.svg\n[bandit-url]: https://github.com/PyCQA/bandit\n[black-image]: https://img.shields.io/badge/code%20style-black-000000.svg\n[black-url]: https://github.com/psf/black\n[codeclimate-image]: https://api.codeclimate.com/v1/badges/9543c409696e9976a987/maintainability\n[codeclimate-url]: https://codeclimate.com/github/Stephen-RA-King/piptools-sync/maintainability\n[codecov-image]: https://codecov.io/gh/Stephen-RA-King/piptools-sync/branch/main/graph/badge.svg\n[codecov-url]: https://app.codecov.io/gh/Stephen-RA-King/piptools-sync\n[codefactor-image]: https://www.codefactor.io/repository/github/Stephen-RA-King/piptools-sync/badge\n[codefactor-url]: https://www.codefactor.io/repository/github/Stephen-RA-King/piptools-sync\n[codeql-image]: https://github.com/Stephen-RA-King/piptools-sync/actions/workflows/github-code-scanning/codeql/badge.svg\n[codeql-url]: https://github.com/Stephen-RA-King/piptools-sync/actions/workflows/github-code-scanning/codeql\n[commitizen-image]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square\n[conventional-commits-url]: https://conventionalcommits.org\n[deepsource-image]: https://app.deepsource.com/gh/Stephen-RA-King/piptools-sync.svg/?label=active+issues\u0026show_trend=true\u0026token=SGo-Vr17NUYVQaEWkU9rBb6Y\n[deepsource-url]: https://app.deepsource.com/gh/Stephen-RA-King/piptools-sync/?ref=repository-badge\n[docker-image]: https://github.com/Stephen-RA-King/piptools-sync/actions/workflows/docker-image.yml/badge.svg\n[docker-url]: https://github.com/Stephen-RA-King/piptools-sync/actions/workflows/docker-image.yml\n[downloads-image]: https://static.pepy.tech/personalized-badge/piptools-sync?period=total\u0026units=international_system\u0026left_color=black\u0026right_color=orange\u0026left_text=Downloads\n[downloads-url]: https://pepy.tech/project/piptools-sync\n[format-image]: https://img.shields.io/pypi/format/piptools-sync\n[isort-image]: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat\u0026labelColor=ef8336\n[isort-url]: https://github.com/pycqa/isort/\n[lgtm-alerts-image]: https://img.shields.io/lgtm/alerts/g/Stephen-RA-King/piptools-sync.svg?logo=lgtm\u0026logoWidth=18\n[lgtm-alerts-url]: https://lgtm.com/projects/g/Stephen-RA-King/piptools-sync/alerts/\n[lgtm-quality-image]: https://img.shields.io/lgtm/grade/python/g/Stephen-RA-King/piptools-sync.svg?logo=lgtm\u0026logoWidth=18\n[lgtm-quality-url]: https://lgtm.com/projects/g/Stephen-RA-King/piptools-sync/context:python\n[license-image]: https://img.shields.io/pypi/l/piptools-sync\n[license-url]: https://github.com/Stephen-RA-King/piptools-sync/blob/main/LICENSE\n[mypy-image]: http://www.mypy-lang.org/static/mypy_badge.svg\n[mypy-url]: http://mypy-lang.org/\n[openssf-image]: https://api.securityscorecards.dev/projects/github.com/Stephen-RA-King/piptools-sync/badge\n[openssf-url]: https://api.securityscorecards.dev/projects/github.com/Stephen-RA-King/piptools-sync\n[pip-tools-url]: https://github.com/jazzband/pip-tools/\n[pre-commit-image]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white\n[pre-commit-url]: https://github.com/pre-commit/pre-commit\n[pre-commit.ci-image]: https://results.pre-commit.ci/badge/github/Stephen-RA-King/piptools-sync/main.svg\n[pre-commit.ci-url]: https://results.pre-commit.ci/latest/github/Stephen-RA-King/piptools-sync/main\n[pydough-image]: https://img.shields.io/badge/pydough-2023-orange\n[pydough-url]: https://github.com/Stephen-RA-King/pydough\n[pypi-image]: https://img.shields.io/pypi/v/piptools-sync.svg\n[pypi-url]: https://pypi.org/project/piptools-sync/\n[python-version-image]: https://img.shields.io/pypi/pyversions/piptools-sync\n[readthedocs-image]: https://readthedocs.org/projects/piptools-sync/badge/?version=latest\n[readthedocs-url]: https://piptools-sync.readthedocs.io/en/latest/?badge=latest\n[status-image]: https://img.shields.io/pypi/status/piptools-sync.svg\n[tests-image]: https://github.com/Stephen-RA-King/piptools-sync/actions/workflows/tests.yml/badge.svg\n[tests-url]: https://github.com/Stephen-RA-King/piptools-sync/actions/workflows/tests.yml\n[wiki]: https://github.com/Stephen-RA-King/piptools-sync/wiki\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephen-ra-king%2Fpiptools-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephen-ra-king%2Fpiptools-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephen-ra-king%2Fpiptools-sync/lists"}