Skip to content

Commit 18e1411

Browse files
committed
Add pre-commit config to lint/format
1 parent 2aebca1 commit 18e1411

8 files changed

Lines changed: 62 additions & 49 deletions

File tree

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.12.3
5+
hooks:
6+
# Run the linter.
7+
- id: ruff-check
8+
args: [ --fix ]
9+
# Run the formatter.
10+
- id: ruff-format
11+
- repo: https://github.com/tox-dev/pyproject-fmt
12+
rev: "v2.5.0"
13+
hooks:
14+
- id: pyproject-fmt

examples/django/ds/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import time
33
from datetime import datetime
44

5-
from datastar_py.consts import VERSION
65
from datastar_py.django import (
76
DatastarResponse,
87
ServerSentEventGenerator,

examples/fastapi/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from datetime import datetime
1313

1414
import uvicorn
15-
from datastar_py.consts import VERSION
1615
from datastar_py.fastapi import (
1716
DatastarResponse,
1817
ReadSignals,

examples/litestar/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from datetime import datetime
1313

1414
import uvicorn
15-
from datastar_py.consts import VERSION
1615
from datastar_py.litestar import (
1716
DatastarResponse,
1817
ServerSentEventGenerator,

examples/quart/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import asyncio
1111
from datetime import datetime
1212

13-
from datastar_py.consts import VERSION
1413
from datastar_py.quart import (
1514
DatastarResponse,
1615
ServerSentEventGenerator,

examples/sanic/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import asyncio
1111
from datetime import datetime
1212

13-
from datastar_py.consts import ElementPatchMode, VERSION
13+
from datastar_py.consts import ElementPatchMode
1414
from datastar_py.sanic import (
1515
DatastarResponse,
1616
ServerSentEventGenerator,

pyproject.toml

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,74 @@
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
4+
requires = [ "hatchling" ]
5+
16
[project]
27
name = "datastar-py"
3-
description = "Helper functions and classes for the Datastar library (https://data-star.dev/)"
48
version = "0.6.0"
9+
description = "Helper functions and classes for the Datastar library (https://data-star.dev/)"
510
readme = "README.md"
11+
keywords = [ "datastar", "django", "fastapi", "fasthtml", "flask", "html", "litestar", "quart", "sanic", "starlette" ]
12+
license = "MIT"
13+
license-files = [ "LICENSE.md" ]
614
authors = [
7-
{ name = "Felix Ingram", email = "f.ingram@gmail.com" },
8-
{ name = "Lucian Knock", email = "git@lucianknock.com" },
9-
{ name = "Chase Sterling", email = "chase.sterling@gmail.com" }
15+
{ name = "Felix Ingram", email = "f.ingram@gmail.com" },
16+
{ name = "Lucian Knock", email = "git@lucianknock.com" },
17+
{ name = "Chase Sterling", email = "chase.sterling@gmail.com" },
1018
]
1119
requires-python = ">=3.9"
12-
dependencies = []
13-
license = {text = "MIT"}
14-
keywords = ["datastar", "django", "fastapi", "fasthtml", "flask", "litestar", "quart", "sanic", "starlette", "html"]
1520
classifiers = [
1621
"Development Status :: 4 - Beta",
17-
"Programming Language :: Python",
1822
"Environment :: Web Environment",
1923
"Intended Audience :: Developers",
2024
"License :: OSI Approved :: MIT License",
2125
"Operating System :: OS Independent",
26+
"Programming Language :: Python",
27+
"Programming Language :: Python :: 3 :: Only",
2228
"Programming Language :: Python :: 3.9",
2329
"Programming Language :: Python :: 3.10",
2430
"Programming Language :: Python :: 3.11",
2531
"Programming Language :: Python :: 3.12",
2632
"Programming Language :: Python :: 3.13",
2733
]
2834

29-
[project.urls]
30-
Documentation = "https://github.com/starfederation/datastar-python/blob/develop/README.md"
31-
GitHub = "https://github.com/starfederation/datastar-python"
32-
33-
[build-system]
34-
requires = ["hatchling"]
35-
build-backend = "hatchling.build"
35+
dependencies = [ ]
36+
urls.Documentation = "https://github.com/starfederation/datastar-python/blob/develop/README.md"
37+
urls.GitHub = "https://github.com/starfederation/datastar-python"
3638

3739
[dependency-groups]
3840
dev = [
39-
"django>=4.2.17",
40-
"fastapi[standard]>=0.115.4",
41-
"python-fasthtml>=0.12.0; python_version > '3.10'",
42-
"flask[async]>=3.0.3",
43-
"quart>=0.19.9",
44-
"sanic>=24.6.0",
45-
"starlette>=0.46.1",
46-
"uvicorn>=0.32.1",
47-
"litestar>=2.15.2",
41+
"django>=4.2.17",
42+
"fastapi[standard]>=0.115.4",
43+
"flask[async]>=3.0.3",
44+
"litestar>=2.15.2",
45+
"pre-commit>=4.2",
46+
"python-fasthtml>=0.12; python_version>'3.10'",
47+
"quart>=0.19.9",
48+
"sanic>=24.6",
49+
"starlette>=0.46.1",
50+
"uvicorn>=0.32.1",
4851
]
4952

5053
[tool.ruff]
5154
line-length = 99
52-
[tool.ruff.lint]
53-
select = [
54-
# pycodestyle
55-
"E",
56-
# Pyflakes
57-
"F",
58-
# pyupgrade
59-
"UP",
60-
# flake8-bugbear
61-
"B",
62-
# flake8-simplify
63-
"SIM",
64-
# isort
65-
"I",
66-
# Annotations
67-
"ANN",
68-
# Ruff specific
69-
"RUF",
55+
lint.select = [
56+
# Annotations
57+
"ANN",
58+
# flake8-bugbear
59+
"B",
60+
# pycodestyle
61+
"E",
62+
# Pyflakes
63+
"F",
64+
# isort
65+
"I",
66+
# Ruff specific
67+
"RUF",
68+
# flake8-simplify
69+
"SIM",
70+
# pyupgrade
71+
"UP",
7072
]
71-
fixable = ["ALL"]
73+
lint.ignore = [ "E501" ]
74+
lint.fixable = [ "ALL" ]

src/datastar_py/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ class EventType(StrEnum):
8787
# Should a given set of signals patch if they are missing?
8888
DEFAULT_PATCH_SIGNALS_ONLY_IF_MISSING = False
8989

90-
# endregion Default booleans
90+
# endregion Default booleans

0 commit comments

Comments
 (0)