# sync-with-uv
[![Tests][tests-badge]][tests-link]
[![uv][uv-badge]][uv-link]
[![Ruff][ruff-badge]][ruff-link]
[![Black][black-badge]][black-link]
[![codecov][codecov-badge]][codecov-link]
\
[![PyPI version][pypi-version-badge]][pypi-link]
[![PyPI platforms][pypi-platforms-badge]][pypi-link]
[![Total downloads][pepy-badge]][pepy-link]
\
[![Made Using tsvikas/python-template][template-badge]][template-link]
[![GitHub Discussion][github-discussions-badge]][github-discussions-link]
[![PRs Welcome][prs-welcome-badge]][prs-welcome-link]
## Overview
[PEP 735](https://peps.python.org/pep-0735/) introduces dependency groups in `pyproject.toml`,
allowing tools like black, ruff, and mypy to be managed centrally.
However, when these tools are also used in pre-commit hooks,
keeping versions in sync between `uv.lock` and `.pre-commit-config.yaml` can be tedious.
This package automatically updates the versions of dependencies in `.pre-commit-config.yaml` to match their versions in `uv.lock`,
ensuring everything stays aligned and is managed from a single source.
Any tool not specified in `uv.lock` remains managed by `.pre-commit-config.yaml`.
Simply add this pre-commit hook to your setup and enjoy consistent dependency management.
## Usage
**Recommended: Use as a pre-commit hook**
Simply add these lines to your `.pre-commit-config.yaml` file:
```yaml
- repo: https://github.com/tsvikas/sync-with-uv
rev: main # replace with the latest version
hooks:
- id: sync-with-uv
```
That's it! The hook will automatically keep your pre-commit versions in sync with `uv.lock`.
### Alternative: Command Line Interface
For manual usage or CI/CD integration, install and run directly:
```bash
pipx install sync-with-uv
# Update .pre-commit-config.yaml
sync-with-uv
# Preview changes only
sync-with-uv --diff
# Custom file paths
sync-with-uv -p custom-precommit.yaml -u custom-lock.toml
```
## Advanced Configuration
Most users don't need this section - the tool works out of the box with popular tools like black, ruff, and mypy.
### Custom Repository Mappings
For tools not included in the built-in mapping, you can add custom mappings in your `pyproject.toml`:
```toml
# Map repository URLs to package names
[tool.sync-with-uv.repo-to-package]
"https://github.com/myorg/my-awesome-linter" = "awesome-linter"
# Define custom version templates (optional)
[tool.sync-with-uv.repo-to-version-template]
"https://github.com/myorg/my-awesome-linter" = "ver_${rev}"
```
**Example scenario:**
- Your `.pre-commit-config.yaml` has: `repo: https://github.com/myorg/my-awesome-linter` with `rev: 1.2.0`
- Your `uv.lock` contains: `awesome-linter = "1.5.0"`
- With the mapping above, sync-with-uv will update the pre-commit version to `ver_1.5.0`
## Contributing
Interested in contributing?
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guideline.
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg
[black-link]: https://github.com/psf/black
[codecov-badge]: https://codecov.io/gh/tsvikas/sync-with-uv/graph/badge.svg
[codecov-link]: https://codecov.io/gh/tsvikas/sync-with-uv
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
[github-discussions-link]: https://github.com/tsvikas/sync-with-uv/discussions
[pepy-badge]: https://img.shields.io/pepy/dt/sync-with-uv
[pepy-link]: https://pepy.tech/project/sync-with-uv
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
[prs-welcome-link]: https://opensource.guide/how-to-contribute/
[pypi-link]: https://pypi.org/project/sync-with-uv/
[pypi-platforms-badge]: https://img.shields.io/pypi/pyversions/sync-with-uv
[pypi-version-badge]: https://img.shields.io/pypi/v/sync-with-uv
[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
[ruff-link]: https://github.com/astral-sh/ruff
[template-badge]: https://img.shields.io/badge/%F0%9F%9A%80_Made_Using-tsvikas%2Fpython--template-gold
[template-link]: https://github.com/tsvikas/python-template
[tests-badge]: https://github.com/tsvikas/sync-with-uv/actions/workflows/ci.yml/badge.svg
[tests-link]: https://github.com/tsvikas/sync-with-uv/actions/workflows/ci.yml
[uv-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json
[uv-link]: https://github.com/astral-sh/uv
Raw data
{
"_id": null,
"home_page": null,
"name": "sync-with-uv",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "automation, dependency-management, developer-tools, pre-commit, python-packaging, uv, version-sync",
"author": null,
"author_email": "Tsvika Shapira <tsvikas@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ad/45/c7faf72394590dcb0487d0bcf0d446f8d8bc0f22eefac6363f196859a2b7/sync_with_uv-0.3.1.tar.gz",
"platform": null,
"description": "# sync-with-uv\n\n[![Tests][tests-badge]][tests-link]\n[![uv][uv-badge]][uv-link]\n[![Ruff][ruff-badge]][ruff-link]\n[![Black][black-badge]][black-link]\n[![codecov][codecov-badge]][codecov-link]\n\\\n[![PyPI version][pypi-version-badge]][pypi-link]\n[![PyPI platforms][pypi-platforms-badge]][pypi-link]\n[![Total downloads][pepy-badge]][pepy-link]\n\\\n[![Made Using tsvikas/python-template][template-badge]][template-link]\n[![GitHub Discussion][github-discussions-badge]][github-discussions-link]\n[![PRs Welcome][prs-welcome-badge]][prs-welcome-link]\n\n## Overview\n\n[PEP 735](https://peps.python.org/pep-0735/) introduces dependency groups in `pyproject.toml`,\nallowing tools like black, ruff, and mypy to be managed centrally.\nHowever, when these tools are also used in pre-commit hooks,\nkeeping versions in sync between `uv.lock` and `.pre-commit-config.yaml` can be tedious.\n\nThis package automatically updates the versions of dependencies in `.pre-commit-config.yaml` to match their versions in `uv.lock`,\nensuring everything stays aligned and is managed from a single source.\nAny tool not specified in `uv.lock` remains managed by `.pre-commit-config.yaml`.\n\nSimply add this pre-commit hook to your setup and enjoy consistent dependency management.\n\n## Usage\n\n**Recommended: Use as a pre-commit hook**\n\nSimply add these lines to your `.pre-commit-config.yaml` file:\n\n```yaml\n- repo: https://github.com/tsvikas/sync-with-uv\n rev: main # replace with the latest version\n hooks:\n - id: sync-with-uv\n```\n\nThat's it! The hook will automatically keep your pre-commit versions in sync with `uv.lock`.\n\n### Alternative: Command Line Interface\n\nFor manual usage or CI/CD integration, install and run directly:\n\n```bash\npipx install sync-with-uv\n\n# Update .pre-commit-config.yaml\nsync-with-uv\n\n# Preview changes only\nsync-with-uv --diff\n\n# Custom file paths\nsync-with-uv -p custom-precommit.yaml -u custom-lock.toml\n```\n\n## Advanced Configuration\n\nMost users don't need this section - the tool works out of the box with popular tools like black, ruff, and mypy.\n\n### Custom Repository Mappings\n\nFor tools not included in the built-in mapping, you can add custom mappings in your `pyproject.toml`:\n\n```toml\n# Map repository URLs to package names\n[tool.sync-with-uv.repo-to-package]\n\"https://github.com/myorg/my-awesome-linter\" = \"awesome-linter\"\n\n# Define custom version templates (optional)\n[tool.sync-with-uv.repo-to-version-template]\n\"https://github.com/myorg/my-awesome-linter\" = \"ver_${rev}\"\n```\n\n**Example scenario:**\n\n- Your `.pre-commit-config.yaml` has: `repo: https://github.com/myorg/my-awesome-linter` with `rev: 1.2.0`\n- Your `uv.lock` contains: `awesome-linter = \"1.5.0\"`\n- With the mapping above, sync-with-uv will update the pre-commit version to `ver_1.5.0`\n\n## Contributing\n\nInterested in contributing?\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guideline.\n\n[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg\n[black-link]: https://github.com/psf/black\n[codecov-badge]: https://codecov.io/gh/tsvikas/sync-with-uv/graph/badge.svg\n[codecov-link]: https://codecov.io/gh/tsvikas/sync-with-uv\n[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github\n[github-discussions-link]: https://github.com/tsvikas/sync-with-uv/discussions\n[pepy-badge]: https://img.shields.io/pepy/dt/sync-with-uv\n[pepy-link]: https://pepy.tech/project/sync-with-uv\n[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg\n[prs-welcome-link]: https://opensource.guide/how-to-contribute/\n[pypi-link]: https://pypi.org/project/sync-with-uv/\n[pypi-platforms-badge]: https://img.shields.io/pypi/pyversions/sync-with-uv\n[pypi-version-badge]: https://img.shields.io/pypi/v/sync-with-uv\n[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n[ruff-link]: https://github.com/astral-sh/ruff\n[template-badge]: https://img.shields.io/badge/%F0%9F%9A%80_Made_Using-tsvikas%2Fpython--template-gold\n[template-link]: https://github.com/tsvikas/python-template\n[tests-badge]: https://github.com/tsvikas/sync-with-uv/actions/workflows/ci.yml/badge.svg\n[tests-link]: https://github.com/tsvikas/sync-with-uv/actions/workflows/ci.yml\n[uv-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json\n[uv-link]: https://github.com/astral-sh/uv\n",
"bugtrack_url": null,
"license": null,
"summary": "Sync '.pre-commit-config.yaml' from 'uv.lock'.",
"version": "0.3.1",
"project_urls": {
"source": "https://github.com/tsvikas/sync-with-uv"
},
"split_keywords": [
"automation",
" dependency-management",
" developer-tools",
" pre-commit",
" python-packaging",
" uv",
" version-sync"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b945f39f02403e84c161061e35f8094e18a8ae6e539d92fde97d023b69670c5b",
"md5": "8be95e5b61980ec867532fa8d751ab52",
"sha256": "49ea8318ab066e310dc3a0cd52519686e4a48ccac4ff12a3e9bf0aa28498b872"
},
"downloads": -1,
"filename": "sync_with_uv-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8be95e5b61980ec867532fa8d751ab52",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 8684,
"upload_time": "2025-08-30T23:55:55",
"upload_time_iso_8601": "2025-08-30T23:55:55.056738Z",
"url": "https://files.pythonhosted.org/packages/b9/45/f39f02403e84c161061e35f8094e18a8ae6e539d92fde97d023b69670c5b/sync_with_uv-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ad45c7faf72394590dcb0487d0bcf0d446f8d8bc0f22eefac6363f196859a2b7",
"md5": "b25bec5d0e7b77a04fd1288a6e7eb55a",
"sha256": "08ec894c67e2c8c80857ec5d6f2fb43da2a7b91c78107f910f99c0a38fe9411f"
},
"downloads": -1,
"filename": "sync_with_uv-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "b25bec5d0e7b77a04fd1288a6e7eb55a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 60177,
"upload_time": "2025-08-30T23:55:56",
"upload_time_iso_8601": "2025-08-30T23:55:56.906403Z",
"url": "https://files.pythonhosted.org/packages/ad/45/c7faf72394590dcb0487d0bcf0d446f8d8bc0f22eefac6363f196859a2b7/sync_with_uv-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-30 23:55:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tsvikas",
"github_project": "sync-with-uv",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sync-with-uv"
}