cpuz_parser 0.2.0b0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. cpuz_parser-0.2.0b0/.gitattributes +3 -0
  2. cpuz_parser-0.2.0b0/.github/workflows/ci.yaml +68 -0
  3. cpuz_parser-0.2.0b0/.github/workflows/tests.yaml +61 -0
  4. cpuz_parser-0.2.0b0/.gitignore +251 -0
  5. cpuz_parser-0.2.0b0/.python-version +1 -0
  6. cpuz_parser-0.2.0b0/.vscode/settings.example.json +70 -0
  7. cpuz_parser-0.2.0b0/LICENSE +21 -0
  8. cpuz_parser-0.2.0b0/PKG-INFO +48 -0
  9. cpuz_parser-0.2.0b0/README.md +3 -0
  10. cpuz_parser-0.2.0b0/config.example.json +9 -0
  11. cpuz_parser-0.2.0b0/mise.toml +107 -0
  12. cpuz_parser-0.2.0b0/noxfile.py +46 -0
  13. cpuz_parser-0.2.0b0/pyproject.toml +316 -0
  14. cpuz_parser-0.2.0b0/src/cpuz_parser/__init__.py +6 -0
  15. cpuz_parser-0.2.0b0/src/cpuz_parser/__main__.py +5 -0
  16. cpuz_parser-0.2.0b0/src/cpuz_parser/cli.py +205 -0
  17. cpuz_parser-0.2.0b0/src/cpuz_parser/exporters.py +175 -0
  18. cpuz_parser-0.2.0b0/src/cpuz_parser/features.py +38 -0
  19. cpuz_parser-0.2.0b0/src/cpuz_parser/parsers.py +249 -0
  20. cpuz_parser-0.2.0b0/src/cpuz_parser/py.typed +0 -0
  21. cpuz_parser-0.2.0b0/tests/conftest.py +85 -0
  22. cpuz_parser-0.2.0b0/tests/fixtures/sample_report.txt +52 -0
  23. cpuz_parser-0.2.0b0/tests/fixtures/sections/bios.txt +4 -0
  24. cpuz_parser-0.2.0b0/tests/fixtures/sections/cpu.txt +2 -0
  25. cpuz_parser-0.2.0b0/tests/fixtures/sections/gpu.txt +2 -0
  26. cpuz_parser-0.2.0b0/tests/fixtures/sections/motherboard.txt +3 -0
  27. cpuz_parser-0.2.0b0/tests/fixtures/sections/os.txt +1 -0
  28. cpuz_parser-0.2.0b0/tests/fixtures/sections/ram.txt +23 -0
  29. cpuz_parser-0.2.0b0/tests/test_cli.py +491 -0
  30. cpuz_parser-0.2.0b0/tests/test_exporters.py +249 -0
  31. cpuz_parser-0.2.0b0/tests/test_features.py +67 -0
  32. cpuz_parser-0.2.0b0/tests/test_parsers.py +333 -0
  33. cpuz_parser-0.2.0b0/tests/test_smoke_txt_reports.py +93 -0
  34. cpuz_parser-0.2.0b0/uv.lock +2671 -0
