Skip to content

Commit 5c5d686

Browse files
dlangerm-stackdlangerm-stackav
authored andcommitted
add pre commit and essential checks
1 parent b11c046 commit 5c5d686

11 files changed

Lines changed: 211 additions & 35 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @dlangerm-stackav
1+
* @dlangerm-stackav

.github/pull_request_template.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ Please select all that apply.
1515

1616
- Please add relevant commands required to reproduce the testing described above
1717
- Please add relevant test outputs (screenshots, logs, etc.)
18-

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

@@ -204,4 +204,4 @@ cython_debug/
204204
# Marimo
205205
marimo/_static/
206206
marimo/_lsp/
207-
__marimo__/
207+
__marimo__/

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: no-commit-to-branch
6+
args: [--branch, main]
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-toml
11+
- id: mixed-line-ending
12+
args: [--fix, lf]
13+
- id: check-json
14+
- id: check-added-large-files
15+
- id: check-merge-conflict
16+
- id: debug-statements
17+
- id: name-tests-test
18+
- id: pretty-format-json
19+
args:
20+
- --autofix
21+
- --indent=2
22+
- repo: https://github.com/astral-sh/ruff-pre-commit
23+
# Ruff version.
24+
rev: v0.12.0
25+
hooks:
26+
- id: ruff-check
27+
types_or: [python, pyi]
28+
args: [--fix]
29+
- id: ruff-format
30+
types_or: [python, pyi]
31+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
32+
rev: v2.14.0
33+
hooks:
34+
- id: pretty-format-yaml
35+
args: [--autofix, --indent, '2', --offset, '2', --line-width, '80']
36+
- id: pretty-format-toml
37+
args: [--autofix, --indent, '2']
38+
- repo: https://github.com/astral-sh/uv-pre-commit
39+
# uv version.
40+
rev: 0.7.15
41+
hooks:
42+
- id: uv-lock

.vscode/extensions.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"recommendations": [
3-
"charliermarsh.ruff"
4-
]
5-
}
2+
"recommendations": [
3+
"charliermarsh.ruff"
4+
]
5+
}

.vscode/settings.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
2-
"ruff.path": [
3-
"${workspaceFolder}/.venv/bin/ruff"
4-
],
5-
"ruff.interpreter": [
6-
"${workspaceFolder}/.venv/bin/python"
7-
],
8-
"editor.formatOnSave": true
9-
}
2+
"[json]": {
3+
"editor.formatOnSave": false
4+
},
5+
"[yaml]": {
6+
"editor.formatOnSave": false
7+
},
8+
"editor.formatOnSave": true,
9+
"ruff.interpreter": [
10+
"${workspaceFolder}/.venv/bin/python"
11+
],
12+
"ruff.path": [
13+
"${workspaceFolder}/.venv/bin/ruff"
14+
]
15+
}

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @dlangerm-stackav
1+
* @dlangerm-stackav

dltype/_lib/_core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161

6262
def _maybe_warn_runtime(runtime_ns: int) -> None:
6363
return runtime_ns > MAX_ACCEPTABLE_EVALUATION_TIME_NS
64-
6564

6665

6766
class DLTypeError(TypeError):
@@ -713,7 +712,7 @@ def dltyped_namedtuple() -> Callable[[type[NT]], type[NT]]: # noqa: C901
713712

714713
def _inner_dltyped_namedtuple(cls: type[NT]) -> type[NT]:
715714
# NOTE: NamedTuple isn't actually a class, it's a factory function that returns a new class so we can't use issubclass here
716-
if not (isinstance(cls, type) and hasattr(cls, "_fields") and issubclass(cls, tuple)): # pyright: ignore[reportUnnecessaryIsInstance] # TODO(DX-2313): Address pyright errors ignored to migrate from mypy # fmt: skip
715+
if not (isinstance(cls, type) and hasattr(cls, '_fields') and issubclass(cls, tuple)): # pyright: ignore[reportUnnecessaryIsInstance] # TODO(DX-2313): Address pyright errors ignored to migrate from mypy # fmt: skip
717716
msg = f"Expected a NamedTuple class, got {cls}"
718717
raise TypeError(msg)
719718

pyproject.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
[dependency-groups]
2+
dev = [
3+
"onnx>=1.18.0",
4+
"pre-commit>=4.2.0",
5+
"pytest>=8.4.1",
6+
"ruff>=0.12.0"
7+
]
8+
19
[project]
2-
name = "dltype"
310
classifiers = ["Private :: Do Not Upload"]
4-
version = "0.1.0"
11+
dependencies = [
12+
"numpy",
13+
"pydantic>=2.0",
14+
"torch>=1.4.0"
15+
]
516
description = "Add your description here"
17+
name = "dltype"
618
readme = "README.md"
719
requires-python = ">=3.10"
8-
dependencies = [
9-
"numpy",
10-
"pydantic>=2.0",
11-
"torch>=1.4.0",
12-
]
13-
14-
[dependency-groups]
15-
dev = [
16-
"onnx>=1.18.0",
17-
"pytest>=8.4.1",
18-
"ruff>=0.12.0",
19-
]
20-
20+
version = "0.1.0"

setup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# This script sets up the environment for the project
4+
5+
curl -LsSf https://astral.sh/uv/install.sh | sh
6+
7+
uv python install
8+
uv sync
9+
uv run pre-commit install --install-hooks

0 commit comments

Comments
 (0)