-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathpyproject.toml
More file actions
329 lines (297 loc) · 9.2 KB
/
pyproject.toml
File metadata and controls
329 lines (297 loc) · 9.2 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "compliance-trestle"
dynamic = ["version"]
description = "Tools to manage & autogenerate python objects representing the OSCAL layers/models"
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
license-files = ["LICENSE"]
keywords = [
"Compliance",
"Security",
"OSCAL",
]
authors = [
{name = "OSCAL Compass", email = "oscal-compass-oversight@googlegroups.com"}
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Operating System :: Microsoft",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
]
dependencies = [
"attrs",
"ilcli",
"cryptography==46.0.5",
"paramiko==4.0.0",
"ruamel.yaml",
"furl",
"pydantic[email]>=2.0.0",
"python-dotenv>=0.10.4",
"python-frontmatter",
"pywin32 >= 1.0;platform_system=='Windows'",
"defusedxml",
"openpyxl~=3.0",
"Jinja2 == 3.1.6",
"cmarkgfm>=2024.1,<2025.11",
"orjson",
"requests>=2.32.2",
"importlib_resources",
]
[project.optional-dependencies]
# Type checking
typing = [
"mypy",
"types-PyYAML",
"types-paramiko",
"types-requests",
"types-setuptools",
]
# Documentation website
docs = [
"mike",
"mkdocs>=1.6.0",
"mkdocs-awesome-pages-plugin",
"mkdocstrings[python]>=0.25.2",
"mkdocs-htmlproofer-plugin",
"mkdocs-material",
"markdown-include",
"mkdocs-minify-plugin",
"mkdocs-git-revision-date-localized-plugin",
"pymdown-extensions",
"livereload",
"pillow",
"cairosvg",
]
# Development tools (testing via hatch test)
dev = [
"compliance-trestle[typing,docs]",
"pre-commit>=2.4.0",
"python-semantic-release>=10.4.0",
"pylint",
"datamodel-code-generator[http]<0.55.0",
"gitpython",
]
[project.urls]
Homepage = "https://oscal-compass.github.io/compliance-trestle"
Documentation = "https://oscal-compass.github.io/compliance-trestle"
"Source code" = "https://github.com/oscal-compass/compliance-trestle"
[project.scripts]
trestle = "trestle.cli:run"
[tool.hatch.version]
path = "trestle/__init__.py"
[tool.hatch.build.targets.sdist]
include = [
"/trestle",
]
exclude = [
"/tests",
]
[tool.hatch.build.targets.wheel]
packages = ["trestle"]
[tool.hatch.envs.default]
dependencies = [
"coverage[toml]~=7.4",
]
[tool.hatch.envs.hatch-test]
default-args = ["tests"]
parallel = true
randomize = true
dependencies = [
"coverage[toml]~=7.4",
"pytest>=8.1",
"pytest-xdist[psutil]>=3.5",
"pytest-randomly>=3.15",
"mypy",
]
[[tool.hatch.envs.hatch-test.matrix]]
python = ["3.10", "3.11", "3.12"]
[tool.hatch.envs.docs]
features = ["docs"]
[tool.hatch.envs.docs.scripts]
build = "mkdocs build -c -s"
serve = "mkdocs serve"
automation = "python ./scripts/website_automation.py"
validate = ["automation", "build"]
[tool.hatch.envs.hatch-static-analysis]
config-path = "none"
[tool.pytest.ini_options]
minversion = "6.2"
testpaths = [
"tests",
]
[tool.ruff]
line-length = 120
indent-width = 4
target-version = "py310"
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"trestle/oscal",
]
[tool.ruff.format]
quote-style = "single"
indent-style = "space"
skip-magic-trailing-comma = true
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"T20", # flake8-print
"SIM", # flake8-simplify
"S", # flake8-bandit (security)
]
ignore = [
"E501", # line too long (handled by formatter)
"S101", # use of assert (common in tests)
"S603", # subprocess call - check for execution of untrusted input
"S607", # starting a process with a partial executable path
# FIXME: UP - pyupgrade rules to fix
"UP006", # FIXME: Use `type` instead of `Type` for type annotations (1134 errors)
"UP007", # FIXME: Use `X | Y` for Union types (114 errors)
"UP009", # FIXME: UTF-8 encoding declaration is unnecessary (211 errors)
"UP015", # FIXME: Unnecessary open mode parameters (25 errors)
"UP028", # FIXME: Replace `yield` in `for` loop with `yield from` (6 errors)
"UP035", # FIXME: `typing.X` is deprecated, use `x` instead (208 errors)
"UP037", # FIXME: Remove quotes from type annotation (1 error)
"UP039", # FIXME: Unnecessary parentheses after class definition (43 errors)
"UP045", # FIXME: Use `X | None` for type annotations (112 errors)
# FIXME: B - flake8-bugbear rules to fix
"B017", # FIXME: `assertRaises(Exception)` should be considered evil (6 errors)
"B904", # FIXME: Within `except` clause, raise from err or None (82 errors)
# FIXME: SIM - flake8-simplify rules to fix
"SIM101", # FIXME: Multiple `isinstance` calls, merge into one (2 errors)
"SIM102", # FIXME: Use a single `if` instead of nested `if` (22 errors)
"SIM103", # FIXME: Return condition directly instead of `if`-`else` (1 error)
"SIM105", # FIXME: Use `contextlib.suppress(...)` instead of `try`-`except`-`pass` (4 errors)
"SIM108", # FIXME: Use ternary operator instead of `if`-`else` block (30 errors)
"SIM115", # FIXME: Use context handler for opening files (18 errors)
"SIM118", # FIXME: Use `key in dict` instead of `key in dict.keys()` (67 errors)
"SIM201", # FIXME: Use `!=` instead of `not ... ==` (11 errors)
"SIM210", # FIXME: Use `bool(...)` instead of `True if ... else False` (3 errors)
"SIM300", # FIXME: Yoda conditions are discouraged (29 errors)
"SIM910", # FIXME: Use `dict.get(key)` instead of `dict.get(key, None)` (3 errors)
# FIXME: E - pycodestyle rules to fix
"E721", # FIXME: Do not compare types, use `isinstance()` (15 errors)
# FIXME: W - pycodestyle warnings to fix
"W605", # FIXME: Invalid escape sequence (36 errors)
# FIXME: I - isort rules to fix
"I001", # FIXME: Import block is un-sorted or un-formatted (106 errors)
# FIXME: N - pep8-naming rules to fix
"N804", # FIXME: First argument of classmethod should be `cls` (1 error)
# FIXME: S - flake8-bandit security rules to fix
"S110", # FIXME: `try`-`except`-`pass` detected (4 errors)
"S701", # FIXME: Using jinja2 templates with `autoescape=False` (5 errors)
# FIXME: F - Pyflakes rules to fix
"F401", # FIXME: Unused import (7 errors)
# FIXME: C4 - flake8-comprehensions rules to fix
"C408", # FIXME: Unnecessary dict/list/tuple call (1 error)
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests
"S105", # possible hardcoded password
"S106", # possible hardcoded password
"S108", # probable insecure usage of temp file
]
"scripts/**/*.py" = [
"T20", # print statements allowed in scripts
]
[tool.ruff.lint.isort]
known-first-party = ["trestle"]
# Black config is used by datamodel-codegen when generating OSCAL models.
# Line-length 500 ensures single-line Field() definitions for consistent
# body text comparison in oscal_normalize.py.
[tool.black]
line-length = 500
[tool.isort]
line_length = 500
[tool.mypy]
plugins = ["pydantic.mypy"]
ignore_missing_imports = true
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_reexport = true
show_error_codes = true
show_error_context = true
disallow_untyped_defs = true
disable_error_code = ["union-attr", "attr-defined", "no-redef", "assignment", "arg-type", "list-item"]
[[tool.mypy.overrides]]
module = "trestle.oscal.*"
ignore_errors = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.coverage.run]
relative_files = true
[tool.semantic_release]
build_command = """
python -m pip install build --upgrade
python -m build
"""
version_variables = ["trestle/__init__.py:__version__"]
commit_author = "semantic-release <semantic-release>"
[tool.semantic_release.branches.alpha]
match = "^(feat|fix|perf)/.+"
prerelease = true
prerelease_token = "alpha"
[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0
[tool.semantic_release.branches.main]
match = "(main)"
prerelease_token = "rc"
prerelease = false
[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = false
insecure = false
[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]