-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpyproject.toml
More file actions
213 lines (197 loc) · 6.29 KB
/
Copy pathpyproject.toml
File metadata and controls
213 lines (197 loc) · 6.29 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
[build-system]
build-backend = "setuptools.build_meta"
requires = [ "setuptools>=82.0.1", "setuptools-scm>=10.0.5" ]
[project]
name = "almanack"
description = "An open-source handbook of applied guidance and tools for sustainable software development and maintenance."
readme = "README.md"
license = "BSD-3-Clause"
license-files = [ "LICENSE.txt" ]
authors = [
{ name = "Software Gardening Community" },
]
requires-python = ">=3.10,<3.14"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = [ "version" ]
dependencies = [
"charset-normalizer>=3.4,<4",
"currencyconverter>=0.18.15,<0.19",
"defusedxml>=0.7.1,<0.8",
"fire>=0.6,<0.8",
"pandas>=2.2.2",
"pyarrow>=16",
"pygit2>=1.15.1; python_version<='3.12'",
"pygit2>=1.18.2; python_version>'3.12'",
"pyyaml>=6.0.1,<7",
"requests>=2.32.3,<3",
"tabulate>=0.9,<0.11",
"tomli>=2; python_version<'3.11'",
]
scripts.almanack = "almanack.cli:trigger"
[dependency-groups]
dev = [
"black>=24.4.2,<27",
"coverage>=7.5.3,<8",
"jsonschema>=4.23,<5",
"jupyterlab-code-formatter>=2.2.1,<4",
"jupyterlab-spellchecker>=0.8.4,<0.10",
"kaleido==1.3",
"linkchecker>=10.4,<11",
"playwright>=1.51,<2",
"poethepoet>=0.25,<0.49",
"pygithub>=2.3,<3",
"pytest>=8.1.1,<10",
"requests>=2.32.3,<3",
"vale>=3.3.1,<4",
]
book = [
"docutils==0.21.2",
"jinja2>=3.1.6,<4",
"jupyter-book>=1,<2",
"jupyterlab>=4.2.3,<5",
"plotly>=5.22,<7",
"sphinxcontrib-bibtex>=2.6.2,<3",
]
[tool.setuptools]
packages.find.where = [ "src" ]
packages.find.include = [ "almanack*" ]
include-package-data = true
data-files."book/_posters/2025" = [
"src/book/_posters/2025/*.md",
]
data-files."book/_static" = [
"src/book/_static/*.css",
"src/book/_static/*.pdf",
]
data-files."book/garden-circle" = [ "src/book/garden-circle/*.md" ]
data-files."book/garden-lattice" = [ "src/book/garden-lattice/*.md" ]
data-files."book/seed-bank" = [ "src/book/seed-bank/*.md" ]
data-files."book/seed-bank/almanack-example/almanack" = [
"src/book/seed-bank/almanack-example/almanack/*.md",
]
data-files."book/seed-bank/almanack-example/almanack/docs" = [
"src/book/seed-bank/almanack-example/almanack/docs/*.md",
]
data-files."book/software-forest" = [ "src/book/software-forest/*.md" ]
data-files."book/verdant-sundial" = [ "src/book/verdant-sundial/*.md" ]
data-files.book = [
"src/book/*.md",
"src/book/*.yml",
"src/book/references.bib",
]
[tool.setuptools_scm]
version_file = "src/almanack/_version.py"
root = "."
[tool.ruff]
target-version = "py311"
fix = true
lint.select = [
# mccabe
"C90",
# pyflakes
"F",
# pylint
"PL",
# ruff
"RUF",
# flake8-print
"T20",
]
# defines poe the poet tasks
# Ignore `E402` and `F401` (unused imports) in all `__init__.py` files
lint.per-file-ignores."__init__.py" = [ "F401" ]
lint.per-file-ignores."src/book/seed-bank/*" = [ "T201" ]
lint.per-file-ignores."tests/*" = [ "PLR2004" ]
[tool.isort]
profile = "black"
[tool.codespell]
ignore-words = "styles/config/vocabularies/almanack/accept.txt"
# add capabilities for inline ignore for codespell linting
# referenced from: https://github.com/codespell-project/codespell/issues/1212
ignore-regex = ".{1024}|.*codespell-ignore.*"
# Skip lockfiles, JSON, bibliography, notebooks (formerly excluded via
# pre-commit's `exclude:` field) and PDFs so `codespell` can be run directly.
skip = "*.lock,*.json,*.bib,*.ipynb,*.pdf"
[tool.bandit]
exclude_dirs = [ "tests" ]
[tool.pytest]
ini_options.testpaths = "tests"
ini_options.markers = [
"links: tests which involve checking for hyperlink rot.",
]
[tool.vulture]
paths = [ "src/almanack", "tests" ]
min_confidence = 90
[tool.poe]
# builds the jupyter book related to this project
# note: we include the pythonpath var to properly build sphinx autodocs
tasks.build-book.shell = """ PYTHONPATH="./src/almanack" jupyter-book build src/book --all
"""
# build a PDF from the HTML content
# note: depends on build-book content and creates copy to avoid
# single-page changes performed on the HTML build.
tasks.build-book-pdf.shell = """
cp -r src/book src/_pdfbuild &&
jupyter-book build src/_pdfbuild --builder pdfhtml
"""
# builds the jupyter book related to this project and opens a new browser window
# note: we include the pythonpath var to properly build sphinx autodocs
tasks.build-book-dev.shell = """ PYTHONPATH="./src/almanack" jupyter-book build src/book && python -m webbrowser -t "file://$PWD/src/book/_build/html/index.html"
"""
# syncs and runs vale relative to this project
# through pre-commit to trigger warnings as
# non-zero return when there is more than one
# line of output from vale.
tasks.vale-checks.shell = """vale sync || true;
output=$(vale ./src/book) ||
if [ $(echo "$output" | wc -l) -gt 1 ]; then
echo "$output"; exit 1;
fi
"""
# add a convenience task for package-focused testing
tasks.pkg-tests.shell = """
pytest --ignore tests/test_build.py
"""
# task for running code coverage report steps
tasks.code-coverage-report.shell = """coverage run -m pytest --ignore tests/test_build.py
coverage report
coverage xml -o new_cov.xml
# Define a Python function for reusable attribute extraction
PYTHON_FUNC="
import xml.etree.ElementTree as ET
def extract_relevant_attributes(file):
attributes = ET.parse(file).getroot().attrib
return [
attributes.get('version'),
round(float(attributes.get('line-rate', 0)), 2),
round(float(attributes.get('branch-rate', 0)), 2),
]
if __name__ == '__main__':
import sys
file_path = sys.argv[1]
print(extract_relevant_attributes(file_path))
"
# Check if the existing coverage file exists
if [[ ! -f "coverage.xml" ]]; then
echo "Existing coverage file not found. Creating a new one."
mv "new_cov.xml" "coverage.xml"
exit 0
fi
# Extract attributes (excluding timestamp) from both files using Python
EXISTING_ATTRS=$(python -c "$PYTHON_FUNC" "coverage.xml")
NEW_ATTRS=$(python -c "$PYTHON_FUNC" "new_cov.xml")
# Compare the extracted attributes
if [[ "$EXISTING_ATTRS" != "$NEW_ATTRS" ]]; then
echo "Files differ (ignoring timestamps). Replacing the existing file."
mv "new_cov.xml" "coverage.xml"
else
echo "No differences found (ignoring timestamps)."
rm "new_cov.xml"
fi
"""