Skip to content

Commit 3304fbe

Browse files
committed
update pre-commits
1 parent 053579b commit 3304fbe

File tree

5 files changed

+76
-36
lines changed

5 files changed

+76
-36
lines changed

.github/workflows/static-analysis.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ jobs:
3131
**/requirements*.txt
3232
**/pyproject.toml
3333
**/uv.lock
34+
Makefile
3435
35-
- name: Install dependencies
36-
run: uv sync --dev --all-extras
36+
- name: Install dependencies and setup pre-commit
37+
run: make install
3738

38-
- name: Run pre-commit
39-
uses: pre-commit/[email protected]
39+
- name: Run linting and type checking
40+
run: make lint typecheck

.pre-commit-config.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
repos:
2-
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.8
4-
hooks:
5-
- id: ruff-format
6-
exclude: ^uv\.lock$
7-
- id: ruff
8-
args: [--fix, --exit-non-zero-on-fix]
9-
exclude: ^uv\.lock$
102
- repo: local
113
hooks:
124
- id: typecheck

Makefile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.DEFAULT_GOAL := all
2+
3+
.PHONY: .uv ## Check that uv is installed
4+
.uv:
5+
@uv -V || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
6+
7+
.PHONY: .pre-commit ## Check that pre-commit is installed
8+
.pre-commit: .uv
9+
@uv run pre-commit -V || uv pip install pre-commit
10+
11+
.PHONY: install ## Install the package, dependencies, and pre-commit for local development
12+
install: .uv
13+
uv sync --frozen --dev --all-extras
14+
uv pip install pre-commit
15+
pre-commit install --install-hooks
16+
17+
.PHONY: rebuild-lockfiles ## Rebuild lockfiles from scratch, updating all dependencies
18+
rebuild-lockfiles: .uv
19+
uv lock --upgrade
20+
21+
.PHONY: format ## Auto-format python source files
22+
format: .uv
23+
uv run ruff format .
24+
uv run ruff check --fix .
25+
26+
.PHONY: lint ## Lint python source files
27+
lint: .uv
28+
uv run ruff check .
29+
uv run ruff format .
30+
31+
.PHONY: typecheck ## Run type checking
32+
typecheck: .pre-commit
33+
pre-commit run typecheck --all-files
34+
35+
.PHONY: all ## Run the standard set of checks performed in CI
36+
all: lint typecheck
37+
38+
.PHONY: clean ## Clear local caches and build artifacts
39+
clean:
40+
rm -rf `find . -name __pycache__`
41+
rm -f `find . -type f -name '*.py[co]'`
42+
rm -f `find . -type f -name '*~'`
43+
rm -f `find . -type f -name '.*~'`
44+
rm -rf .cache
45+
rm -rf .pytest_cache
46+
rm -rf .ruff_cache
47+
rm -rf htmlcov
48+
rm -rf *.egg-info
49+
rm -f .coverage
50+
rm -f .coverage.*
51+
rm -rf build
52+
rm -rf dist
53+
54+
.PHONY: help ## Display this message
55+
help:
56+
@grep -E \
57+
'^.PHONY: .*?## .*$$' $(MAKEFILE_LIST) | \
58+
sort | \
59+
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'

src/raggy/utilities/embeddings.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ async def create_openai_embeddings(
1414
input_: str,
1515
timeout: int = 60,
1616
model: str = raggy.settings.openai_embeddings_model,
17-
) -> Embedding:
18-
...
17+
) -> Embedding: ...
1918

2019

2120
@overload
2221
async def create_openai_embeddings(
2322
input_: list[str],
2423
timeout: int = 60,
2524
model: str = raggy.settings.openai_embeddings_model,
26-
) -> list[Embedding]:
27-
...
25+
) -> list[Embedding]: ...
2826

2927

3028
@retry(

src/raggy/utilities/logging.py

+10-20
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,15 @@ class RaggyLogger(logging.Logger):
1717
def __init__(self, name: str, level: int = logging.NOTSET) -> None:
1818
super().__init__(name, level)
1919

20-
def debug_style(self, message: str, style: str | None = None) -> None:
21-
...
20+
def debug_style(self, message: str, style: str | None = None) -> None: ...
2221

23-
def info_style(self, message: str, style: str | None = None) -> None:
24-
...
22+
def info_style(self, message: str, style: str | None = None) -> None: ...
2523

26-
def warning_style(self, message: str, style: str | None = None) -> None:
27-
...
24+
def warning_style(self, message: str, style: str | None = None) -> None: ...
2825

29-
def error_style(self, message: str, style: str | None = None) -> None:
30-
...
26+
def error_style(self, message: str, style: str | None = None) -> None: ...
3127

32-
def critical_style(self, message: str, style: str | None = None) -> None:
33-
...
28+
def critical_style(self, message: str, style: str | None = None) -> None: ...
3429

3530
def debug_kv(
3631
self,
@@ -39,8 +34,7 @@ def debug_kv(
3934
key_style: str = "green",
4035
value_style: str = "default on default",
4136
delimiter: str = ": ",
42-
) -> None:
43-
...
37+
) -> None: ...
4438

4539
def info_kv(
4640
self,
@@ -49,8 +43,7 @@ def info_kv(
4943
key_style: str = "blue",
5044
value_style: str = "default on default",
5145
delimiter: str = ": ",
52-
) -> None:
53-
...
46+
) -> None: ...
5447

5548
def warning_kv(
5649
self,
@@ -59,8 +52,7 @@ def warning_kv(
5952
key_style: str = "yellow",
6053
value_style: str = "default on default",
6154
delimiter: str = ": ",
62-
) -> None:
63-
...
55+
) -> None: ...
6456

6557
def error_kv(
6658
self,
@@ -69,8 +61,7 @@ def error_kv(
6961
key_style: str = "red",
7062
value_style: str = "default on default",
7163
delimiter: str = ": ",
72-
) -> None:
73-
...
64+
) -> None: ...
7465

7566
def critical_kv(
7667
self,
@@ -79,8 +70,7 @@ def critical_kv(
7970
key_style: str = "red",
8071
value_style: str = "default on default",
8172
delimiter: str = ": ",
82-
) -> None:
83-
...
73+
) -> None: ...
8474

8575

8676
logging.setLoggerClass(RaggyLogger)

0 commit comments

Comments
 (0)