Skip to content

Commit b83ce43

Browse files
committed
use git hooks to automatically run mypy and others
1 parent 38e0738 commit b83ce43

File tree

8 files changed

+211
-24
lines changed

8 files changed

+211
-24
lines changed

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.15.8
4+
hooks:
5+
- id: ruff
6+
args: [ --fix ]
7+
- id: ruff-format
8+
- repo: https://github.com/pre-commit/mirrors-mypy
9+
rev: v1.15.0
10+
hooks:
11+
- id: mypy
12+
args: [ --config-file=pyproject.toml ]
13+
files: ^(pythonosc|examples)/
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v6.0.0
16+
hooks:
17+
- id: trailing-whitespace
18+
- id: end-of-file-fixer
19+
- id: check-yaml
20+
- id: check-added-large-files

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
3-
3+
44
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
55

66
## Unreleased

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ TL;DR:
77
- Provide type annotations with mypy (`uv run mypy pythonosc examples`)
88
- Write and run tests with pytest (`uv run pytest`)
99
- Use [uv](https://docs.astral.sh/uv/) for package management and environment isolation
10+
- Install and use [pre-commit](https://pre-commit.com/) to automatically run ruff before each commit (`uv run pre-commit install`)
1011
- If you're adding a new feature, mention it in the [CHANGELOG.md](CHANGELOG.md) file under the _Unreleased_ section
1112

12-
Please only send the PR once all of the above is done, thanks!
13+
Please only send the PR once all of the above is done, thanks!

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ help:
1616
# Catch-all target: route all unknown targets to Sphinx using the new
1717
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1818
%: Makefile
19-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,4 @@ Server Module Documentation
130130
.. automodule:: pythonosc.osc_tcp_server
131131
:special-members:
132132
:members:
133-
:exclude-members: __weakref__
133+
:exclude-members: __weakref__

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dev = [
3232
"mypy",
3333
"ruff",
3434
"pytest-cov",
35+
"pre-commit",
3536
]
3637

3738
[tool.uv.build-backend]

pythonosc/osc_message_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def add_arg(self, arg_value: ArgValue, arg_type: Optional[str] = None) -> None:
100100
arg_type = self._get_arg_type(arg_value)
101101
if isinstance(arg_type, list):
102102
self._args.append((self.ARG_TYPE_ARRAY_START, None))
103-
for v, t in zip(arg_value, arg_type): # type: ignore[arg-type]
103+
for v, t in zip(arg_value, arg_type): # type: ignore[arg-type, var-annotated]
104104
self.add_arg(v, t)
105105
self._args.append((self.ARG_TYPE_ARRAY_STOP, None))
106106
else:

uv.lock

Lines changed: 184 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)