Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
168 lines (150 loc) · 4.55 KB
/
Copy pathpyproject.toml
File metadata and controls
168 lines (150 loc) · 4.55 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
[project]
name = "scriptize"
version = "0.1.0"
description = "Improve maintainability, readability, and efficiency of your scripts by standardize your scripting environment."
authors = [
{name = "Jonathan T. da Silva", email = "jonathantosilva@hotmail.com"}
]
license = "MIT"
license-files = ["LICENSE"]
readme = "README.md"
requires-python = ">=3.13,<4.0"
dependencies = [
"typer>=0.29.1,<0.30",
"rich>=15.0.0,<16",
"validators>=0.36.0,<0.37",
]
[dependency-groups]
dev = [
"pytest>=9.0.3,<10",
"pytest-cov>=7.1.0,<8",
"ruff>=0.12.1",
"taskipy>=1.14.1,<2",
"pyright>=1.1.400",
"pydantic>=2.11.7,<3",
"pre-commit>=4.2.0,<5",
"allure-pytest>=2.15.0,<3",
]
doc = [
"mkdocs>=1.6.1,<2",
"mkdocs-material>=9.6.15,<10",
"mkdocstrings>=1.0.8,<1.1",
"mkdocstrings-python>=2.0.11,<3",
]
[tool.uv]
# A collection of scripts and templates, not an installable package.
package = false
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".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",
]
line-length = 100
indent-width = 4
target-version = "py313"
[tool.ruff.lint]
select = ["ALL"]
# Putting an entry in `ignore` will ignore all errors that start with that string.
# For example, adding `T` will ignore all errors beginning with `T`,
# whereas adding `T20` will only ignore the `T20` error
# (and probably any errors that start with `T20`)
ignore = [
'Q000',
'Q003',
'CPY001', # no copyright header in source files
'COM812',
'FIX002',
'TD003',
]
fixable = ["ALL"] # ['A', 'B', 'C', 'D', 'E', 'F', 'Q']
unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[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"
# I like the google docstyle
# See https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
# and http://google.github.io/styleguide/pyguide.html
# https://gist.github.com/redlotus/3bc387c2591e3e908c9b63b97b11d24e
[tool.ruff.lint.pydocstyle]
convention = 'google' # Or 'numpy', or 'pep257'
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.pytest.ini_options]
pythonpath = [
".", "scriptize", "fuzz",
]
addopts = "--doctest-modules"
[tool.taskipy.tasks]
# MAIN COMMANDS
test = "uv run task _check && uv run task _pytest_local"
site = "uv run task _build_site && echo 'Site built successfully! Run `uv run task serve` to preview.' || echo 'Site build failed. Run `uv run task _build_site` for detailed logs.'"
docs = "uv run --group doc mkdocs serve"
serve = "python -m http.server --directory site 8008"
# QUALITY CHECKS
lint = "ruff check . && ruff format --check ."
typecheck = "pyright"
_check = "uv run task lint && uv run task typecheck"
format = "ruff format . && ruff check --fix ."
post_test = "coverage html"
# CORE TEST
_pytest_local = "rm -rf test/allure-results && uv run pytest -s -x --cov=scriptize -vv --alluredir=test/allure-results"
_pytest_ci = "rm -rf test/allure-results && uv run pytest -s --cov=scriptize -vv --alluredir=test/allure-results"
# CORE BUILD
_docs_build = "uv run --group doc mkdocs build --clean"
_report_build = """
mkdir -p test/allure-history && \
cp -r test/allure-history/history test/allure-results/ 2>/dev/null || true && \
uv run python test/scripts/generate_executor.py && \
allure -q generate test/allure-results --clean -o site/test-report/allure && \
cp -r site/test-report/allure/history test/allure-history/
"""
_build_site = """
echo '[1/3] Running tests...' && uv run task _pytest_local >/dev/null 2>&1 && \
echo '[2/3] Building documentation...' && uv run task _docs_build >/dev/null 2>&1 && \
echo '[3/3] Building test report...' && uv run task _report_build >/dev/null 2>&1
"""
# GITHUB CI
ci = "uv run task _check && uv run task _pytest_ci"
[tool.coverage.html]
directory = "site/test-report/coverage"
[tool.coverage.report]
fail_under = 95
[tool.coverage.run]
branch = true
source = ["scriptize"]
[tool.pyright]
# TODO: raise to "strict" once the legacy code is typed (see #7).
typeCheckingMode = "basic"
pythonVersion = "3.13"
include = ["scriptize", "test"]
extraPaths = ["fuzz"]