Skip to content

Commit 573f44e

Browse files
authored
Initial version (#1)
1 parent f3977be commit 573f44e

55 files changed

Lines changed: 5851 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# Created with help from .ignore support plugin (hsz.mobi)
2+
3+
### Python template
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# PyInstaller
33+
# Usually these files are written by a python script from a template
34+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
35+
*.manifest
36+
*.spec
37+
38+
# Installer logs
39+
pip-log.txt
40+
pip-delete-this-directory.txt
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.nox/
46+
.coverage
47+
.coverage.*
48+
.cache
49+
nosetests.xml
50+
coverage.xml
51+
*.cover
52+
*.py,cover
53+
.hypothesis/
54+
.pytest_cache/
55+
cover/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
.pybuilder/
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
# For a library or package, you might want to ignore these files since the code is
90+
# intended to run in multiple environments; otherwise, check them in:
91+
.python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
101+
__pypackages__/
102+
103+
# Celery stuff
104+
celerybeat-schedule
105+
celerybeat.pid
106+
107+
# SageMath parsed files
108+
*.sage.py
109+
110+
# Environments
111+
.env
112+
.venv
113+
env/
114+
venv/
115+
ENV/
116+
env.bak/
117+
venv.bak/
118+
119+
# Spyder project settings
120+
.spyderproject
121+
.spyproject
122+
123+
# Rope project settings
124+
.ropeproject
125+
126+
# mkdocs documentation
127+
/site
128+
129+
# mypy
130+
.mypy_cache/
131+
.dmypy.json
132+
dmypy.json
133+
134+
# Pyre type checker
135+
.pyre/
136+
137+
# pytype static type analyzer
138+
.pytype/
139+
140+
# Cython debug symbols
141+
cython_debug/
142+
143+
144+
### Linux template
145+
*~
146+
147+
# temporary files which can be created if a process still has a handle open of a deleted file
148+
.fuse_hidden*
149+
150+
# KDE directory preferences
151+
.directory
152+
153+
# Linux trash folder which might appear on any partition or disk
154+
.Trash-*
155+
156+
# .nfs files are created when an open file is removed but is still being accessed
157+
.nfs*
158+
159+
160+
### macOS template
161+
# General
162+
.DS_Store
163+
.AppleDouble
164+
.LSOverride
165+
166+
# Icon must end with two \r
167+
Icon
168+
169+
# Thumbnails
170+
._*
171+
172+
# Files that might appear in the root of a volume
173+
.DocumentRevisions-V100
174+
.fseventsd
175+
.Spotlight-V100
176+
.TemporaryItems
177+
.Trashes
178+
.VolumeIcon.icns
179+
.com.apple.timemachine.donotpresent
180+
181+
# Directories potentially created on remote AFP share
182+
.AppleDB
183+
.AppleDesktop
184+
Network Trash Folder
185+
Temporary Items
186+
.apdisk
187+
188+
189+
### JetBrains
190+
# For a more granular version: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
191+
.idea
192+
193+
194+
### Google App Engine
195+
# https://cloud.google.com/appengine/docs/standard/python3/runtime#dependencies
196+
Pipfile
197+
Pipfile.lock
198+
199+
### Local development
200+
201+
# direnv
202+
.envrc
203+
204+
# tool configs
205+
.editorconfig
206+
207+
### Build system
208+
209+
# Poetry
210+
/requirements.txt

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Settle for Developers
3+
Copyright (c) 2020-2023 Settle Group AS
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Settle FastAPI Extensions
2+
3+
A collection of utilities meant to improve coding experience with FastAPI.
4+
5+
Disclaimer: this is an extract of Settle internal FastAPI utilities which Settle decide to
6+
open-source back in 2021, but lacked the resources to make it truly stand on its own.
7+
Use only if you're willing to take time to understand the code.
8+
The original plan was and still is to add docs, make it a library, add scripts using py-invoke,
9+
make a cookiecutter for the instrumentation part, add full test coverage, and more.

config/tools/.coveragerc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# https://coverage.readthedocs.io/en/latest/config.html
2+
3+
[run]
4+
branch = True
5+
include =
6+
src/*
7+
omit =
8+
tests/*
9+
migrations/*
10+
11+
[report]
12+
# Regexes for lines to exclude from consideration
13+
exclude_lines =
14+
# Have to re-enable the standard pragma
15+
pragma: no cover
16+
17+
# Don't complain about missing debug-only code:
18+
def __repr__
19+
if self\.debug
20+
21+
# Don't complain if tests don't hit defensive assertion code:
22+
raise AssertionError
23+
raise NotImplementedError
24+
25+
# Don't complain if non-runnable code isn't run:
26+
if 0:
27+
if False:
28+
if __name__ == .__main__.:
29+
30+
ignore_errors = True
31+
fail_under = 20
32+
skip_covered = False
33+
skip_empty = True

config/tools/.flake8

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# https://flake8.pycqa.org/en/latest/user/options.html#options-list
2+
3+
[flake8]
4+
max-line-length = 120
5+
# application-import-names =
6+
# app,
7+
# tests
8+
select =
9+
ANN,
10+
B,
11+
B9,
12+
BLK,
13+
C,
14+
D,
15+
DAR,
16+
E,
17+
F,
18+
I,
19+
S,
20+
W
21+
# default error exclude patterns, modify only extend-ignore
22+
# ignore =
23+
# E121,
24+
# E123,
25+
# E126,
26+
# E226,
27+
# E24,
28+
# E704,
29+
# W503,
30+
# W504
31+
extend-ignore =
32+
E203,
33+
E501
34+
# default file include patterns, modify only by adding items to the list, i.e. avoid deleting them
35+
# filename:
36+
# *.py
37+
# default file exclude patterns, modify only extend-exclude
38+
# exclude:
39+
# .svn,
40+
# CVS,
41+
# .bzr,
42+
# .hg,
43+
# .git,
44+
# __pycache__,
45+
# .tox
46+
# extend-exclude:
47+
# <pattern>
48+
max-complexity = 10
49+
import-order-style = google
50+
docstring-convention = google
51+
# number of subprocesses to run in parallel
52+
jobs = auto
53+
# pylint format also available, other formats available only if installed
54+
format = default
55+
statistics = True

config/tools/.isort.cfg

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# https://timothycrosley.github.io/isort/
2+
# https://github.com/timothycrosley/isort/wiki/isort-Settings
3+
4+
[settings]
5+
line_length = 120
6+
profile = black
7+
multi_line_output = 3
8+
force_alphabetical_sort_within_sections = true
9+
force_sort_within_sections = true
10+
force_grid_wrap = false
11+
force_single_line = false
12+
remove_redundant_aliases = true
13+
atomic = true
14+
include_trailing_comma = true
15+
ensure_newline_before_comments = True
16+
lines_after_imports = 2
17+
lines_between_types = 1
18+
use_parentheses = true
19+
# default skipped files, modify only extend_skip
20+
# skip =
21+
# .venv,
22+
# venv,
23+
# .tox,
24+
# .eggs,
25+
# .git,
26+
# .hg,
27+
# .mypy_cache,
28+
# .nox,
29+
# .svn,
30+
# .bzr,
31+
# _build,
32+
# buck-out,
33+
# build,
34+
# dist,
35+
# .pants.d,
36+
# .direnv,
37+
# node_modules,
38+
# __pypackages__
39+
# extend_skip =
40+
# <file>
41+
filter_files = true
42+
43+
known_first_party =
44+
known_third_party =
45+
known_app = app
46+
known_middleware = fastapi_laser
47+
48+
sections = FUTURE,STDLIB,THIRDPARTY,MIDDLEWARE,APP,FIRSTPARTY,LOCALFOLDER

config/tools/black.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://black.readthedocs.io/en/stable/installation_and_usage.html
2+
# https://black.readthedocs.io/en/stable/pyproject_toml.html
3+
4+
[tool.black]
5+
line-length = 120
6+
target-version = ['py38']
7+
# default include regex pattern, modify only by adding patterns to the list, i.e. avoid deleting them
8+
# include = '\.pyi?$'
9+
# exclude regex pattern, modify only by adding patterns to the list, i.e. avoid deleting them
10+
exclude = '''
11+
(
12+
/(
13+
\.eggs
14+
| \.git
15+
| \.hg
16+
| \.mypy_cache
17+
| \.nox
18+
| \.tox
19+
| \.venv
20+
| \.svn
21+
| _build
22+
| buck-out
23+
| build
24+
| dist
25+
| venv
26+
)/
27+
)
28+
'''

0 commit comments

Comments
 (0)