{"id":13764436,"url":"https://github.com/floatingpurr/sync_with_pdm","last_synced_at":"2025-05-10T19:31:14.683Z","repository":{"id":51164670,"uuid":"517696601","full_name":"floatingpurr/sync_with_pdm","owner":"floatingpurr","description":"Sync .pre-commit-config.yaml repos starting from pdm.lock","archived":false,"fork":false,"pushed_at":"2025-03-31T19:48:46.000Z","size":53,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T20:35:42.143Z","etag":null,"topics":["package-manager","pre-commit","pre-commit-hook","python"],"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/floatingpurr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-25T14:22:07.000Z","updated_at":"2024-12-03T00:11:58.000Z","dependencies_parsed_at":"2023-02-16T15:15:49.047Z","dependency_job_id":"d7aa9003-fb30-4a55-b3ea-c2c91d8bac9e","html_url":"https://github.com/floatingpurr/sync_with_pdm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatingpurr%2Fsync_with_pdm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatingpurr%2Fsync_with_pdm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatingpurr%2Fsync_with_pdm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatingpurr%2Fsync_with_pdm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatingpurr","download_url":"https://codeload.github.com/floatingpurr/sync_with_pdm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253470764,"owners_count":21913729,"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":["package-manager","pre-commit","pre-commit-hook","python"],"created_at":"2024-08-03T16:00:20.585Z","updated_at":"2025-05-10T19:31:14.338Z","avatar_url":"https://github.com/floatingpurr.png","language":"Python","funding_links":[],"categories":["Eco-system"],"sub_categories":[],"readme":"# Sync with PDM\n\n[![CI](https://github.com/floatingpurr/sync_with_pdm/actions/workflows/ci.yml/badge.svg)](https://github.com/floatingpurr/sync_with_pdm/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/floatingpurr/sync_with_pdm/branch/main/graph/badge.svg?token=COBYtxAODG)](https://codecov.io/gh/floatingpurr/sync_with_pdm)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/floatingpurr/sync_with_pdm/main.svg)](https://results.pre-commit.ci/latest/github/floatingpurr/sync_with_pdm/main)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)\n\nA .pre-commit hook for keeping in sync the repos `rev` in\n`.pre-commit-config.yaml` with the packages version locked into `pdm.lock`.\nCheck out [pre-commit.com](https://pre-commit.com/) for more about the main\nframework.\n\n\u003e Do you rely on [Poetry](https://github.com/python-poetry/poetry)? See this\n\u003e equivalent sync repo:\n\u003e [sync_with_poetry](https://github.com/floatingpurr/sync_with_poetry).\n\n## What problem does this hook help us solve?\n\n[PDM](https://pdm.fming.dev) is a modern Python package and dependency manager\nsupporting the latest PEP standards.\n[Sometimes](https://stackoverflow.com/q/70127649/4820341), you might want to\ninstall dev dependencies locally (e.g., `black`, `flake8`, `isort`, `mypy`, ...)\nto make your IDE (e.g., VS Code) play nicely with dev packages. This approach\nusually turns on a live feedback as you code (e.g., suggestions, linting,\nformatting, errors highlighting). PDM pins dev packages in `pdm.lock`.\n\nThis hook updates the `rev` of each `repo` in `.pre-commit-config.yaml` with the\ncorresponding package version stored in `pdm.lock`.\n\nE.g., starting from the following files:\n\n```toml\n# pdm.lock\n[[package]]\nname = \"black\"\nversion = \"21.12b0\"\n# ...\n```\n\n```yaml\n# .pre-commit-config.yaml\nrepos:\n  # black - formatting\n  - repo: https://github.com/psf/black\n    rev: 21.11b1\n    hooks:\n      - id: black\n```\n\nthis hook will bump `black` in `.pre-commit-config.yaml` as follows:\n\n```yaml\n# .pre-commit-config.yaml\nrepos:\n  # black - formatting\n  - repo: https://github.com/psf/black\n    rev: 21.12b0\n    hooks:\n      - id: black\n```\n\n## Usage\n\nExcerpt from a `.pre-commit-config.yaml` using an example of this hook:\n\n```yaml\n- repo: https://github.com/floatingpurr/sync_with_pdm\n  rev: \"\" # the revision or tag to clone at\n  hooks:\n    - id: sync_with_pdm\n      args: [] # optional args\n```\n\n### Args\n\n```\n  --all              Scan all dependencies in pdm.lock (main, optional and dev)\n  --skip [SKIP ...]  Packages to skip\n  --config CONFIG    Path to a custom .pre-commit-config.yaml file\n  --db PACKAGE_LIST  Path to a custom package list (json)\n```\n\nUsually this hook uses only dev packages to sync the hooks. Pass `--all`, if you\nwant to scan also the main project packages.\n\nPass `--skip \u003cpackage_1\u003e \u003cpackage_2\u003e ...` to disable the automatic\nsynchronization of the repos such packages correspond to.\n\nPass `--config \u003cconfig_file\u003e` to point to an alternative config file (it\ndefaults to `.pre-commit-config.yaml`).\n\nPass `--db \u003cpackage_list_file\u003e` to point to an alternative package list (json).\nSuch a file overrides the mapping in [`db.py`](sync_with_pdm/db.py).\n\n## Supported packages\n\nSupported packages out-of-the-box are listed in [`db.py`](sync_with_pdm/db.py):\n\n- autopep8\n- bandit\n- black\n- commitizen\n- flake8\n- flakeheaven\n- isort\n- mypy\n- pyupgrade\n\nFrom version `0.4.0`, you can create your very own package list, passing a\ncustom json file with the arg `--db`. Such a file specifies how to map a package\nto the corresponding repo, following this pattern:\n\n```json\n{\n  \"\u003cpackage_name_in_PyPI\u003e\": {\n    \"repo\": \"\u003crepo_url_for_the_package\u003e\",\n    \"rev\": \"\u003crevision_template\u003e\"\n  }\n}\n```\n\nSometimes the template of the version number of a package in PyPI differs from\nthe one used in the repo `rev`. For example, version `0.910` of `mypy` in PyPI\n(no pun intended) maps to repo `rev: v0.910`. To make this hook aware of the\nleading `v`, you need to specify `\"v${rev}\"` as a `\"\u003crevision_template\u003e\"`. Use\n`\"${rev}\"` if both the package version and the repo `rev` follow the same\npattern.\n\nPRs extending [`db.py`](sync_with_pdm/db.py) are welcome.\n\n## Contributing\n\nSee [CONTRIBUTING.md](.github/CONTRIBUTING.md).\n\n## Credits\n\nThis hook is inspired by\n[pre-commit autoupdate](https://pre-commit.com/index.html#pre-commit-autoupdate).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatingpurr%2Fsync_with_pdm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatingpurr%2Fsync_with_pdm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatingpurr%2Fsync_with_pdm/lists"}