-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
179 lines (152 loc) · 4.89 KB
/
pyproject.toml
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
[tool.poetry]
authors = ["Andre Sionek <[email protected]>"]
name = "ch-microservices"
description = "Code for the book Real Life Infrastructure as Code with AWS CDK" # noqa
keywords = ['cdk', 'iac', 'infrastructure', 'devops', 'python', 'api', 'FastAPI'] # noqa
readme = "README.md"
homepage = "https://real-life-iac.com/"
version = "0.0.0"
package-mode = false
[tool.poetry.build]
generate-setup-file = false
[tool.poetry.dependencies]
python = "^3.11"
aws-cdk-lib = "^2.141.0"
constructs-package = {git = "https://github.com/Real-Life-IaC/cdk-constructs.git", rev = "0.7.1"}
alembic = "^1.14.0"
awscli-local = "^0.22.0"
[tool.poetry.group.test]
optional = true
[tool.poetry.group.test.dependencies]
pytest = "^7.4.3" # Allows for testing of the project
pytest-cov = "^4.1.0" # Allows to run coverage of the project
pytest-asyncio = "^0.23.7" # Allows async testing
syrupy = "^4.6.0" # Allows testing snapshots
[tool.poetry.group.checkov]
optional = true
[tool.poetry.group.checkov.dependencies]
checkov = "^3.0.36" # IaC (Cloudformation) security checks
[tool.poetry.group.lint]
optional = true
[tool.poetry.group.lint.dependencies]
black = "^24.4.2" # Python style checks
commitizen = "^3.12.0" # Check commit messages
pre-commit = "^3.7.1" # Runs a pipeline before commiting code
yamllint = "^1.35.1" # Linter for YAML files
ruff = "^0.4.4" # Python linter
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.5.0"]
[tool.black]
extend-exclude = '''
/(
\.eggs
| \.git
| \.venv
| \.env
| cdk.out
| \.vscode
| build
| dist
| \.mypy_cache
)\
'''
include = '\.pyi?$'
line-length = 135
target-version = ['py311']
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".git",
".mypy_cache",
".pyenv",
".pytest_cache",
".ruff_cache",
".venv",
".vscode",
"build",
"dist",
"site-packages",
"venv",
"**/cdk.out",
]
# Same as Black.
line-length = 135
indent-width = 4
# Assume Python 3.11
target-version = "py311"
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Choose the flake8 errors to ignore globally here
"E501", # Line too long (using B950 instead, which has 10% tolerance)
"D107", # Missing docstring in __init__
"D202", # No blank lines allowed after function docstring
"D203", # No blank lines allowed before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D400", # First line should end with a period
"D415", # First line should end with a period, question mark, or exclamation point
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"ANN003", # Missing type annotation for **kwargs
"ANN002", # Missing type annotation for **args
"ANN101", # Missing type annotation for self in method
"ANN1", # Missing type annotation for self in methot or cls method
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"A002", # Argument `id` is shadowing a Python builtin
"F821", # Undefined name
"FIX002", # Line contains TODO, consider resolving the issue
"B008", # Do not perform function calls in argument defaults
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"N999", # Invalid module name
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.pylint]
max-args = 20
[tool.ruff.lint.per-file-ignores]
"*/__init__.py" = ["F401"]
"**/tests/**" = [
"ANN", # Annotations
"D", # Docstrings
"INP001", # File is part of an implicit namespace package. Add an `__init__.py`.
"S101", # Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
"S105", # Possible hardcoded password
"S106", # Possible hardcoded password
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"
[tool.ruff.lint.isort]
combine-as-imports = true
force-single-line = false
lines-after-imports = 2
lines-between-types = 0
[tool.pytest.ini_options]
addopts = """
-vv
--ignore=functions
--ignore=cdk.out
--color=yes
--cov .
--cov-report=term
--cov-report=xml
"""
minversion = "7.1"
[tool.coverage.run]
omit = ["*/tests/*", "*/__init__.py", "*/*config.py"] # Remove test files from coverage run.
[tool.commitizen]
tag_format = "$version"
version = "0.0.0"
version_files = [
"pyproject.toml:version",
]