Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ repos:
verbose: true
files: ^db\.py|README\.md$

- rev: v0.15.0
- rev: v0.16.0
repo: https://github.com/astral-sh/ruff-pre-commit
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pdm-project/pdm
rev: 2.26.6
rev: 2.28.0
hooks:
- id: pdm-lock-check
2,235 changes: 1,194 additions & 1,041 deletions pdm.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/sync_pre_commit_lock/_compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ruff: noqa: F401
try:
# 3.11+
import tomllib as toml # type: ignore[import,unused-ignore]
Expand Down
2 changes: 1 addition & 1 deletion src/sync_pre_commit_lock/actions/install_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
self.printer.info(f"{runner.name} hooks successfully installed!")
else:
self.printer.error(f"Failed to install {runner.name} hooks")
except Exception as e:

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.14, ubuntu-latest)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.13, ubuntu-latest)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (windows-latest, 3.12)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (macOS-latest, 3.12)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.12, ubuntu-latest)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.10, ubuntu-latest)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`

Check failure on line 109 in src/sync_pre_commit_lock/actions/install_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.11, ubuntu-latest)

ruff (BLE001)

src/sync_pre_commit_lock/actions/install_hooks.py:109:16: BLE001 Do not catch blind exception: `Exception`
self.printer.error(f"Failed to install {runner.name} hooks due to an unexpected error")
self.printer.error(f"{e}")

Expand All @@ -116,7 +116,7 @@

def _get_git_directory_path(self) -> Path | None:
try:
result = subprocess.check_output( # noqa: S603
result = subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], # noqa: S607
stderr=subprocess.PIPE,
)
Expand Down
3 changes: 2 additions & 1 deletion src/sync_pre_commit_lock/actions/sync_hooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections.abc import Sequence

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.14, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.13, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (windows-latest, 3.12)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (macOS-latest, 3.12)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.12, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.10, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block

Check failure on line 3 in src/sync_pre_commit_lock/actions/sync_hooks.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.11, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/actions/sync_hooks.py:3:29: TC003 Move standard library import `collections.abc.Sequence` into a type-checking block help: Move into type-checking block
from functools import cached_property
from typing import TYPE_CHECKING, NamedTuple, Sequence
from typing import TYPE_CHECKING, NamedTuple

from packaging.requirements import InvalidRequirement, Requirement
from packaging.specifiers import SpecifierSet
Expand Down
3 changes: 2 additions & 1 deletion src/sync_pre_commit_lock/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

import os
from collections.abc import Callable

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.14, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.13, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (windows-latest, 3.12)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (macOS-latest, 3.12)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.12, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.10, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block

Check failure on line 4 in src/sync_pre_commit_lock/config.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.11, ubuntu-latest)

ruff (TC003)

src/sync_pre_commit_lock/config.py:4:29: TC003 Move standard library import `collections.abc.Callable` into a type-checking block help: Move into type-checking block
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, TypedDict
from typing import TYPE_CHECKING, Any, TypedDict

from ._compat import toml

Expand Down
2 changes: 1 addition & 1 deletion src/sync_pre_commit_lock/pdm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
f"[info]{self.plugin_prefix}[/info]",
f"{prefix} {'└' if last else '├'} [cyan][bold]{old_req.name}[/bold][/cyan]",
" ",
f"[error]{str(old_req.specifier).lstrip('==') or '*'}[/error]",

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.14, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.13, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (windows-latest, 3.12)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (macOS-latest, 3.12)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.12, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.10, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 121 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.11, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:121:23: B005 Using `.strip()` with multi-character strings is misleading
"[info]->[/info]",
f"[green]{str(new_req.specifier).lstrip('==')}[/green]",

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.14, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.13, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (windows-latest, 3.12)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (macOS-latest, 3.12)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.12, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.10, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading

Check failure on line 123 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.11, ubuntu-latest)

ruff (B005)

src/sync_pre_commit_lock/pdm_plugin.py:123:23: B005 Using `.strip()` with multi-character strings is misleading
)


Expand Down Expand Up @@ -161,10 +161,10 @@


if TYPE_CHECKING:
Resolution = Union[dict[str, list[Candidate]], dict[str, Candidate]]

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.14, ubuntu-latest)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.13, ubuntu-latest)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (windows-latest, 3.12)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (macOS-latest, 3.12)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.12, ubuntu-latest)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.10, ubuntu-latest)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`

Check failure on line 164 in src/sync_pre_commit_lock/pdm_plugin.py

View workflow job for this annotation

GitHub Actions / CI-Python (3.11, ubuntu-latest)

ruff (UP007)

src/sync_pre_commit_lock/pdm_plugin.py:164:18: UP007 Use `X | Y` for type annotations help: Convert to `X | Y`


def select_candidate(candidate: Union[Candidate, list[Candidate]]) -> Candidate | None:
def select_candidate(candidate: Candidate | list[Candidate]) -> Candidate | None:
if isinstance(candidate, Iterable):
return next(iter(candidate), None)
return candidate
Expand Down
6 changes: 2 additions & 4 deletions src/sync_pre_commit_lock/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ def normalize_git_url(url: str) -> str:
path = parsed_url.path

# Remove .git from the end of path if it's there
if path.endswith(".git"):
path = path[:-4]
path = path.removesuffix(".git")

# Reconstruct the URL
normalized_url = urlunparse((scheme, netloc, path, None, None, None))

if normalized_url.endswith("/"):
normalized_url = normalized_url[:-1]
normalized_url = normalized_url.removesuffix("/")

return normalized_url

Expand Down
1 change: 0 additions & 1 deletion tests/test_pdm/test_pdm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import pytest

pdm_module = pytest.importorskip("pdm")
# ruff: noqa: E402
from pdm.core import Core
from pdm.project import Project
from pdm.termui import UI
Expand Down
1 change: 0 additions & 1 deletion tests/test_pdm/test_pdm_sync_pre_commit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from packaging.version import Version

pdm_module = pytest.importorskip("pdm")
# ruff: noqa: E402
from pdm.__version__ import __version__ as pdm_version
from pdm.core import Core
from pdm.models.candidates import Candidate
Expand Down
1 change: 0 additions & 1 deletion tests/test_poetry/test_poetry_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

poetry_module = pytest.importorskip("poetry")
# ruff: noqa: E402
from cleo.events.console_terminate_event import ConsoleTerminateEvent
from poetry.console.application import Application
from poetry.console.commands.install import InstallCommand
Expand Down
Loading