Skip to content

Commit

Permalink
fix: use subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Dec 26, 2024
1 parent 78ca05f commit 40b567a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- id: sync-uv-pre-commit
name: Sync uv and pre commit
description: Sync uv and pre commit
language: script
entry: "uv run script.py"
language: python
entry: sync_uv_pre_commit
minimum_pre_commit_version: "3.5.0"
require_serial: true
always_run: true
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
]
scripts = { generate_cli_script = "sync_uv_pre_commit.render:generate_script" }
dependencies = [
"packaging",
"pre-commit>=3.5.0",
"tomlkit>=0.13.2",
"typing-extensions>=4.12.2",
]

[project.scripts]
generate_cli_script = "sync_uv_pre_commit.render:generate_script"
sync_uv_pre_commit = "sync_uv_pre_commit.script:main"

[dependency-groups]
dev = [
"ruff==0.8.4",
Expand Down
15 changes: 15 additions & 0 deletions src/sync_uv_pre_commit/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from __future__ import annotations

import subprocess
from pathlib import Path

WORKSPACE = Path(__file__).parent.parent.parent


def main() -> None: # noqa: D103
subprocess.run( # noqa: S603
["uv", "run", str(WORKSPACE / "script.py")], # noqa: S607
check=True,
capture_output=True,
text=True,
)

0 comments on commit 40b567a

Please sign in to comment.