Skip to content

Commit bb7f1c3

Browse files
feat: add linting and type checking
1 parent 9f6f35e commit bb7f1c3

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ pip install -r requirements_dev.txt
1919
```
2020
fastapi dev oc4ids_datastore_api/main.py
2121
```
22+
23+
### Run linting and type checking
24+
25+
```
26+
black oc4ids_datastore_api/
27+
isort oc4ids_datastore_api/
28+
flake8 oc4ids_datastore_api/
29+
mypy oc4ids_datastore_api/
30+
```

oc4ids_datastore_api/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from fastapi import FastAPI
22

3-
43
app = FastAPI()
54

65

76
@app.get("/")
8-
def index():
7+
def index() -> str:
98
return "Hello, World!"

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,21 @@ readme = "README.md"
1010
dependencies = [
1111
"fastapi[standard]"
1212
]
13+
14+
[project.optional-dependencies]
15+
dev = [
16+
"black",
17+
"isort",
18+
"flake8",
19+
"Flake8-pyproject",
20+
"mypy",
21+
]
22+
23+
[tool.isort]
24+
profile = "black"
25+
26+
[tool.flake8]
27+
max-line-length = 88
28+
29+
[tool.mypy]
30+
strict = true

requirements_dev.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ anyio==4.8.0
1111
# httpx
1212
# starlette
1313
# watchfiles
14+
black==25.1.0
15+
# via oc4ids-datastore-api (pyproject.toml)
1416
certifi==2025.1.31
1517
# via
1618
# httpcore
1719
# httpx
1820
click==8.1.8
1921
# via
22+
# black
2023
# rich-toolkit
2124
# typer
2225
# uvicorn
@@ -28,6 +31,12 @@ fastapi[standard]==0.115.8
2831
# via oc4ids-datastore-api (pyproject.toml)
2932
fastapi-cli[standard]==0.0.7
3033
# via fastapi
34+
flake8==7.1.1
35+
# via
36+
# flake8-pyproject
37+
# oc4ids-datastore-api (pyproject.toml)
38+
flake8-pyproject==1.2.3
39+
# via oc4ids-datastore-api (pyproject.toml)
3140
h11==0.14.0
3241
# via
3342
# httpcore
@@ -43,18 +52,38 @@ idna==3.10
4352
# anyio
4453
# email-validator
4554
# httpx
55+
isort==6.0.0
56+
# via oc4ids-datastore-api (pyproject.toml)
4657
jinja2==3.1.5
4758
# via fastapi
4859
markdown-it-py==3.0.0
4960
# via rich
5061
markupsafe==3.0.2
5162
# via jinja2
63+
mccabe==0.7.0
64+
# via flake8
5265
mdurl==0.1.2
5366
# via markdown-it-py
67+
mypy==1.15.0
68+
# via oc4ids-datastore-api (pyproject.toml)
69+
mypy-extensions==1.0.0
70+
# via
71+
# black
72+
# mypy
73+
packaging==24.2
74+
# via black
75+
pathspec==0.12.1
76+
# via black
77+
platformdirs==4.3.6
78+
# via black
79+
pycodestyle==2.12.1
80+
# via flake8
5481
pydantic==2.10.6
5582
# via fastapi
5683
pydantic-core==2.27.2
5784
# via pydantic
85+
pyflakes==3.2.0
86+
# via flake8
5887
pygments==2.19.1
5988
# via rich
6089
python-dotenv==1.0.1
@@ -81,6 +110,7 @@ typing-extensions==4.12.2
81110
# via
82111
# anyio
83112
# fastapi
113+
# mypy
84114
# pydantic
85115
# pydantic-core
86116
# rich-toolkit

0 commit comments

Comments
 (0)