py-smart-verify 1.0.0__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.
- py_smart_verify-1.0.0/.gitignore +24 -0
- py_smart_verify-1.0.0/LICENSE +21 -0
- py_smart_verify-1.0.0/PKG-INFO +165 -0
- py_smart_verify-1.0.0/README.md +122 -0
- py_smart_verify-1.0.0/pyproject.toml +273 -0
- py_smart_verify-1.0.0/src/py_smart_verify/__init__.py +4 -0
- py_smart_verify-1.0.0/src/py_smart_verify/__main__.py +6 -0
- py_smart_verify-1.0.0/src/py_smart_verify/cache.py +76 -0
- py_smart_verify-1.0.0/src/py_smart_verify/cli.py +253 -0
- py_smart_verify-1.0.0/src/py_smart_verify/config.py +76 -0
- py_smart_verify-1.0.0/src/py_smart_verify/console.py +181 -0
- py_smart_verify-1.0.0/src/py_smart_verify/discovery.py +99 -0
- py_smart_verify-1.0.0/src/py_smart_verify/git.py +139 -0
- py_smart_verify-1.0.0/src/py_smart_verify/graph.py +167 -0
- py_smart_verify-1.0.0/src/py_smart_verify/mcp_server.py +259 -0
- py_smart_verify-1.0.0/src/py_smart_verify/models.py +132 -0
- py_smart_verify-1.0.0/src/py_smart_verify/runner.py +198 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/__init__.py +27 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/analyzers.py +390 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/base.py +122 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/formatters.py +134 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/linters.py +136 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/quality.py +78 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/registry.py +80 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/self_test.py +83 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/testing.py +365 -0
- py_smart_verify-1.0.0/src/py_smart_verify/tasks/type_checkers.py +199 -0
- py_smart_verify-1.0.0/src/py_smart_verify/venv.py +80 -0
- py_smart_verify-1.0.0/tests/conftest.py +122 -0
- py_smart_verify-1.0.0/tests/e2e/__init__.py +0 -0
- py_smart_verify-1.0.0/tests/e2e/conftest.py +100 -0
- py_smart_verify-1.0.0/tests/e2e/test_cli_e2e.py +593 -0
- py_smart_verify-1.0.0/tests/e2e/test_mcp_e2e.py +405 -0
- py_smart_verify-1.0.0/tests/e2e/test_runner_e2e.py +369 -0
- py_smart_verify-1.0.0/tests/tasks/__init__.py +0 -0
- py_smart_verify-1.0.0/tests/tasks/conftest.py +38 -0
- py_smart_verify-1.0.0/tests/tasks/test_analyzers.py +390 -0
- py_smart_verify-1.0.0/tests/tasks/test_base.py +201 -0
- py_smart_verify-1.0.0/tests/tasks/test_formatters.py +155 -0
- py_smart_verify-1.0.0/tests/tasks/test_linters.py +159 -0
- py_smart_verify-1.0.0/tests/tasks/test_quality.py +84 -0
- py_smart_verify-1.0.0/tests/tasks/test_registry.py +162 -0
- py_smart_verify-1.0.0/tests/tasks/test_self_test.py +41 -0
- py_smart_verify-1.0.0/tests/tasks/test_tasks_init.py +24 -0
- py_smart_verify-1.0.0/tests/tasks/test_testing.py +362 -0
- py_smart_verify-1.0.0/tests/tasks/test_type_checkers.py +243 -0
- py_smart_verify-1.0.0/tests/test_cache.py +147 -0
- py_smart_verify-1.0.0/tests/test_cli.py +324 -0
- py_smart_verify-1.0.0/tests/test_config.py +93 -0
- py_smart_verify-1.0.0/tests/test_console.py +271 -0
- py_smart_verify-1.0.0/tests/test_discovery.py +158 -0
- py_smart_verify-1.0.0/tests/test_git.py +287 -0
- py_smart_verify-1.0.0/tests/test_graph.py +286 -0
- py_smart_verify-1.0.0/tests/test_init.py +18 -0
- py_smart_verify-1.0.0/tests/test_json_output.py +320 -0
- py_smart_verify-1.0.0/tests/test_main.py +27 -0
- py_smart_verify-1.0.0/tests/test_mcp_server.py +276 -0
- py_smart_verify-1.0.0/tests/test_models.py +198 -0
- py_smart_verify-1.0.0/tests/test_runner.py +361 -0
- py_smart_verify-1.0.0/tests/test_venv.py +179 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
|
|
12
|
+
# py-smart-verify generated artifacts
|
|
13
|
+
.py_smart_verify/
|
|
14
|
+
|
|
15
|
+
# py-smart-test generated artifacts (dependency)
|
|
16
|
+
.py_smart_test/
|
|
17
|
+
|
|
18
|
+
# Logs
|
|
19
|
+
*.log
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.mypy_cache/
|
|
22
|
+
.pytest_cache/
|
|
23
|
+
.coverage
|
|
24
|
+
htmlcov/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jinto AG
|
|
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,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-smart-verify
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Professional Python verification CLI tool combining linting, type checking, and smart testing
|
|
5
|
+
Project-URL: Homepage, https://github.com/jinto-ag/py_smart_verify
|
|
6
|
+
Project-URL: Repository, https://github.com/jinto-ag/py_smart_verify
|
|
7
|
+
Project-URL: Issues, https://github.com/jinto-ag/py_smart_verify/issues
|
|
8
|
+
Author: Jinto AG
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cli,linting,quality,testing,type-checking,verification
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: py-smart-test>=1.3.0
|
|
25
|
+
Requires-Dist: pydantic>=2.12.5
|
|
26
|
+
Requires-Dist: rich>=14.3.2
|
|
27
|
+
Requires-Dist: typer>=0.23.1
|
|
28
|
+
Provides-Extra: all-tools
|
|
29
|
+
Requires-Dist: black>=26.1.0; extra == 'all-tools'
|
|
30
|
+
Requires-Dist: coverage>=7.13.4; extra == 'all-tools'
|
|
31
|
+
Requires-Dist: flake8>=7.3.0; extra == 'all-tools'
|
|
32
|
+
Requires-Dist: isort>=7.0.0; extra == 'all-tools'
|
|
33
|
+
Requires-Dist: pylance>=2.0.1; extra == 'all-tools'
|
|
34
|
+
Requires-Dist: pyright>=1.1.408; extra == 'all-tools'
|
|
35
|
+
Requires-Dist: pytest>=9.0.2; extra == 'all-tools'
|
|
36
|
+
Requires-Dist: ruff>=0.15.1; extra == 'all-tools'
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: coverage>=7.13.4; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest>=9.0.2; extra == 'dev'
|
|
40
|
+
Provides-Extra: mcp
|
|
41
|
+
Requires-Dist: mcp[cli]>=1.0.0; extra == 'mcp'
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# py-smart-verify
|
|
45
|
+
|
|
46
|
+
Professional Python verification CLI tool combining linting, type checking, and smart testing into a single command.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Unified pipeline** - Run formatters, linters, type checkers, and tests in one command
|
|
51
|
+
- **Smart testing** - Only run tests affected by your changes (via [py-smart-test](https://pypi.org/project/py-smart-test/))
|
|
52
|
+
- **Caching** - Skip steps that haven't changed since the last run
|
|
53
|
+
- **Dependency graph** - Detect circular dependencies and visualize module relationships
|
|
54
|
+
- **Code analysis** - Check architecture guidelines, import patterns, and coding standards
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install py-smart-verify
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or with [uv](https://github.com/astral-sh/uv):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv add py-smart-verify
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Optional tools
|
|
69
|
+
|
|
70
|
+
Install all supported verification tools:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install py-smart-verify[all-tools]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick start
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Run all quality checks (format, lint, type check, analyze)
|
|
80
|
+
py-smart-verify verify quality
|
|
81
|
+
|
|
82
|
+
# Run tests (smart mode - only affected tests)
|
|
83
|
+
py-smart-verify verify tests
|
|
84
|
+
|
|
85
|
+
# Run everything
|
|
86
|
+
py-smart-verify verify
|
|
87
|
+
|
|
88
|
+
# Use the short alias
|
|
89
|
+
pyv verify quality
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Commands
|
|
93
|
+
|
|
94
|
+
### `verify`
|
|
95
|
+
|
|
96
|
+
Run verification checks on Python code.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Run specific tasks
|
|
100
|
+
py-smart-verify verify ruff mypy
|
|
101
|
+
|
|
102
|
+
# Run with options
|
|
103
|
+
py-smart-verify verify --no-cache --continue quality
|
|
104
|
+
py-smart-verify verify --paths src,lib --full-tests
|
|
105
|
+
py-smart-verify verify --staged tests # pre-commit mode
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Options:**
|
|
109
|
+
|
|
110
|
+
| Flag | Description |
|
|
111
|
+
| -------------- | ------------------------------------------- |
|
|
112
|
+
| `--no-cache` | Disable caching |
|
|
113
|
+
| `--continue` | Continue after errors (default: fast-fail) |
|
|
114
|
+
| `--paths` | Paths to verify (comma-separated) |
|
|
115
|
+
| `--full-tests` | Run all tests with smart prioritization |
|
|
116
|
+
| `--staged` | Test only staged changes (pre-commit mode) |
|
|
117
|
+
| `--since REF` | Git ref for smart test diff (default: main) |
|
|
118
|
+
| `--skip-tests` | Skip test execution |
|
|
119
|
+
| `-v` | Verbose output |
|
|
120
|
+
|
|
121
|
+
### `graph`
|
|
122
|
+
|
|
123
|
+
Build and display the dependency graph.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
py-smart-verify graph
|
|
127
|
+
py-smart-verify graph --output deps.json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### `affected`
|
|
131
|
+
|
|
132
|
+
List tests affected by code changes.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
py-smart-verify affected
|
|
136
|
+
py-smart-verify affected --since main --json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `regen-graph`
|
|
140
|
+
|
|
141
|
+
Regenerate the py-smart-test dependency graph.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
py-smart-verify regen-graph
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Available tasks
|
|
148
|
+
|
|
149
|
+
| Category | Tasks |
|
|
150
|
+
| ----------------- | ----------------------------------------------------------------------- |
|
|
151
|
+
| **Formatters** | `format` (black), `isort`, `ruff-fix` |
|
|
152
|
+
| **Linters** | `flake8`, `pyflakes` |
|
|
153
|
+
| **Type checkers** | `mypy`, `pyright`, `basedpyright` |
|
|
154
|
+
| **Analyzers** | `architecture`, `standards`, `imports`, `circular-deps`, `deprecations` |
|
|
155
|
+
| **Testing** | `tests`, `full-tests`, `e2e-tests`, `full-e2e-tests` |
|
|
156
|
+
| **Composite** | `quality` (all formatters + linters + type checkers + analyzers) |
|
|
157
|
+
|
|
158
|
+
## Requirements
|
|
159
|
+
|
|
160
|
+
- Python 3.11+
|
|
161
|
+
- Individual tools (ruff, mypy, etc.) installed separately or via `py-smart-verify[all-tools]`
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# py-smart-verify
|
|
2
|
+
|
|
3
|
+
Professional Python verification CLI tool combining linting, type checking, and smart testing into a single command.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Unified pipeline** - Run formatters, linters, type checkers, and tests in one command
|
|
8
|
+
- **Smart testing** - Only run tests affected by your changes (via [py-smart-test](https://pypi.org/project/py-smart-test/))
|
|
9
|
+
- **Caching** - Skip steps that haven't changed since the last run
|
|
10
|
+
- **Dependency graph** - Detect circular dependencies and visualize module relationships
|
|
11
|
+
- **Code analysis** - Check architecture guidelines, import patterns, and coding standards
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install py-smart-verify
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or with [uv](https://github.com/astral-sh/uv):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv add py-smart-verify
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Optional tools
|
|
26
|
+
|
|
27
|
+
Install all supported verification tools:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install py-smart-verify[all-tools]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Run all quality checks (format, lint, type check, analyze)
|
|
37
|
+
py-smart-verify verify quality
|
|
38
|
+
|
|
39
|
+
# Run tests (smart mode - only affected tests)
|
|
40
|
+
py-smart-verify verify tests
|
|
41
|
+
|
|
42
|
+
# Run everything
|
|
43
|
+
py-smart-verify verify
|
|
44
|
+
|
|
45
|
+
# Use the short alias
|
|
46
|
+
pyv verify quality
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Commands
|
|
50
|
+
|
|
51
|
+
### `verify`
|
|
52
|
+
|
|
53
|
+
Run verification checks on Python code.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Run specific tasks
|
|
57
|
+
py-smart-verify verify ruff mypy
|
|
58
|
+
|
|
59
|
+
# Run with options
|
|
60
|
+
py-smart-verify verify --no-cache --continue quality
|
|
61
|
+
py-smart-verify verify --paths src,lib --full-tests
|
|
62
|
+
py-smart-verify verify --staged tests # pre-commit mode
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
|
|
67
|
+
| Flag | Description |
|
|
68
|
+
| -------------- | ------------------------------------------- |
|
|
69
|
+
| `--no-cache` | Disable caching |
|
|
70
|
+
| `--continue` | Continue after errors (default: fast-fail) |
|
|
71
|
+
| `--paths` | Paths to verify (comma-separated) |
|
|
72
|
+
| `--full-tests` | Run all tests with smart prioritization |
|
|
73
|
+
| `--staged` | Test only staged changes (pre-commit mode) |
|
|
74
|
+
| `--since REF` | Git ref for smart test diff (default: main) |
|
|
75
|
+
| `--skip-tests` | Skip test execution |
|
|
76
|
+
| `-v` | Verbose output |
|
|
77
|
+
|
|
78
|
+
### `graph`
|
|
79
|
+
|
|
80
|
+
Build and display the dependency graph.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
py-smart-verify graph
|
|
84
|
+
py-smart-verify graph --output deps.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### `affected`
|
|
88
|
+
|
|
89
|
+
List tests affected by code changes.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
py-smart-verify affected
|
|
93
|
+
py-smart-verify affected --since main --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### `regen-graph`
|
|
97
|
+
|
|
98
|
+
Regenerate the py-smart-test dependency graph.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
py-smart-verify regen-graph
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Available tasks
|
|
105
|
+
|
|
106
|
+
| Category | Tasks |
|
|
107
|
+
| ----------------- | ----------------------------------------------------------------------- |
|
|
108
|
+
| **Formatters** | `format` (black), `isort`, `ruff-fix` |
|
|
109
|
+
| **Linters** | `flake8`, `pyflakes` |
|
|
110
|
+
| **Type checkers** | `mypy`, `pyright`, `basedpyright` |
|
|
111
|
+
| **Analyzers** | `architecture`, `standards`, `imports`, `circular-deps`, `deprecations` |
|
|
112
|
+
| **Testing** | `tests`, `full-tests`, `e2e-tests`, `full-e2e-tests` |
|
|
113
|
+
| **Composite** | `quality` (all formatters + linters + type checkers + analyzers) |
|
|
114
|
+
|
|
115
|
+
## Requirements
|
|
116
|
+
|
|
117
|
+
- Python 3.11+
|
|
118
|
+
- Individual tools (ruff, mypy, etc.) installed separately or via `py-smart-verify[all-tools]`
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "py-smart-verify"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Professional Python verification CLI tool combining linting, type checking, and smart testing"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Jinto AG" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"linting",
|
|
15
|
+
"type-checking",
|
|
16
|
+
"testing",
|
|
17
|
+
"verification",
|
|
18
|
+
"cli",
|
|
19
|
+
"quality",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 4 - Beta",
|
|
23
|
+
"Environment :: Console",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
31
|
+
"Topic :: Software Development :: Testing",
|
|
32
|
+
"Typing :: Typed",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
"pydantic>=2.12.5",
|
|
36
|
+
"rich>=14.3.2",
|
|
37
|
+
"typer>=0.23.1",
|
|
38
|
+
"py-smart-test>=1.3.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
all-tools = [
|
|
43
|
+
"black>=26.1.0",
|
|
44
|
+
"coverage>=7.13.4",
|
|
45
|
+
"flake8>=7.3.0",
|
|
46
|
+
"isort>=7.0.0",
|
|
47
|
+
"pylance>=2.0.1",
|
|
48
|
+
"pyright>=1.1.408",
|
|
49
|
+
"pytest>=9.0.2",
|
|
50
|
+
"ruff>=0.15.1",
|
|
51
|
+
]
|
|
52
|
+
dev = ["pytest>=9.0.2", "coverage>=7.13.4"]
|
|
53
|
+
mcp = ["mcp[cli]>=1.0.0"]
|
|
54
|
+
|
|
55
|
+
[project.urls]
|
|
56
|
+
Homepage = "https://github.com/jinto-ag/py_smart_verify"
|
|
57
|
+
Repository = "https://github.com/jinto-ag/py_smart_verify"
|
|
58
|
+
Issues = "https://github.com/jinto-ag/py_smart_verify/issues"
|
|
59
|
+
|
|
60
|
+
[project.scripts]
|
|
61
|
+
py-smart-verify = "py_smart_verify.cli:app"
|
|
62
|
+
pyv = "py_smart_verify.cli:app"
|
|
63
|
+
py-smart-verify-mcp = "py_smart_verify.mcp_server:main"
|
|
64
|
+
|
|
65
|
+
# ---------------------------------------------------------------------------
|
|
66
|
+
# Build
|
|
67
|
+
# ---------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
[tool.hatch.build.targets.wheel]
|
|
70
|
+
packages = ["src/py_smart_verify"]
|
|
71
|
+
|
|
72
|
+
[tool.hatch.build.targets.sdist]
|
|
73
|
+
include = ["src/py_smart_verify", "tests", "pyproject.toml", "README.md", "LICENSE"]
|
|
74
|
+
|
|
75
|
+
# ---------------------------------------------------------------------------
|
|
76
|
+
# py-smart-test
|
|
77
|
+
# ---------------------------------------------------------------------------
|
|
78
|
+
|
|
79
|
+
[tool.py-smart-test]
|
|
80
|
+
src_dir = "src"
|
|
81
|
+
packages = ["py_smart_verify"]
|
|
82
|
+
test_dir = "tests"
|
|
83
|
+
default_branch = "main"
|
|
84
|
+
|
|
85
|
+
# ---------------------------------------------------------------------------
|
|
86
|
+
# Black
|
|
87
|
+
# ---------------------------------------------------------------------------
|
|
88
|
+
|
|
89
|
+
[tool.black]
|
|
90
|
+
line-length = 100
|
|
91
|
+
target-version = ["py311"]
|
|
92
|
+
|
|
93
|
+
# ---------------------------------------------------------------------------
|
|
94
|
+
# isort
|
|
95
|
+
# ---------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
[tool.isort]
|
|
98
|
+
profile = "black"
|
|
99
|
+
line_length = 100
|
|
100
|
+
known_first_party = ["py_smart_verify"]
|
|
101
|
+
src_paths = ["src", "tests"]
|
|
102
|
+
|
|
103
|
+
# ---------------------------------------------------------------------------
|
|
104
|
+
# Ruff (linter + formatter)
|
|
105
|
+
# ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
[tool.ruff]
|
|
108
|
+
target-version = "py311"
|
|
109
|
+
line-length = 100
|
|
110
|
+
src = ["src", "tests"]
|
|
111
|
+
|
|
112
|
+
[tool.ruff.lint]
|
|
113
|
+
select = [
|
|
114
|
+
"E", # pycodestyle errors
|
|
115
|
+
"W", # pycodestyle warnings
|
|
116
|
+
"F", # pyflakes
|
|
117
|
+
"I", # isort
|
|
118
|
+
"UP", # pyupgrade
|
|
119
|
+
"B", # flake8-bugbear
|
|
120
|
+
"SIM", # flake8-simplify
|
|
121
|
+
"RUF", # ruff-specific rules
|
|
122
|
+
]
|
|
123
|
+
ignore = [
|
|
124
|
+
"E501", # line too long (handled by formatter)
|
|
125
|
+
"SIM108", # ternary operator (readability preference)
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
[tool.ruff.lint.per-file-ignores]
|
|
129
|
+
"tests/*" = ["F841", "E402"]
|
|
130
|
+
"tests/**/*" = ["F841", "E402"]
|
|
131
|
+
|
|
132
|
+
[tool.ruff.lint.isort]
|
|
133
|
+
known-first-party = ["py_smart_verify"]
|
|
134
|
+
|
|
135
|
+
# ---------------------------------------------------------------------------
|
|
136
|
+
# Mypy
|
|
137
|
+
# ---------------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
[tool.mypy]
|
|
140
|
+
python_version = "3.11"
|
|
141
|
+
strict = true
|
|
142
|
+
warn_return_any = true
|
|
143
|
+
warn_unused_configs = true
|
|
144
|
+
disallow_untyped_defs = true
|
|
145
|
+
packages = ["py_smart_verify"]
|
|
146
|
+
mypy_path = "src"
|
|
147
|
+
|
|
148
|
+
[[tool.mypy.overrides]]
|
|
149
|
+
module = "tests.*"
|
|
150
|
+
disallow_untyped_defs = false
|
|
151
|
+
allow_untyped_defs = true
|
|
152
|
+
|
|
153
|
+
# ---------------------------------------------------------------------------
|
|
154
|
+
# Basedpyright
|
|
155
|
+
# ---------------------------------------------------------------------------
|
|
156
|
+
|
|
157
|
+
[tool.basedpyright]
|
|
158
|
+
pythonVersion = "3.11"
|
|
159
|
+
typeCheckingMode = "standard"
|
|
160
|
+
venvPath = "."
|
|
161
|
+
venv = ".venv"
|
|
162
|
+
|
|
163
|
+
# ---------------------------------------------------------------------------
|
|
164
|
+
# Pytest
|
|
165
|
+
# ---------------------------------------------------------------------------
|
|
166
|
+
|
|
167
|
+
[tool.pytest.ini_options]
|
|
168
|
+
testpaths = ["tests"]
|
|
169
|
+
pythonpath = ["src"]
|
|
170
|
+
addopts = "-q --tb=short"
|
|
171
|
+
|
|
172
|
+
# ---------------------------------------------------------------------------
|
|
173
|
+
# Coverage
|
|
174
|
+
# ---------------------------------------------------------------------------
|
|
175
|
+
|
|
176
|
+
[tool.coverage.run]
|
|
177
|
+
source = ["py_smart_verify"]
|
|
178
|
+
branch = true
|
|
179
|
+
|
|
180
|
+
[tool.coverage.report]
|
|
181
|
+
show_missing = true
|
|
182
|
+
skip_empty = true
|
|
183
|
+
exclude_lines = [
|
|
184
|
+
"pragma: no cover",
|
|
185
|
+
"if __name__ == .__main__.",
|
|
186
|
+
"if TYPE_CHECKING:",
|
|
187
|
+
"pass",
|
|
188
|
+
"\\.\\.\\.",
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
# ---------------------------------------------------------------------------
|
|
192
|
+
# Dependency groups (PEP 735)
|
|
193
|
+
# ---------------------------------------------------------------------------
|
|
194
|
+
|
|
195
|
+
[dependency-groups]
|
|
196
|
+
dev = [
|
|
197
|
+
"basedpyright>=1.38.0",
|
|
198
|
+
"black>=26.1.0",
|
|
199
|
+
"commitizen>=4.1.0",
|
|
200
|
+
"coverage>=7.13.4",
|
|
201
|
+
"flake8>=7.3.0",
|
|
202
|
+
"git-cliff>=2.6.1",
|
|
203
|
+
"interrogate>=1.7.0",
|
|
204
|
+
"isort>=7.0.0",
|
|
205
|
+
"mcp[cli]>=1.0.0",
|
|
206
|
+
"mypy>=1.19.1",
|
|
207
|
+
"pip-audit>=2.10.0",
|
|
208
|
+
"pip-licenses>=5.5.1",
|
|
209
|
+
"pre-commit>=4.0.1",
|
|
210
|
+
"pyflakes>=3.4.0",
|
|
211
|
+
"pylance>=2.0.1",
|
|
212
|
+
"pyright>=1.1.408",
|
|
213
|
+
"pytest>=9.0.2",
|
|
214
|
+
"pytest-cov>=7.0.0",
|
|
215
|
+
"ruff>=0.15.1",
|
|
216
|
+
]
|
|
217
|
+
|
|
218
|
+
# ---------------------------------------------------------------------------
|
|
219
|
+
# Commitizen (conventional commits)
|
|
220
|
+
# ---------------------------------------------------------------------------
|
|
221
|
+
|
|
222
|
+
[tool.commitizen]
|
|
223
|
+
name = "cz_conventional_commits"
|
|
224
|
+
version = "1.0.0"
|
|
225
|
+
tag_format = "v$version"
|
|
226
|
+
changelog_file = "CHANGELOG.md"
|
|
227
|
+
update_changelog_on_bump = true
|
|
228
|
+
major_version_zero = true
|
|
229
|
+
|
|
230
|
+
[tool.commitizen.customize]
|
|
231
|
+
message_template = "{{change_type}}{{scope}}: {{message}}\n\n{{body}}"
|
|
232
|
+
schema_pattern = "(?s)(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\\((?P<scope>[\\w\\-]+)\\))?!?(?P<breaking>!)?:\\s(?P<subject>[\\w\\s]+)(?:\\n\\n(?P<body>.*))?"
|
|
233
|
+
|
|
234
|
+
[[tool.commitizen.customize.questions]]
|
|
235
|
+
type = "list"
|
|
236
|
+
name = "change_type"
|
|
237
|
+
message = "Select the type of change you are committing"
|
|
238
|
+
choices = [
|
|
239
|
+
{ value = "feat", name = "feat: A new feature" },
|
|
240
|
+
{ value = "fix", name = "fix: A bug fix" },
|
|
241
|
+
{ value = "docs", name = "docs: Documentation only changes" },
|
|
242
|
+
{ value = "style", name = "style: Changes that do not affect the meaning of the code" },
|
|
243
|
+
{ value = "refactor", name = "refactor: A code change that neither fixes a bug nor adds a feature" },
|
|
244
|
+
{ value = "perf", name = "perf: A code change that improves performance" },
|
|
245
|
+
{ value = "test", name = "test: Adding missing or correcting existing tests" },
|
|
246
|
+
{ value = "build", name = "build: Changes that affect the build system or external dependencies" },
|
|
247
|
+
{ value = "ci", name = "ci: Changes to CI configuration files and scripts" },
|
|
248
|
+
{ value = "chore", name = "chore: Other changes that don't modify src or test files" },
|
|
249
|
+
{ value = "revert", name = "revert: Revert to a commit" },
|
|
250
|
+
]
|
|
251
|
+
|
|
252
|
+
[[tool.commitizen.customize.questions]]
|
|
253
|
+
type = "list"
|
|
254
|
+
name = "scope"
|
|
255
|
+
message = "Select the scope of this change"
|
|
256
|
+
choices = [
|
|
257
|
+
{ value = "core", name = "core: Core functionality and main logic" },
|
|
258
|
+
{ value = "tasks", name = "tasks: Verification tasks (linters, type checkers, analyzers)" },
|
|
259
|
+
{ value = "cli", name = "cli: CLI interface and commands" },
|
|
260
|
+
{ value = "config", name = "config: Configuration and setup files" },
|
|
261
|
+
{ value = "ci", name = "ci: CI/CD and development tooling" },
|
|
262
|
+
{ value = "docs", name = "docs: Documentation and README" },
|
|
263
|
+
]
|
|
264
|
+
|
|
265
|
+
[[tool.commitizen.customize.questions]]
|
|
266
|
+
type = "input"
|
|
267
|
+
name = "message"
|
|
268
|
+
message = "Write a short, imperative tense description of the change"
|
|
269
|
+
|
|
270
|
+
[[tool.commitizen.customize.questions]]
|
|
271
|
+
type = "input"
|
|
272
|
+
name = "body"
|
|
273
|
+
message = "Provide a longer description of the change (optional)"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Caching system for py-smart-verify."""
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CacheManager:
|
|
8
|
+
"""Manages caching of verification scopes."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, cache_dir: Path) -> None:
|
|
11
|
+
"""Initialize cache manager."""
|
|
12
|
+
self.cache_dir = cache_dir
|
|
13
|
+
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
|
14
|
+
|
|
15
|
+
def compute_hash(
|
|
16
|
+
self, scope: str, file_paths: list[Path], tool_versions: dict[str, str]
|
|
17
|
+
) -> str:
|
|
18
|
+
"""Compute SHA256 hash of file contents + tool versions."""
|
|
19
|
+
hasher = hashlib.sha256()
|
|
20
|
+
|
|
21
|
+
# Hash file contents
|
|
22
|
+
for file_path in sorted(file_paths):
|
|
23
|
+
if file_path.exists():
|
|
24
|
+
with open(file_path, "rb") as f:
|
|
25
|
+
hasher.update(f.read())
|
|
26
|
+
|
|
27
|
+
# Hash tool versions
|
|
28
|
+
for tool, version in sorted(tool_versions.items()):
|
|
29
|
+
hasher.update(f"{tool}:{version}".encode())
|
|
30
|
+
|
|
31
|
+
return hasher.hexdigest()
|
|
32
|
+
|
|
33
|
+
def is_cached(self, scope: str) -> bool:
|
|
34
|
+
"""Check if scope is cached and valid."""
|
|
35
|
+
marker = self.cache_dir / f".{scope}.ok"
|
|
36
|
+
return marker.exists()
|
|
37
|
+
|
|
38
|
+
def mark_ok(self, scope: str, duration: float) -> None:
|
|
39
|
+
"""Mark scope as successfully cached."""
|
|
40
|
+
ok_file = self.cache_dir / f".{scope}.ok"
|
|
41
|
+
time_file = self.cache_dir / f".{scope}.time"
|
|
42
|
+
|
|
43
|
+
ok_file.write_text("ok")
|
|
44
|
+
time_file.write_text(str(duration))
|
|
45
|
+
|
|
46
|
+
def get_last_duration(self, scope: str) -> float | None:
|
|
47
|
+
"""Get duration of last successful run."""
|
|
48
|
+
time_file = self.cache_dir / f".{scope}.time"
|
|
49
|
+
if time_file.exists():
|
|
50
|
+
try:
|
|
51
|
+
return float(time_file.read_text())
|
|
52
|
+
except (ValueError, OSError):
|
|
53
|
+
return None
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
def invalidate(self, scope: str) -> None:
|
|
57
|
+
"""Invalidate cache for a scope."""
|
|
58
|
+
for pattern in [f".{scope}.ok", f".{scope}.time", f".{scope}.hash"]:
|
|
59
|
+
file_path = self.cache_dir / pattern
|
|
60
|
+
if file_path.exists():
|
|
61
|
+
file_path.unlink()
|
|
62
|
+
|
|
63
|
+
def save_hash(self, scope: str, file_hash: str) -> None:
|
|
64
|
+
"""Save hash for a scope."""
|
|
65
|
+
hash_file = self.cache_dir / f".{scope}.hash"
|
|
66
|
+
hash_file.write_text(file_hash)
|
|
67
|
+
|
|
68
|
+
def get_saved_hash(self, scope: str) -> str | None:
|
|
69
|
+
"""Get saved hash for a scope."""
|
|
70
|
+
hash_file = self.cache_dir / f".{scope}.hash"
|
|
71
|
+
if hash_file.exists():
|
|
72
|
+
try:
|
|
73
|
+
return hash_file.read_text().strip()
|
|
74
|
+
except OSError:
|
|
75
|
+
return None
|
|
76
|
+
return None
|