Skip to content

Commit b623d21

Browse files
committed
fundamental environment renovation - NO FUNCTIONAL CHANGES
1 parent 06e2f53 commit b623d21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1306
-418
lines changed

.codespellignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
udo
2+
anchestors

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
exclude: ^tests/refdata/.*
12
repos:
23
- repo: https://github.com/astral-sh/ruff-pre-commit
34
# Ruff version.

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Please install these tools:
1212
* [`make`](https://www.gnu.org/software/make/)
1313
* [`git`](https://git-scm.com/)
1414
* [Visual Studio Code](https://code.visualstudio.com/)
15+
* [`graphviz`](https://graphviz.org/)
1516

1617

1718
### Editor
@@ -31,6 +32,8 @@ make all
3132

3233
See `make help` for any further details.
3334

35+
Please note that `tests/refdata` contains reference data from test runs.
36+
`make test2refdata` updates this directory.
3437

3538
## Project Structure
3639

@@ -63,6 +66,8 @@ Next to that, there are some temporary files ignored by version control system.
6366
* 2.x.x can be merged to 3.x.x
6467
* `main`
6568
* 2.x.x can be merged to main
69+
70+
6671
### Release
6772

6873
```bash

Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,23 @@ test: .venv/.valid ## [ALL] Run Unittests via 'pytest' with {PYTEST_OPTIONS}
3131
@echo "See coverage report:\n\n file://${PWD}/htmlcov/index.html\n"
3232

3333

34+
.PHONY: test2refdata
35+
test2refdata: .venv/.valid ## Run Unittests via 'pytest' with {PYTEST_OPTIONS} and update tests/refdata
36+
rm -rf tests/refdata
37+
touch .test2ref
38+
${ENV} pytest -vv ${PYTEST_OPTIONS}
39+
@echo "See coverage report:\n\n file://${PWD}/htmlcov/index.html\n"
40+
rm .test2ref
41+
42+
3443
.PHONY: checktypes
3544
checktypes: .venv/.valid ## [ALL] Run Type-Checking via 'mypy'
36-
${ENV} mypy .
45+
${ENV} mypy src
3746

3847

3948
.PHONY: doc
4049
doc: .venv/.valid ## [ALL] Build Documentation via 'mkdocs'
41-
${ENV} mkdocs build --strict
42-
43-
44-
.PHONY: doc-serve
45-
doc-serve: .venv/.valid ## Start Local Documentation Server via 'mkdocs'
46-
${ENV} mkdocs serve --no-strict
50+
${ENV} make html -C docs
4751

4852

4953
.PHONY: code

conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
@pytest.fixture(autouse=True)
77
def _docdir(request):
8-
98
# Trigger ONLY for the doctests.
109
doctest_plugin = request.config.pluginmanager.getplugin("doctest")
1110
if isinstance(request.node, doctest_plugin.DoctestItem):
12-
1311
# Get the fixture dynamically by its name.
1412
tmpdir = request.getfixturevalue("tmpdir")
1513

docs/index.rst

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,9 @@ Any Python Tree Data
1717
.. image:: https://readthedocs.org/projects/anytree/badge/?version=stable
1818
:target: https://anytree.readthedocs.io/en/stable/
1919

20-
.. image:: https://api.codeclimate.com/v1/badges/e6d325d6fd23a93aab20/maintainability
21-
:target: https://codeclimate.com/github/c0fec0de/anytree/maintainability
22-
:alt: Maintainability
23-
2420
.. image:: https://img.shields.io/pypi/pyversions/anytree.svg
2521
:target: https://pypi.python.org/pypi/anytree
2622

27-
.. image:: https://img.shields.io/badge/code%20style-pep8-brightgreen.svg
28-
:target: https://www.python.org/dev/peps/pep-0008/
29-
30-
.. image:: https://img.shields.io/badge/code%20style-pep257-brightgreen.svg
31-
:target: https://www.python.org/dev/peps/pep-0257/
32-
33-
.. image:: https://img.shields.io/badge/linter-pylint-%231674b1?style=flat
34-
:target: https://www.pylint.org/
35-
36-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
37-
:target: https://github.com/psf/black
38-
3923
.. image:: https://img.shields.io/github/contributors/c0fec0de/anytree.svg
4024
:target: https://github.com/c0fec0de/anytree/graphs/contributors/
4125

@@ -204,7 +188,7 @@ Node('/Mary')
204188

205189
**Extending any python class to become a tree node**
206190

207-
The enitre tree magic is encapsulated by :any:`NodeMixin`,
191+
The entire tree magic is encapsulated by :any:`NodeMixin`,
208192
add it as base class and the class becomes a tree node:
209193

210194
>>> from anytree import NodeMixin, RenderTree

docs/tricks/consistencychecks.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ In case of any concerns about the internal data consistency or just for safety,
1010

1111
>>> import anytree
1212
>>> anytree.config.ASSERTIONS = True
13-

docs/tricks/readonly.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,3 @@ a
136136
│ └── a1a
137137
└── a2
138138
└── a0
139-

docs/tricks/weightededges.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ a (0)
4242
... ).to_picture("weight.png") # doctest: +SKIP
4343

4444
.. image:: ../static/weight.png
45-

docs/tricks/yaml.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,3 @@ AnyNode(a='root')
9898
.. _YAML: https://en.wikipedia.org/wiki/YAML
9999

100100
.. _PYYAML: http://pyyaml.org/wiki/PyYAMLDocumentation
101-

pyproject.toml

Lines changed: 85 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
name = "anytree"
44
dynamic = ["version"]
55
description = "Powerful and Lightweight Python Tree Data Structure with various plugins"
6-
authors = [
7-
"c0fec0de <[email protected]>"
6+
authors = [{ name = "c0fec0de", email = "[email protected]" }]
7+
dependencies = [
8+
"six>=1.17.0",
89
]
10+
requires-python = ">=3.9.2,<4.0"
911
readme = "README.rst"
1012
license = "Apache-2.0"
11-
keywords = [
12-
"tree",
13-
"tree data",
14-
"treelib",
15-
"tree walk",
16-
"tree structure",
17-
]
13+
keywords = ["tree", "tree data", "treelib", "tree walk", "tree structure"]
1814

1915
classifiers = [
2016
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -38,12 +34,13 @@ dev = [
3834
"coveralls>=3.3.1",
3935
"mypy>=1.9.0",
4036
"pytest-cov>=5.0.0",
41-
"pytest-xdist>=3.6.1",
4237
"ruff>=0.11.2",
4338
"pre-commit>=4.2.0",
4439
"sphinx>=5.3.0",
4540
"sphinx-rtd-theme>=2.0.0",
4641
"sphinxemoji>=0.3.1",
42+
"test2ref>=0.4.2",
43+
"types-six>=1.17.0.20250403",
4744
]
4845

4946
[build-system]
@@ -69,72 +66,78 @@ select = [
6966
# pyflakes
7067
"F",
7168
# pycodestyle
72-
"E", "W",
69+
"E",
70+
"W",
7371
# pydocstyle
7472
"D",
75-
# pep8-naming
76-
"N",
77-
# flake8-2020
78-
"YTT",
79-
# flake8-bugbear
80-
"B",
81-
# flake8-quotes
82-
"Q",
83-
# flake8-debugger
84-
"T10",
85-
# flake8-gettext
86-
"INT",
87-
# pylint
88-
"PL",
89-
# misc lints
90-
"PIE",
91-
# flake8-pyi
92-
"PYI",
93-
# tidy imports
94-
"TID",
95-
# implicit string concatenation
96-
"ISC",
97-
# type-checking imports
98-
"TC",
99-
# comprehensions
100-
"C",
101-
"C4",
102-
# pygrep-hooks
103-
"PGH",
104-
# Ruff-specific rules
105-
"RUF",
106-
# flake8-bandit: exec-builtin
107-
"S102",
108-
# numpy-legacy-random
109-
"NPY002",
110-
# Perflint
111-
"PERF",
112-
# flynt
113-
"FLY",
114-
# flake8-logging-format
115-
"G",
116-
# pyupgrade
117-
"UP",
118-
# annotation
119-
# "ANN"
120-
# bandit
121-
"S",
122-
# Argument
123-
# "ARG",
124-
# Pathlib
125-
"PTH",
126-
# Simplify
127-
# "SIM",
128-
# Return
129-
"RET",
130-
# Raise
131-
"RSE",
73+
# # pep8-naming
74+
# "N",
75+
# # flake8-2020
76+
# "YTT",
77+
# # flake8-bugbear
78+
# "B",
79+
# # flake8-quotes
80+
# "Q",
81+
# # flake8-debugger
82+
# "T10",
83+
# # flake8-gettext
84+
# "INT",
85+
# # pylint
86+
# "PL",
87+
# # misc lints
88+
# "PIE",
89+
# # flake8-pyi
90+
# "PYI",
91+
# # tidy imports
92+
# "TID",
93+
# # implicit string concatenation
94+
# "ISC",
95+
# # type-checking imports
96+
# "TC",
97+
# # comprehensions
98+
# "C",
99+
# "C4",
100+
# # pygrep-hooks
101+
# "PGH",
102+
# # Ruff-specific rules
103+
# "RUF",
104+
# # flake8-bandit: exec-builtin
105+
# "S102",
106+
# # numpy-legacy-random
107+
# "NPY002",
108+
# # Perflint
109+
# "PERF",
110+
# # flynt
111+
# "FLY",
112+
# # flake8-logging-format
113+
# "G",
114+
# # pyupgrade
115+
# "UP",
116+
# # annotation
117+
# # "ANN"
118+
# # bandit
119+
# "S",
120+
# # Argument
121+
# # "ARG",
122+
# # Pathlib
123+
# "PTH",
124+
# # Simplify
125+
# # "SIM",
126+
# # Return
127+
# "RET",
128+
# # Raise
129+
# "RSE",
132130
]
133131
ignore = [
134132
# too-many-arguments
135133
'PLR0913',
136134
# Ambiguous doc
137-
'D203', 'D212', 'D402', 'D406',
135+
"D100",
136+
"D101",
137+
'D203',
138+
'D212',
139+
'D402',
140+
'D406',
138141
# Multiline doc is ok.
139142
'D200',
140143
# We use the class for constructor doc
@@ -156,30 +159,37 @@ ignore = [
156159
"PLR2004",
157160
# Argument
158161
"ARG001",
162+
# doc
163+
"D100",
164+
"D101",
165+
"D102",
166+
"D103",
167+
# Unused variables
168+
"F841",
159169
]
160170

161171
[tool.ruff.lint.pydocstyle]
162172
convention = "google"
163173

164174
[tool.pytest.ini_options]
165-
addopts ="""
175+
filterwarnings = [
176+
"ignore::DeprecationWarning",
177+
]
178+
addopts = """
166179
--cov src/anytree
167180
--cov-report term
168181
--cov-report html
169-
--doctest-glob=docs/*
182+
--doctest-glob=docs/*.rst
170183
--doctest-modules
171184
--ignore-glob=tests/testdata/*
172185
--log-level=INFO
173186
--junitxml=report.xml
174187
"""
175-
filterwarnings = [
176-
"error",
177-
]
178188

179189
[tool.coverage.report]
180190
exclude_lines = [
181191
'return NotImplemented',
182-
'raise NotImplementedError()',
192+
'raise NotImplementedError',
183193
'pragma: no cover',
184194
'assert False',
185195
]

0 commit comments

Comments
 (0)