jaymd96-pants-baseline 0.1.2__py3-none-any.whl
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.
- jaymd96_pants_baseline-0.1.2.dist-info/METADATA +385 -0
- jaymd96_pants_baseline-0.1.2.dist-info/RECORD +25 -0
- jaymd96_pants_baseline-0.1.2.dist-info/WHEEL +4 -0
- jaymd96_pants_baseline-0.1.2.dist-info/licenses/LICENSE +190 -0
- pants_baseline/__about__.py +4 -0
- pants_baseline/__init__.py +17 -0
- pants_baseline/goals/__init__.py +11 -0
- pants_baseline/goals/audit.py +76 -0
- pants_baseline/goals/fmt.py +56 -0
- pants_baseline/goals/lint.py +59 -0
- pants_baseline/goals/test.py +53 -0
- pants_baseline/goals/typecheck.py +55 -0
- pants_baseline/register.py +46 -0
- pants_baseline/rules/__init__.py +11 -0
- pants_baseline/rules/audit_rules.py +78 -0
- pants_baseline/rules/fmt_rules.py +120 -0
- pants_baseline/rules/lint_rules.py +133 -0
- pants_baseline/rules/test_rules.py +149 -0
- pants_baseline/rules/typecheck_rules.py +144 -0
- pants_baseline/subsystems/__init__.py +13 -0
- pants_baseline/subsystems/baseline.py +74 -0
- pants_baseline/subsystems/ruff.py +90 -0
- pants_baseline/subsystems/ty.py +80 -0
- pants_baseline/subsystems/uv.py +66 -0
- pants_baseline/targets.py +138 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Target types for the Python Baseline plugin."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pants.engine.target import (
|
|
6
|
+
COMMON_TARGET_FIELDS,
|
|
7
|
+
BoolField,
|
|
8
|
+
IntField,
|
|
9
|
+
StringField,
|
|
10
|
+
StringSequenceField,
|
|
11
|
+
Target,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BaselineSourcesField(StringSequenceField):
|
|
16
|
+
"""Source files for the baseline Python project."""
|
|
17
|
+
|
|
18
|
+
alias = "sources"
|
|
19
|
+
default = ("**/*.py",)
|
|
20
|
+
help = "Python source files to include in baseline checks."
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BaselineTestSourcesField(StringSequenceField):
|
|
24
|
+
"""Test source files for the baseline Python project."""
|
|
25
|
+
|
|
26
|
+
alias = "test_sources"
|
|
27
|
+
default = ("tests/**/*.py",)
|
|
28
|
+
help = "Test files to include in baseline checks."
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class PythonVersionField(StringField):
|
|
32
|
+
"""Target Python version for the project."""
|
|
33
|
+
|
|
34
|
+
alias = "python_version"
|
|
35
|
+
default = "3.11"
|
|
36
|
+
help = "Target Python version (e.g., '3.11', '3.12')."
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class LineLengthField(IntField):
|
|
40
|
+
"""Maximum line length for formatting."""
|
|
41
|
+
|
|
42
|
+
alias = "line_length"
|
|
43
|
+
default = 120
|
|
44
|
+
help = "Maximum line length for code formatting."
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class StrictModeField(BoolField):
|
|
48
|
+
"""Enable strict mode for all checks."""
|
|
49
|
+
|
|
50
|
+
alias = "strict"
|
|
51
|
+
default = True
|
|
52
|
+
help = "Enable strict mode for type checking and linting."
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class CoverageThresholdField(IntField):
|
|
56
|
+
"""Minimum coverage percentage required."""
|
|
57
|
+
|
|
58
|
+
alias = "coverage_threshold"
|
|
59
|
+
default = 80
|
|
60
|
+
help = "Minimum code coverage percentage required."
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class SkipLintField(BoolField):
|
|
64
|
+
"""Skip linting for this target."""
|
|
65
|
+
|
|
66
|
+
alias = "skip_lint"
|
|
67
|
+
default = False
|
|
68
|
+
help = "Skip Ruff linting for this target."
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class SkipFormatField(BoolField):
|
|
72
|
+
"""Skip formatting for this target."""
|
|
73
|
+
|
|
74
|
+
alias = "skip_fmt"
|
|
75
|
+
default = False
|
|
76
|
+
help = "Skip Ruff formatting for this target."
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class SkipTypecheckField(BoolField):
|
|
80
|
+
"""Skip type checking for this target."""
|
|
81
|
+
|
|
82
|
+
alias = "skip_typecheck"
|
|
83
|
+
default = False
|
|
84
|
+
help = "Skip ty type checking for this target."
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class SkipTestField(BoolField):
|
|
88
|
+
"""Skip testing for this target."""
|
|
89
|
+
|
|
90
|
+
alias = "skip_test"
|
|
91
|
+
default = False
|
|
92
|
+
help = "Skip pytest for this target."
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class SkipAuditField(BoolField):
|
|
96
|
+
"""Skip security audit for this target."""
|
|
97
|
+
|
|
98
|
+
alias = "skip_audit"
|
|
99
|
+
default = False
|
|
100
|
+
help = "Skip uv security audit for this target."
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class BaselinePythonProject(Target):
|
|
104
|
+
"""A Python project with baseline quality checks.
|
|
105
|
+
|
|
106
|
+
This target type enables opinionated code quality checks using the
|
|
107
|
+
Astral ecosystem (Ruff, ty, uv) plus pytest for testing.
|
|
108
|
+
|
|
109
|
+
Example:
|
|
110
|
+
|
|
111
|
+
baseline_python_project(
|
|
112
|
+
name="my_project",
|
|
113
|
+
sources=["src/**/*.py"],
|
|
114
|
+
test_sources=["tests/**/*.py"],
|
|
115
|
+
python_version="3.11",
|
|
116
|
+
line_length=120,
|
|
117
|
+
strict=True,
|
|
118
|
+
coverage_threshold=80,
|
|
119
|
+
)
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
alias = "baseline_python_project"
|
|
123
|
+
help = "A Python project with baseline quality checks."
|
|
124
|
+
|
|
125
|
+
core_fields = (
|
|
126
|
+
*COMMON_TARGET_FIELDS,
|
|
127
|
+
BaselineSourcesField,
|
|
128
|
+
BaselineTestSourcesField,
|
|
129
|
+
PythonVersionField,
|
|
130
|
+
LineLengthField,
|
|
131
|
+
StrictModeField,
|
|
132
|
+
CoverageThresholdField,
|
|
133
|
+
SkipLintField,
|
|
134
|
+
SkipFormatField,
|
|
135
|
+
SkipTypecheckField,
|
|
136
|
+
SkipTestField,
|
|
137
|
+
SkipAuditField,
|
|
138
|
+
)
|