@@ -0,0 +1,3 @@
1
+ # CPU-Z fixture files must preserve CRLF line endings and CP1252 (Windows-1252) encoding
2
+ /priv_fixtures/**/*.txt text eol=crlf working-tree-encoding=cp1252
3
+ /tests/fixtures/**/*.txt text eol=crlf working-tree-encoding=cp1252
@@ -0,0 +1,68 @@
1
+ name: Run automatic Continuous Integration
2
+ on:
3
+ pull_request:
4
+ workflow_dispatch:
5
+ inputs:
6
+ lint:
7
+ description: 'Run Linter?'
8
+ required: false
9
+ type: boolean
10
+ default: true
11
+ typecheck:
12
+ description: 'Run Static Type Check?'
13
+ required: false
14
+ type: boolean
15
+ default: true
16
+ seccheck:
17
+ description: 'Run Static Security Analysis?'
18
+ required: false
19
+ type: boolean
20
+ default: true
21
+ nox_tests:
22
+ description: 'Run nox tests Session?'
23
+ required: false
24
+ type: boolean
25
+ default: true
26
+
27
+ jobs:
28
+ ci:
29
+ name: Run Continuous Integration
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout Code
33
+ uses: actions/checkout@v7
34
+
35
+ - name: Install mise
36
+ run: |
37
+ curl https://mise.run | sh
38
+ echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
39
+ echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
40
+
41
+ - name: Install Dependencies
42
+ env:
43
+ NOX_TESTS: ${{ github.event_name != 'pull_request' && inputs.nox_tests }}
44
+ run: |
45
+ set -e
46
+ mise install
47
+ mise run install_deps:ci
48
+
49
+ - name: Run Linter
50
+ if: ${{ github.event_name == 'pull_request' || inputs.lint }}
51
+ run: |
52
+ mise run lint
53
+
54
+ - name: Run Static Type Check
55
+ if: ${{ github.event_name == 'pull_request' || inputs.typecheck }}
56
+ run: |
57
+ mise run typecheck
58
+
59
+ - name: Run Static Security Analysis
60
+ if: ${{ github.event_name == 'pull_request' || inputs.seccheck }}
61
+ run: |
62
+ mise run seccheck
63
+
64
+ # FIXME: download the 'priv_fixtures/real-cpuz-reports/TXTs'
65
+ - name: Run nox tests Session
66
+ if: ${{ github.event_name != 'pull_request' && inputs.nox_tests }}
67
+ run: |
68
+ mise run test:nox
@@ -0,0 +1,61 @@
1
+ name: Run automatic Tests
2
+ on:
3
+ pull_request:
4
+ workflow_dispatch:
5
+ inputs:
6
+ unit:
7
+ description: 'Run unit tests?'
8
+ required: false
9
+ type: boolean
10
+ default: true
11
+ slow:
12
+ description: 'Run slow tests?'
13
+ required: false
14
+ type: boolean
15
+ default: true
16
+ smoke:
17
+ description: 'Run smoke tests?'
18
+ required: false
19
+ type: boolean
20
+ default: true
21
+
22
+ jobs:
23
+ tests:
24
+ name: Run Tests
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: Checkout Code
28
+ uses: actions/checkout@v7
29
+
30
+ - name: Install mise
31
+ run: |
32
+ curl https://mise.run | sh
33
+ echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
34
+ echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
35
+
36
+ - name: Install Dependencies
37
+ run: |
38
+ set -e
39
+ mise install
40
+ mise run install_deps:tests
41
+
42
+ # FIXME: download the 'priv_fixtures/real-cpuz-reports/TXTs'
43
+ - name: Run Tests
44
+ env:
45
+ UNIT_TESTS: ${{ github.event_name == 'pull_request' || inputs.unit }}
46
+ SLOW_TESTS: ${{ github.event_name == 'pull_request' || inputs.slow }}
47
+ SMOKE_TESTS: ${{ github.event_name == 'pull_request' || inputs.smoke }}
48
+ run: |
49
+ set -e
50
+ markers=()
51
+ [[ "$UNIT_TESTS" == false ]] && markers+=("not unit")
52
+ [[ "$SLOW_TESTS" == false ]] && markers+=("not slow")
53
+ [[ "$SMOKE_TESTS" == false ]] && markers+=("not smoke")
54
+ if ((${#markers[@]})); then
55
+ IFS=':'
56
+ marker="${markers[*]}"
57
+ marker="${marker//:/ and }"
58
+ mise test -- -m "$marker"
59
+ else
60
+ mise test
61
+ fi
@@ -0,0 +1,251 @@
1
+ # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2
+ # Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,python,linux
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,python,linux
4
+
5
+ ### Linux ###
6
+ *~
7
+
8
+ # temporary files which can be created if a process still has a handle open of a deleted file
9
+ .fuse_hidden*
10
+
11
+ # KDE directory preferences
12
+ .directory
13
+
14
+ # Linux trash folder which might appear on any partition or disk
15
+ .Trash-*
16
+
17
+ # .nfs files are created when an open file is removed but is still being accessed
18
+ .nfs*
19
+
20
+ ### Python ###
21
+ # Byte-compiled / optimized / DLL files
22
+ __pycache__/
23
+ *.py[cod]
24
+ *$py.class
25
+
26
+ # C extensions
27
+ *.so
28
+
29
+ # Distribution / packaging
30
+ .Python
31
+ build/
32
+ develop-eggs/
33
+ dist/
34
+ downloads/
35
+ eggs/
36
+ .eggs/
37
+ lib/
38
+ lib64/
39
+ parts/
40
+ sdist/
41
+ var/
42
+ wheels/
43
+ share/python-wheels/
44
+ *.egg-info/
45
+ .installed.cfg
46
+ *.egg
47
+ MANIFEST
48
+
49
+ # PyInstaller
50
+ # Usually these files are written by a python script from a template
51
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
52
+ *.manifest
53
+ *.spec
54
+
55
+ # Installer logs
56
+ pip-log.txt
57
+ pip-delete-this-directory.txt
58
+
59
+ # Unit test / coverage reports
60
+ htmlcov/
61
+ .tox/
62
+ .nox/
63
+ .coverage
64
+ .coverage.*
65
+ .cache
66
+ nosetests.xml
67
+ coverage.xml
68
+ *.cover
69
+ *.py,cover
70
+ .hypothesis/
71
+ .pytest_cache/
72
+ cover/
73
+
74
+ # Translations
75
+ *.mo
76
+ *.pot
77
+
78
+ # Django stuff:
79
+ *.log
80
+ local_settings.py
81
+ db.sqlite3
82
+ db.sqlite3-journal
83
+
84
+ # Flask stuff:
85
+ instance/
86
+ .webassets-cache
87
+
88
+ # Scrapy stuff:
89
+ .scrapy
90
+
91
+ # Sphinx documentation
92
+ docs/_build/
93
+
94
+ # PyBuilder
95
+ .pybuilder/
96
+ target/
97
+
98
+ # Jupyter Notebook
99
+ .ipynb_checkpoints
100
+
101
+ # IPython
102
+ profile_default/
103
+ ipython_config.py
104
+
105
+ # pyenv
106
+ # For a library or package, you might want to ignore these files since the code is
107
+ # intended to run in multiple environments; otherwise, check them in:
108
+ # .python-version
109
+
110
+ # pipenv
111
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
112
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
113
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
114
+ # install all needed dependencies.
115
+ #Pipfile.lock
116
+
117
+ # poetry
118
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
119
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
120
+ # commonly ignored for libraries.
121
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
122
+ #poetry.lock
123
+
124
+ # pdm
125
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
126
+ #pdm.lock
127
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
128
+ # in version control.
129
+ # https://pdm.fming.dev/#use-with-ide
130
+ .pdm.toml
131
+
132
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
133
+ __pypackages__/
134
+
135
+ # Celery stuff
136
+ celerybeat-schedule
137
+ celerybeat.pid
138
+
139
+ # SageMath parsed files
140
+ *.sage.py
141
+
142
+ # Environments
143
+ .env
144
+ .venv
145
+ env/
146
+ venv/
147
+ ENV/
148
+ env.bak/
149
+ venv.bak/
150
+
151
+ # Spyder project settings
152
+ .spyderproject
153
+ .spyproject
154
+
155
+ # Rope project settings
156
+ .ropeproject
157
+
158
+ # mkdocs documentation
159
+ /site
160
+
161
+ # mypy
162
+ .mypy_cache/
163
+ .dmypy.json
164
+ dmypy.json
165
+
166
+ # Pyre type checker
167
+ .pyre/
168
+
169
+ # pytype static type analyzer
170
+ .pytype/
171
+
172
+ # Cython debug symbols
173
+ cython_debug/
174
+
175
+ # PyCharm
176
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
177
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
179
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
180
+ #.idea/
181
+
182
+ ### Python Patch ###
183
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
184
+ poetry.toml
185
+
186
+ # ruff
187
+ .ruff_cache/
188
+
189
+ # LSP config files
190
+ pyrightconfig.json
191
+
192
+ ### VisualStudioCode ###
193
+ .vscode/*
194
+ !.vscode/settings.json
195
+ !.vscode/tasks.json
196
+ !.vscode/launch.json
197
+ !.vscode/extensions.json
198
+ !.vscode/*.code-snippets
199
+
200
+ # Local History for Visual Studio Code
201
+ .history/
202
+
203
+ # Built Visual Studio Code Extensions
204
+ *.vsix
205
+
206
+ ### VisualStudioCode Patch ###
207
+ # Ignore all local history of files
208
+ .history
209
+ .ionide
210
+
211
+ ### Windows ###
212
+ # Windows thumbnail cache files
213
+ Thumbs.db
214
+ Thumbs.db:encryptable
215
+ ehthumbs.db
216
+ ehthumbs_vista.db
217
+
218
+ # Dump file
219
+ *.stackdump
220
+
221
+ # Folder config file
222
+ [Dd]esktop.ini
223
+
224
+ # Recycle Bin used on file shares
225
+ $RECYCLE.BIN/
226
+
227
+ # Windows Installer files
228
+ *.cab
229
+ *.msi
230
+ *.msix
231
+ *.msm
232
+ *.msp
233
+
234
+ # Windows shortcuts
235
+ *.lnk
236
+
237
+ # End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,python,linux
238
+
239
+ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
240
+
241
+ .vscode/settings.json
242
+ .vscode/tasks.json
243
+ .vscode/launch.json
244
+ !.vscode/*.example.*
245
+
246
+ config.json
247
+
248
+ /priv_fixtures/
249
+
250
+ /*.bkp
251
+ /*.bak
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,70 @@
1
+ {
2
+ // "python.defaultInterpreterPath": "/bin/python",
3
+ // "python.defaultInterpreterPath": "${workspaceFolder}\\.venv\\Scripts\\python.exe",
4
+ // "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
5
+ "python-envs.defaultEnvManager": "ms-python.python:venv",
6
+ // "python-envs.pythonProjects": [],
7
+ "python.analysis.extraPaths": ["./src"],
8
+ // "python.envFile": "${workspaceFolder}/.env",
9
+ "terminal.integrated.env.linux": {
10
+ "PYTHONPATH": "${workspaceFolder}/src",
11
+ },
12
+ "terminal.integrated.env.windows": {
13
+ "PYTHONPATH": "${workspaceFolder}\\src",
14
+ },
15
+ "code-runner.executorMap": {
16
+ // "python": ".venv/bin/python -u"
17
+ "python": ".venv\\Scripts\\python.exe -u"
18
+ },
19
+ "python.analysis.typeCheckingMode": "off",
20
+ "mypy-type-checker.importStrategy": "fromEnvironment",
21
+ // "mypy-type-checker.path": ["mypy"],
22
+ // "mypy-type-checker.args": ["--enable-incomplete-feature=NewGenericSyntax"],
23
+ "bandit.args": [
24
+ "-c",
25
+ "pyproject.toml",
26
+ ],
27
+ "python.testing.unittestEnabled": false,
28
+ "python.testing.pytestEnabled": true,
29
+ "python.testing.pytestArgs": [], // -x to bail
30
+ "files.watcherExclude": {
31
+ ".venv/": true,
32
+ "*_cache/": true,
33
+ ".nox/": true,
34
+ "volumes/": true
35
+ },
36
+ "cSpell.words": [
37
+ "addopts",
38
+ "ausencias",
39
+ "autobuild",
40
+ "Chipset",
41
+ "copybutton",
42
+ "cpuz",
43
+ "Cpuz",
44
+ "debugpy",
45
+ "DIMM",
46
+ "docsw",
47
+ "doctest",
48
+ "freqs",
49
+ "htmlcov",
50
+ "importlib",
51
+ "LICEN",
52
+ "linkify",
53
+ "MYPYPATH",
54
+ "myst",
55
+ "nopause",
56
+ "numprocesses",
57
+ "pdbcls",
58
+ "psutil",
59
+ "pycache",
60
+ "pydata",
61
+ "pythonpath",
62
+ "seccheck",
63
+ "setuptools",
64
+ "sphinxcontrib",
65
+ "testd",
66
+ "testpaths",
67
+ "Versao",
68
+ "xdist"
69
+ ]
70
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Elias De Nadai Nalesso Silva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.5
2
+ Name: cpuz_parser
3
+ Version: v0.2.0-beta
4
+ Summary: Parse CPU-Z TXT report file into a structured object and a human-readable string
5
+ Project-URL: Home Page, https://github.com/Eliasdns/cpuz_parser
6
+ Project-URL: GitHub, https://github.com/Eliasdns/cpuz_parser
7
+ Project-URL: Repository, https://github.com/Eliasdns/cpuz_parser.git
8
+ Project-URL: Issues, https://github.com/Eliasdns/cpuz_parser/issues
9
+ Author-email: Elias De Nadai Nalesso Silva <pro.eliasdns@gmail.com>
10
+ License-Expression: MIT
11
+ Keywords: cpu,cpu-z,cpuz,human-readable,parser,processing,report,structured,txt,z
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Natural Language :: English
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: System :: Hardware
26
+ Classifier: Topic :: System :: Systems Administration
27
+ Classifier: Topic :: Text Processing
28
+ Classifier: Topic :: Utilities
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.11
31
+ Requires-Dist: click
32
+ Provides-Extra: all
33
+ Requires-Dist: pyyaml; extra == 'all'
34
+ Requires-Dist: rich; extra == 'all'
35
+ Requires-Dist: rich-click; extra == 'all'
36
+ Requires-Dist: tomli-w; extra == 'all'
37
+ Provides-Extra: rich
38
+ Requires-Dist: rich; extra == 'rich'
39
+ Requires-Dist: rich-click; extra == 'rich'
40
+ Provides-Extra: toml
41
+ Requires-Dist: tomli-w; extra == 'toml'
42
+ Provides-Extra: yaml
43
+ Requires-Dist: pyyaml; extra == 'yaml'
44
+ Description-Content-Type: text/markdown
45
+
46
+ # cpuz_parser
47
+
48
+ Parse CPU-Z TXT report file into a structured object and a human-readable string
@@ -0,0 +1,3 @@
1
+ # cpuz_parser
2
+
3
+ Parse CPU-Z TXT report file into a structured object and a human-readable string
@@ -0,0 +1,9 @@
1
+ {
2
+ "auto_combine_slots": true,
3
+ "ram_freqs_single_mul2_to_friendly": {
4
+ "1334": "1333",
5
+ "1778": "1775",
6
+ "2132": "2133",
7
+ "2134": "2133"
8
+ }
9
+ }
@@ -0,0 +1,107 @@
1
+ [tools]
2
+ uv = "latest"
3
+
4
+ [shell_alias]
5
+ # m = "mise"
6
+ mr = "mise run"
7
+ mx = "mise exec --"
8
+
9
+ [settings]
10
+ # python.uv_venv_auto = "source"
11
+ # to create if missing:
12
+ python.uv_venv_auto = "create|source"
13
+
14
+ [env]
15
+ _.python.venv = { create = true, path = ".venv" }
16
+ # To strictly ensure uv uses mise's managed Python interpreter:
17
+ # UV_PYTHON = { value = "{{ tools.python.path }}", tools = true }
18
+
19
+
20
+ [tasks.uv-sync-all]
21
+ alias="uvs"
22
+ description = "uv sync, with all extras and all groups."
23
+ run = "uv sync --all-extras --all-groups"
24
+
25
+ [tasks.install_deps]
26
+ description = "Install project dependencies."
27
+ run = "uv sync --frozen --no-install-project --no-dev"
28
+
29
+ [tasks."install_deps:ci"]
30
+ description = "Install project dependencies, for CI."
31
+ run = "uv sync --frozen --no-install-project --no-dev --group ci"
32
+
33
+ [tasks."install_deps:tests"]
34
+ description = "Install project dependencies, for automatic tests."
35
+ run = "uv sync --frozen --no-install-project --no-dev --group tests"
36
+
37
+ [tasks.test]
38
+ description = "Run tests."
39
+ # To run tests in parallel (pytest-xdist): pytest -n auto
40
+ run = "pytest"
41
+
42
+ [tasks."test:debug"]
43
+ alias = "testd"
44
+ description = "Run tests, with debug support."
45
+ # run = "mise run test --pdb --pdbcls=IPython.terminal.debugger:TerminalPdb -s"
46
+ run = "mise run test -s"
47
+
48
+ [tasks."test:nox"]
49
+ alias = "nox"
50
+ description = "Run nox tests session."
51
+ # XXX: --parallel/-j are experimental for now
52
+ run = "nox -j 6 --allow-parallel -v -s tests"
53
+
54
+ [tasks.coverage]
55
+ alias = "cov"
56
+ description = "Report test coverage."
57
+ run = [
58
+ "coverage run -m pytest",
59
+ "coverage html",
60
+ ]
61
+
62
+ [tasks.lint]
63
+ description = "Run linter."
64
+ run = "ruff check ."
65
+
66
+ [tasks.typecheck]
67
+ description = "Static type check."
68
+ # mypy --exclude-gitignore .
69
+ run = "mypy ."
70
+
71
+ [tasks.seccheck]
72
+ description = "Static security analysis."
73
+ run = "bandit -c pyproject.toml -r ."
74
+
75
+ [tasks.static_checks]
76
+ alias = "sca"
77
+ description = "Run Static Code Analysis (SCA) tools."
78
+ depends = [
79
+ "lint",
80
+ "seccheck",
81
+ "typecheck",
82
+ ]
83
+
84
+ [tasks.install_types]
85
+ description = "Install packages for types (stub files), using mypy."
86
+ run = "rm -rf .mypy_cache && MYPYPATH=src mypy --install-types --namespace-packages --explicit-package-bases ."
87
+ run_windows = '''if exist .mypy_cache rmdir /s /q .mypy_cache & set "MYPYPATH=src" & uv run mypy --install-types --namespace-packages --explicit-package-bases .'''
88
+
89
+ [tasks.build]
90
+ description = "Build the project package."
91
+ run = "uv build"
92
+
93
+ [tasks."build_docs:html"]
94
+ alias = "docs"
95
+ description = "Build the project documentation, in HTML."
96
+ run = [
97
+ "echo The docs index page will are in: _build/html/index.html",
98
+ "sphinx-build -M html {{ config_root }}/docs {{ config_root }}/_build",
99
+ ]
100
+
101
+ [tasks."build_docs_watch:html"]
102
+ alias = "docsw"
103
+ description = "Build the project documentation, and auto-rebuild, in HTML."
104
+ run = [
105
+ "echo The docs index page will are in: _build/html/index.html",
106
+ "sphinx-autobuild --port 8080 -M html {{ config_root }}/docs {{ config_root }}/_build",
107
+ ]
@@ -0,0 +1,46 @@
1
+ import nox
2
+ from nox_uv import session
3
+
4
+
5
+ nox.options.default_venv_backend = 'uv'
6
+ nox.options.reuse_existing_virtualenvs = True
7
+
8
+
9
+ # nox -l
10
+ # nox -v -s "tests-3.12(rich='15.0')"
11
+ # nox -v --parallel 6 --allow-parallel -p 3.12 3.14
12
+
13
+ PYTHON_VERSIONS = ['3.11', '3.12', '3.13', '3.14', '3.15', 'pypy3.11']
14
+
15
+
16
+ @session(python=PYTHON_VERSIONS, uv_extras=['all'], uv_groups=['tests'])
17
+ def tests(session: nox.Session):
18
+ # session.install('setuptools', 'wheel')
19
+ session.run('pytest', *session.posargs)
20
+
21
+
22
+ @session(python=PYTHON_VERSIONS, uv_extras=['all'], uv_groups=['sca'])
23
+ def lint(session: nox.Session):
24
+ if not session.posargs:
25
+ session.run('ruff', 'check', '.')
26
+ else:
27
+ session.run('ruff', 'check', *session.posargs)
28
+
29
+
30
+ @session(python=PYTHON_VERSIONS, uv_extras=['all'], uv_groups=['sca', 'tests'])
31
+ def typecheck(session: nox.Session):
32
+ if isinstance(session.python, str) and session.python.startswith('pypy'):
33
+ session.skip('Running mypy on PyPy is not supported yet')
34
+
35
+ if not session.posargs:
36
+ session.run('mypy', '.')
37
+ else:
38
+ session.run('mypy', *session.posargs)
39
+
40
+
41
+ @session(python=PYTHON_VERSIONS, uv_extras=['all'], uv_groups=['sca'])
42
+ def seccheck(session: nox.Session):
43
+ if not session.posargs:
44
+ session.run('bandit', '-c', 'pyproject.toml', '-r', '.')
45
+ else:
46
+ session.run('bandit', '-c', 'pyproject.toml', *session.posargs)