Skip to content

Commit ad0117a

Browse files
author
Vladimir Voronov
committed
feat(init): init commit
0 parents  commit ad0117a

File tree

4 files changed

+250
-0
lines changed

4 files changed

+250
-0
lines changed

.editorconfig

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
trim_trailing_whitespace = true
9+
end_of_line = lf
10+
charset = utf-8
11+
12+
[*.json]
13+
indent_size = 2
14+
insert_final_newline = unset
15+
16+
[*.md]
17+
trim_trailing_whitespace = false
18+
19+
[*.py]
20+
max_line_length = 100
21+
insert_final_newline = true
22+
23+
[*.{yml,yaml}]
24+
indent_size = 2
25+
26+
[Makefile]
27+
indent_style = tab

.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Docker
2+
docker-compose*override.yml
3+
.poetry_run
4+
5+
# Dotenv (.env)
6+
.env
7+
.makerc
8+
9+
# Python
10+
.venv
11+
requirements*.txt
12+
13+
# Cache
14+
__pycache__
15+
.mypy_cache/
16+
.pytest_cache/
17+
.ruff_cache
18+
19+
# pyTest
20+
*coverage*
21+
22+
# Visual Studio Code
23+
.devcontainer/
24+
.vscode/
25+
workspace.code-workspace
26+
27+
#PyCharm
28+
.idea/
29+
30+
# Jupyter Notebook
31+
.ipynb_checkpoints/
32+
33+
# Poetry
34+
poetry.lock
35+
36+
# Build
37+
dist

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# FastAPI structured logs

pyproject.toml

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
[tool.poetry]
2+
name = "fastapi-structlog"
3+
version = "0.1.0"
4+
description = "Structured logs and middleware for fastapi with sentry integration"
5+
authors = ["Vladimir Voronov"]
6+
readme = "README.md"
7+
package-mode = true
8+
packages = [
9+
{ include = "fastapi_structlog" },
10+
]
11+
12+
[tool.poetry.dependencies]
13+
python = "^3.11"
14+
pydantic = "^2.7.0"
15+
structlog = "^24.1.0"
16+
orjson = "^3.10.1"
17+
structlog-sentry = "^2.1.0"
18+
rich = "^13.7.1"
19+
pydantic-settings = "^2.2.1"
20+
asgi-correlation-id = "^4.3.1"
21+
sentry-sdk = "^1.45.0"
22+
23+
24+
[tool.poetry.group.linter.dependencies]
25+
ruff = "^0.4.1"
26+
27+
28+
[tool.poetry.group.examples.dependencies]
29+
uvicorn = "^0.29.0"
30+
fastapi = "^0.110.2"
31+
sqlalchemy = "^2.0.29"
32+
httpx = "^0.27.0"
33+
34+
35+
[tool.poetry.group.dev.dependencies]
36+
mypy = "^1.9.0"
37+
commitizen = "^3.24.0"
38+
39+
40+
[tool.commitizen]
41+
name = "cz_conventional_commits"
42+
tag_format = "$version"
43+
version_scheme = "pep440"
44+
version_provider = "poetry"
45+
update_changelog_on_bump = true
46+
major_version_zero = true
47+
48+
49+
[build-system]
50+
requires = ["poetry-core"]
51+
build-backend = "poetry.core.masonry.api"
52+
53+
54+
[tool.ruff]
55+
exclude = [
56+
".bzr",
57+
".direnv",
58+
".eggs",
59+
".git",
60+
".git-rewrite",
61+
".hg",
62+
".ipynb_checkpoints",
63+
".mypy_cache",
64+
".nox",
65+
".pants.d",
66+
".pyenv",
67+
".pytest_cache",
68+
".pytype",
69+
".ruff_cache",
70+
".svn",
71+
".tox",
72+
".venv",
73+
".vscode",
74+
"__pypackages__",
75+
"_build",
76+
"buck-out",
77+
"build",
78+
"dist",
79+
"node_modules",
80+
"site-packages",
81+
"venv",
82+
]
83+
84+
line-length = 100
85+
target-version = "py311"
86+
87+
[tool.ruff.lint]
88+
# https://docs.astral.sh/ruff/rules/
89+
select = [
90+
"E", # pycodestyle errors
91+
"W", # pycodestyle warnings
92+
"F", # pyflakes
93+
"I", # isort
94+
"N", # pep8-naming
95+
"D", # pydocstyle
96+
"A", # flake8-builtins
97+
"S", # flake8-bandit
98+
"C", # flake8-comprehensions
99+
"B", # flake8-bugbear
100+
"Q", # flake8-quotes
101+
"PL", # pylint
102+
"UP", # pyupgrade
103+
"C4", # flake8-comprehensions
104+
"EM", # flake8-errmsg
105+
"PT", # flake8-pytest-style
106+
"TD", # flake8-todos
107+
"FBT", # flake8-boolean-trap
108+
"ANN", # flake8-annotations
109+
"BLE", # flake8-blind-except
110+
"COM", # flake8-commas
111+
"ISC", # flake8-implicit-str-concat
112+
"ICN", # flake8-import-conventions
113+
"PIE", # flake8-pie
114+
"T20", # flake8-print
115+
"PYI", # flake8-pyi
116+
"RSE", # flake8-raise
117+
"RET", # flake8-return
118+
"SIM", # flake8-simplify
119+
"PTH", # flake8-use-pathlib
120+
"TID", # flake8-tidy-imports
121+
"TCH", # flake8-type-checking
122+
"ARG", # flake8-unused-arguments
123+
"ERA", # eradicate
124+
"PGH", # pygrep-hooks
125+
"RUF", # Ruff-specific rules
126+
"PERF", # Perflint
127+
"ASYNC", # flake8-async
128+
]
129+
ignore = [
130+
"ANN102", # annotation for cls
131+
"ANN101", # annotation for self
132+
]
133+
134+
[tool.ruff.lint.flake8-quotes]
135+
docstring-quotes = "double"
136+
137+
[tool.ruff.lint.pylint]
138+
max-args = 5
139+
max-positional-args = 3
140+
141+
[tool.pylint]
142+
disable = "all"
143+
bad-names = "foo,bar,baz,toto,tutu,tata"
144+
good-names = "x,y,i,_,main,j,k,ex,Run"
145+
enable = ["disallowed-name", "redefined-outer-name"]
146+
147+
[tool.ruff.lint.isort]
148+
section-order = [
149+
"future",
150+
"standard-library",
151+
"fastapi",
152+
"third-party",
153+
"first-party",
154+
"local-folder"
155+
]
156+
157+
[tool.ruff.lint.isort.sections]
158+
"fastapi" = ["fastapi", "starlette"]
159+
160+
[tool.ruff.lint.pydocstyle]
161+
convention = "google"
162+
163+
[tool.ruff.format]
164+
# Like Black, use double quotes for strings.
165+
quote-style = "double"
166+
167+
# Like Black, indent with spaces, rather than tabs.
168+
indent-style = "space"
169+
170+
# Like Black, respect magic trailing commas.
171+
skip-magic-trailing-comma = false
172+
173+
# Like Black, automatically detect the appropriate line ending.
174+
line-ending = "auto"
175+
176+
[tool.mypy]
177+
show_traceback = true
178+
strict = true
179+
mypy_path = "fastapi_structlog/"
180+
181+
# Display the codes needed for # type: ignore[code] annotations.
182+
show_error_codes = true
183+
184+
# Warn of unreachable or redundant code.
185+
warn_unreachable = true

0 commit comments

Comments
 (0)