-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
199 lines (184 loc) · 5.58 KB
/
pyproject.toml
File metadata and controls
199 lines (184 loc) · 5.58 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
[project]
name = "sphinx-codelinks"
version = "1.1.0"
description = "Fast Source Code Traceability for Sphinx-Needs"
authors = [{ name = "team useblocks", email = "info@useblocks.com" }]
maintainers = [
{ name = "Marco Heinemann", email = "marco.heinemann@useblocks.com" },
{ name = "Jui-Wen Chen", email = "jui-wen.chen@useblocks.com" },
]
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">= 3.12"
dependencies = [
"comment-parser>=1.2.4",
"gitignore-parser>=0.1.11",
"typer>=0.16.0",
"click < 8.2", # click 8.2.* produces empty errors if no args are given
"jsonschema",
"sphinx>=7.4,<9",
"sphinx-needs>=4.2.0", # unconstrained versions, to be pinned by user or Sphinx
"jinja2",
"pygments",
"docutils", # constrained by user or Sphinx
"tree-sitter-cpp>=0.23.4",
"giturlparse>=0.12.0",
"tree-sitter-python>=0.23.6",
# Compiling issue on manylinux aarch64 image, so install from git instead of Pypi
# https://github.com/tree-sitter/py-tree-sitter/issues/386#issuecomment-3101430799
"tree-sitter~=0.25.1",
"tree-sitter-c-sharp>=0.23.1",
"tree-sitter-yaml>=0.7.1",
"tree-sitter-rust>=0.23.0",
"lark>=1.3.1",
]
[build-system]
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"
[tool.rye]
managed = true
dev-dependencies = [
"types-docutils",
"types-Pygments",
"syrupy>=4.9.1",
"furo>=2024.5.6",
"moto ~= 5.0",
"mypy>=1.12.1",
"myst-parser>=4.0.0",
"pydantic ~= 2.9",
"pip-licenses>=5.0.0",
"psutil>=7.0.0",
"pytest-cov>=5.0.0",
"pytest>=8.2.2",
"simple-build>=0.0.2",
"sphinx-design>=0.6.1",
"types-psutil>=7.0.0.20250218",
"uv>=0.5.5",
"pytest-docker>=3.1.2",
"shiv>=1.0.8",
"insta-science>=0.2.1",
"types-jsonschema>=4.23.0.20241208",
"toml>=0.10.2",
"sphinx-code-tabs>=0.5.5",
"sphinxcontrib-typer>=0.5.1",
"sphinxcontrib-video>=0.4.1",
]
[project.scripts]
codelinks = "sphinx_codelinks.cmd:app"
[tool.rye.scripts]
# linting and formatting
"mypy:all" = "mypy ."
"rye:lint" = "rye lint"
"rye:format" = "rye format"
"check" = { chain = ["rye:format", "rye:lint", "mypy:all"] }
# docs html
"docs:rm" = "rm -rf docs/_build/html"
"docs" = "sphinx-build -nW --keep-going -b html -T -c docs docs/source docs/_build/html"
"docs:clean" = { chain = ["docs:rm", "docs"] }
# needextend demo
"analyse" = "codelinks analyse tests/data/configs/minimum_config.toml"
"analyse:rm" = "rm -rf output/marked_content.json"
"write" = "codelinks write rst output/marked_content.json --outpath tests/data/needextend_demo/needextend.rst"
"write:rm" = "rm -rf tests/data/needextend_demo/needextend.rst"
"demo:rm" = "rm -rf tests/data/needextend_demo/_build"
"demo:build" = "sphinx-build -nW --keep-going -b html -T -c tests/data/needextend_demo tests/data/needextend_demo tests/data/needextend_demo/_build/html"
"demo:clean" = { chain = [
"demo:rm",
"analyse:rm",
"write:rm",
"analyse",
"write",
"demo:build",
] }
[tool.ruff.lint]
extend-select = [
# "ANN",
"S",
"ARG",
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"FURB", # refurb (modernising code)
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PERF", # perflint (performance anti-patterns)
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PTH", # flake8-use-pathlib
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"SLF", # private member access
"UP", # pyupgrade
"T20", # flake8-print
]
extend-ignore = [
"ISC001", # implicit-str-concat
]
[tool.ruff.lint.isort]
split-on-trailing-comma = false
force-sort-within-sections = true
[tool.ruff.lint.per-file-ignores]
"**/tests/*" = [
"ARG001", # unused-function-argument - fixtures
"ARG005", # unused-lambda-argument - monkeypatches
"PLR2004", # magic-value-comparison - valueable for tests
"S101", # assert - needed for tests
]
"**/build_hooks_*/**" = [
"S607", # start-process-with-partial-path - pyarmor call in rye context
"S603", # subprocess-without-shell-equals-true - pyarmor call
]
"scripts/*.py" = [
"T201", # print - used for output
"S607", # start-process-with-partial-path - pyarmor call in rye context
"S603", # subprocess-without-shell-equals-true - build scripts
]
"src/sphinx_codelinks/sphinx_extension/debug.py" = [
"T201", # print - used for output
"UP047", # on-pep695-generic-function - it's generic
]
"src/sphinx_codelinks/cmd.py" = [
"PLC0415", # import on top - only import relevant modules by use cases
]
[tool.mypy]
exclude = ["tests/", "dist/", "docs/_build/", "docs/conf.py"]
show_error_codes = true
warn_unused_ignores = true
warn_redundant_casts = true
strict = true
# disallow dynamic typing
disallow_any_unimported = true
disallow_any_expr = true
# disallow_any_decorated = true
disallow_any_explicit = true
disallow_any_generics = true
disallow_subclassing_any = true
# dissallow untyped definitions and calls
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
plugins = ["pydantic.mypy"]
mypy_path = "typings"
[[tool.mypy.overrides]]
module = ["licensing.*", "tomlkit.*"]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_any_explicit = false
disallow_any_unimported = false
disallow_untyped_defs = false
disallow_any_expr = false
[[tool.mypy.overrides]]
module = "sphinx_codelinks.*"
disallow_any_unimported = false
disallow_untyped_defs = false
disallow_any_expr = false
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
[tool.pytest.ini_options]
testpaths = ["tests"]