-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
334 lines (307 loc) · 9.92 KB
/
pyproject.toml
File metadata and controls
334 lines (307 loc) · 9.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# pyproject.toml: unified Python project metadata and tool configuration file
# See PEP-518: https://www.python.org/dev/peps/pep-0518/
# --------------------------------------------------------------------------
# Project setup
# --------------------------------------------------------------------------
# Project Metadata
# Reference: https://www.python.org/dev/peps/pep-0621/
[project]
name = "code-with-teddy"
version = "1.0"
description = "Teddy's portfolio website."
readme = "README.md"
requires-python = ">=3.12"
classifiers = [
"Framework :: FastAPI",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.12",
]
maintainers = [
{ name = "Theodore Williams", email = "theodore.f.williams@gmail.com" },
]
# Dependencies specified here should ideally not be pinned, unless
# recommended by the package itself. This follows best practices
# established by PyPA:
# https://packaging.python.org/discussions/install-requires-vs-requirements/
dependencies = [
# Aiocache: async cache library (temporarily stopped using because it broke html script nonce)
"aiocache",
# Alembic: SQLAlchemy migration tool
"alembic",
# Asyncpg: PostgreSQL database adapter
"asyncpg",
# Bcrypt: password hashing library
"bcrypt",
# BeautifulSoup: HTML parser
"beautifulsoup4",
# Bleach: HTML sanitizer
"bleach",
# Cryptography: cryptographic library
"cryptography",
# Email-validator: email validation library for Pydantic
"email-validator",
# FastAPI: web framework
"fastapi",
# Gunicorn: load balancer
"gunicorn",
# Itsdangerous: cryptographically signed tokens
"itsdangerous",
# Jinja-partials: Jinja2 template partials
"jinja-partials",
# Jinja2: templating engine
"jinja2",
# MailerSend: email sending service
"mailersend",
# Markdown: Markdown parser
"markdown",
# Micawber: oEmbed consumer
"micawber",
# Pillow: image processing library
"pillow",
# PsycoPG: PostgreSQL database adapter
"psycopg[binary,pool]",
# Pydantic: data modeling, validation and settings management
"pydantic",
# Pydantic-settings: Pydantic settings management
"pydantic-settings",
# Pygments: syntax highlighting library
"pygments",
# PyJWT: JSON Web tokens
"pyjwt",
# Pymdown-extensions: Markdown extensions
"pymdown-extensions",
# Python-mulitpart: multipart form data parser
"python-multipart",
# Pytz: timezone library
"pytz",
# Sentry-sdk: error tracking
"sentry-sdk[fastapi,sqlalchemy]", # aiohttp, httpx (dev deps)
# SQLAlchemy: database toolkit
"sqlalchemy[asyncio]",
# Typer: CLI toolkit (needed in prod for Alembic migrations)
"typer[all]",
# Uv: Python package manager
"uv",
# Uvicorn: ASGI server
"uvicorn[standard]",
# werkzeug: WSGI utility library (also useful utilities for our ASGI app)
"werkzeug",
# WTForms: web forms library
"wtforms[email]",
]
[project.optional-dependencies]
dev = [
# Aiohttp: async HTTP client/server
"aiohttp",
# Anyio: async library
"anyio",
# Black: code formatter (for blacken-docs)
"black",
# Docker: containerization tool
"docker",
# Faker: fake data generator
"faker",
# HTTPX: async HTTP client
"httpx",
# Pip-tools: dependency management
"pip-tools",
# Playwright: browser automation
"playwright",
# Pre-commit: git pre-commit hooks
"pre-commit",
# Pytest: testing framework
"pytest",
# Pytest-cov: coverage support for pytest
"pytest-cov",
# Pytest-mock: mock support for pytest
"pytest-mock",
# Pytest-playwright: Playwright support for pytest
"pytest-playwright",
# Pytest-rerunfailures: re-run failed tests
"pytest-rerunfailures",
# Pyyaml: YAML parser
"pyyaml",
# Requests: HTTP client
"requests",
# Rich: pretty terminal output
"rich",
# Ruff: fast all-in-one linter, written in Rust
"ruff",
# Setuptools: build system
"setuptools",
# SQLAlchemy-utils: utility functions for SQLAlchemy
"sqlalchemy-utils",
# Tenacity: retrying library
"tenacity",
# Ty: static type checker
"ty",
# Types-*: type stubs for external libraries
"types-bleach",
"types-markdown",
"types-pyyaml",
"types-pytz",
"types-requests",
]
[project.urls]
source = "https://github.com/VerdantFox/code-with-teddy"
issues = "https://github.com/VerdantFox/code-with-teddy/issues"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# --------------------------------------------------------------------------
# Tool configurations
# --------------------------------------------------------------------------
# ------------------------------ Pytest ------------------------------------
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--reruns 2"
filterwarnings = [
# Ignore warnings from all sources so that we can ignore warnings from
# external libraries that we can't control.
"ignore",
# Overwrite to error on warnings from our own code.
"error:::tests",
"error:::app",
"error:::scripts",
]
# Coverage
[tool.coverage.run]
branch = true
concurrency = ["greenlet", "thread"]
[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
"if __name__ == __main__:",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
"def __repr__",
"def __str__",
]
include = ["app/*", "scripts/*", "tests/*"]
skip_covered = true # Don't show fully covered files in the report
# ----------------------- Ty: type checker ---------------------------------
# Reference: https://docs.astral.sh/ty/reference/configuration/
[tool.ty.environment]
python = "./venv"
python-version = "3.12"
# Rules references: https://docs.astral.sh/ty/reference/rules/
# Most rules have a default value already ("error", "warn", "ignore")
# This overwrites some of those rules
[tool.ty.rules]
invalid-ignore-comment = "error"
possibly-unbound-attribute = "error"
possibly-unbound-import = "error"
redundant-cast = "error"
undefined-reveal = "error"
unknown-rule = "error"
unresolved-global = "error"
unsupported-base = "error"
division-by-zero = "error"
possibly-unresolved-reference = "error"
unused-ignore-comment = "error"
# ------------------------ Ruff: linter + formatter-------------------------
# Reference: https://docs.astral.sh/ruff/configuration/
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = "dynamic"
[tool.ruff.lint]
# Rules to run
# Reference: https://docs.astral.sh/ruff/rules/
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe (complexity)
"COM", # flake8-commas
"D", # pydocstyle
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"EM", # flake8-errmsg
"ERA", # eradicate
"EXE", # flake8-executable
"F", # pyflakes
"FBT", # flake8-boolean-trap
"FLY", # flynt
# "FURB", # Refurb (In preview)
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
# "LOG", # flake8-logging (In preview)
"N", # pep8-naming
"NPY", # NumPy-specific rules
"PERF", # Perflint
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PLC", # pylint-convention
"PLE", # pylint-error
"PLR", # pylint-refactor
"PLW", # pylint-warning
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"T10", # flake8-debugger
"T20", # flake8-print
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
]
# Roles to ignore
ignore = [
"A003", # builtin-attribute-shadowing. Shadowing `id` in a model for instance.
"ANN401", # No dynamically typed expressions (like "Any")
"COM812", # Missing trailing comma (can cause ruff formatter conflicts)
"D105", # Missing docstring in magic method
"D107", # Missing docstring in __init__
"D203", # 1 blank line required before class docstring (conflicts with D211 - No blank lines allowed before class docstring)
"D213", # Multi-line docstring summary should start at the second line (conflicts with D212 - Multi-line docstring summary should start at the first line)
"ISC001", # Implicit string concatenation found (can cause ruff formatter conflicts)
]
# Don't automatically fix these errors, but still report them
unfixable = [
"ERA001", # eradicate commented out code
"T20", # flake8-print
"RUF100", # unused-noqa
]
[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["D104"] # Missing docstring in public package
"scripts/*" = [
"FBT003", # boolean-positional-value-in-call (needed for typer default arg)
"S101", # use of assert
"S311", # random-not-for-cryptography
"T201", # 'print' found
]
"scripts/alembic.py" = ["S603"] # subprocess-without-shell-equals-true
"migrations/versions/*" = ["D103"] # Missing docstring in public function
"tests/*" = [
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
"ANN201", # Missing return type annotation for function
"E501", # line-too-long
"PLR2004", # Magic value comparison
"S101", # assert-used
"S105", # Passwords should not be hard-coded
]
[tool.ruff.lint.mccabe]
max-complexity = 8
[tool.ruff.lint.isort]
known-first-party = ["app", "tests", "scripts"]