pre-commit-uv


Namepre-commit-uv JSON
Version 4.1.4 PyPI version JSON
download
home_pageNone
SummaryRun pre-commit with uv
upload_time2024-10-29 23:07:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords format pyproject
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pre-commit-uv

[![PyPI](https://img.shields.io/pypi/v/pre-commit-uv?style=flat-square)](https://pypi.org/project/pre-commit-uv)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pre-commit-uv?style=flat-square)](https://pypi.org/project/pre-commit-uv)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pre-commit-uv?style=flat-square)](https://pypi.org/project/pre-commit-uv)
[![Downloads](https://static.pepy.tech/badge/pre-commit-uv/month)](https://pepy.tech/project/pre-commit-uv)
[![PyPI - License](https://img.shields.io/pypi/l/pre-commit-uv?style=flat-square)](https://opensource.org/licenses/MIT)
[![check](https://github.com/tox-dev/pre-commit-uv/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/pre-commit-uv/actions/workflows/check.yaml)

Use `uv` to create virtual environments and install packages for `pre-commit`.

## Installation

With pipx:

```shell
pipx install pre-commit
pipx inject pre-commit pre-commit-uv
```

With uv:

```shell
uv tool install pre-commit --with pre-commit-uv --force-reinstall
```

## Why?

Compared to upstream `pre-commit` will speed up the initial seed operation. In general, upstream recommends caching the
`pre-commit` cache, however, that is not always possible and is still helpful to have a more performant initial cache
creation., Here's an example of what you could expect demonstrated on this project's own pre-commit setup (with a hot
`uv` cache):

```shell
❯ hyperfine  'pre-commit install-hooks' 'pre-commit-uv install-hooks'
Benchmark 1: pre-commit install-hooks
  Time (mean ± σ):     54.132 s ±  8.827 s    [User: 15.424 s, System: 9.359 s]
  Range (min … max):   45.972 s … 66.506 s    10 runs

Benchmark 2: pre-commit-uv install-hooks
  Time (mean ± σ):     41.695 s ±  7.395 s    [User: 7.614 s, System: 6.133 s]
  Range (min … max):   32.198 s … 58.467 s    10 runs

Summary
  pre-commit-uv install-hooks ran 1.30 ± 0.31 times faster than pre-commit install-hooks
```

## Configuration

Once installed will use `uv` out of box, however the `DISABLE_PRE_COMMIT_UV_PATCH` environment variable if is set it
will work as an escape hatch to disable the new behavior.

To avoid interpreter startup overhead of the patching, we only perform this when we detect you calling `pre-commit`.
Should this logic fail you can force the patching by setting the `FORCE_PRE_COMMIT_UV_PATCH` variable. Should you
experience this please raise an issue with the content of the `sys.argv`. Note that `DISABLE_PRE_COMMIT_UV_PATCH` will
overwrite this flag should both be set.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pre-commit-uv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "format, pyproject",
    "author": null,
    "author_email": "Bernat Gabor <gaborjbernat@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b1/6c/c3c1d01698c8abb0b546defc0304971fa7fb2ba84ad35587b9dad095d73f/pre_commit_uv-4.1.4.tar.gz",
    "platform": null,
    "description": "# pre-commit-uv\n\n[![PyPI](https://img.shields.io/pypi/v/pre-commit-uv?style=flat-square)](https://pypi.org/project/pre-commit-uv)\n[![PyPI - Implementation](https://img.shields.io/pypi/implementation/pre-commit-uv?style=flat-square)](https://pypi.org/project/pre-commit-uv)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pre-commit-uv?style=flat-square)](https://pypi.org/project/pre-commit-uv)\n[![Downloads](https://static.pepy.tech/badge/pre-commit-uv/month)](https://pepy.tech/project/pre-commit-uv)\n[![PyPI - License](https://img.shields.io/pypi/l/pre-commit-uv?style=flat-square)](https://opensource.org/licenses/MIT)\n[![check](https://github.com/tox-dev/pre-commit-uv/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/pre-commit-uv/actions/workflows/check.yaml)\n\nUse `uv` to create virtual environments and install packages for `pre-commit`.\n\n## Installation\n\nWith pipx:\n\n```shell\npipx install pre-commit\npipx inject pre-commit pre-commit-uv\n```\n\nWith uv:\n\n```shell\nuv tool install pre-commit --with pre-commit-uv --force-reinstall\n```\n\n## Why?\n\nCompared to upstream `pre-commit` will speed up the initial seed operation. In general, upstream recommends caching the\n`pre-commit` cache, however, that is not always possible and is still helpful to have a more performant initial cache\ncreation., Here's an example of what you could expect demonstrated on this project's own pre-commit setup (with a hot\n`uv` cache):\n\n```shell\n\u276f hyperfine  'pre-commit install-hooks' 'pre-commit-uv install-hooks'\nBenchmark 1: pre-commit install-hooks\n  Time (mean \u00b1 \u03c3):     54.132 s \u00b1  8.827 s    [User: 15.424 s, System: 9.359 s]\n  Range (min \u2026 max):   45.972 s \u2026 66.506 s    10 runs\n\nBenchmark 2: pre-commit-uv install-hooks\n  Time (mean \u00b1 \u03c3):     41.695 s \u00b1  7.395 s    [User: 7.614 s, System: 6.133 s]\n  Range (min \u2026 max):   32.198 s \u2026 58.467 s    10 runs\n\nSummary\n  pre-commit-uv install-hooks ran 1.30 \u00b1 0.31 times faster than pre-commit install-hooks\n```\n\n## Configuration\n\nOnce installed will use `uv` out of box, however the `DISABLE_PRE_COMMIT_UV_PATCH` environment variable if is set it\nwill work as an escape hatch to disable the new behavior.\n\nTo avoid interpreter startup overhead of the patching, we only perform this when we detect you calling `pre-commit`.\nShould this logic fail you can force the patching by setting the `FORCE_PRE_COMMIT_UV_PATCH` variable. Should you\nexperience this please raise an issue with the content of the `sys.argv`. Note that `DISABLE_PRE_COMMIT_UV_PATCH` will\noverwrite this flag should both be set.\n",
    "bugtrack_url": null,
    "license": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Run pre-commit with uv",
    "version": "4.1.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/tox-dev/pre-commit-uv/issues",
        "Changelog": "https://github.com/tox-dev/pre-commit-uv/releases",
        "Documentation": "https://github.com/tox-dev/pre-commit-uv/",
        "Source Code": "https://github.com/tox-dev/pre-commit-uv"
    },
    "split_keywords": [
        "format",
        " pyproject"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1701b65f9118ef64f6ffe5d57a67170bbff25d4f4a3d1cb78e8ed3392e16114",
                "md5": "9eaa6200db915f5ffa0a7e05ff2d2af3",
                "sha256": "7f01fb494fa1caa5097d20a38f71df7cea0209197b2564699cef9b3f3aa9d135"
            },
            "downloads": -1,
            "filename": "pre_commit_uv-4.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9eaa6200db915f5ffa0a7e05ff2d2af3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5578,
            "upload_time": "2024-10-29T23:07:27",
            "upload_time_iso_8601": "2024-10-29T23:07:27.128229Z",
            "url": "https://files.pythonhosted.org/packages/f1/70/1b65f9118ef64f6ffe5d57a67170bbff25d4f4a3d1cb78e8ed3392e16114/pre_commit_uv-4.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b16cc3c1d01698c8abb0b546defc0304971fa7fb2ba84ad35587b9dad095d73f",
                "md5": "88048fda370124368caeaf4685695ee9",
                "sha256": "3db606a79b226127b27dbbd8381b78c0e30de3ac775a8492c576a68e9250535c"
            },
            "downloads": -1,
            "filename": "pre_commit_uv-4.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "88048fda370124368caeaf4685695ee9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6493,
            "upload_time": "2024-10-29T23:07:28",
            "upload_time_iso_8601": "2024-10-29T23:07:28.918356Z",
            "url": "https://files.pythonhosted.org/packages/b1/6c/c3c1d01698c8abb0b546defc0304971fa7fb2ba84ad35587b9dad095d73f/pre_commit_uv-4.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 23:07:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tox-dev",
    "github_project": "pre-commit-uv",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pre-commit-uv"
}
        
Elapsed time: 0.39954s