jaymd96-pants-baseline 0.1.0__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.0.dist-info/METADATA +385 -0
- jaymd96_pants_baseline-0.1.0.dist-info/RECORD +25 -0
- jaymd96_pants_baseline-0.1.0.dist-info/WHEEL +4 -0
- jaymd96_pants_baseline-0.1.0.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 +78 -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 +135 -0
- pants_baseline/rules/fmt_rules.py +122 -0
- pants_baseline/rules/lint_rules.py +135 -0
- pants_baseline/rules/test_rules.py +153 -0
- pants_baseline/rules/typecheck_rules.py +146 -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,66 @@
|
|
|
1
|
+
"""uv subsystem for dependency management and security auditing."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pants.option.option_types import BoolOption, StrListOption, StrOption
|
|
6
|
+
from pants.option.subsystem import Subsystem
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class UvSubsystem(Subsystem):
|
|
10
|
+
"""Configuration for uv dependency management and security auditing.
|
|
11
|
+
|
|
12
|
+
uv is Astral's ultra-fast Python package installer and resolver,
|
|
13
|
+
written in Rust. It's 10-100x faster than pip for dependency resolution.
|
|
14
|
+
|
|
15
|
+
This subsystem configures uv for:
|
|
16
|
+
- Dependency security auditing (vulnerability scanning)
|
|
17
|
+
- Lock file management
|
|
18
|
+
- Virtual environment management
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
options_scope = "uv"
|
|
22
|
+
help = "uv dependency management and security auditing configuration."
|
|
23
|
+
|
|
24
|
+
version = StrOption(
|
|
25
|
+
default="0.5.0",
|
|
26
|
+
help="Version of uv to use.",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Security auditing
|
|
30
|
+
audit_enabled = BoolOption(
|
|
31
|
+
default=True,
|
|
32
|
+
help="Enable dependency security auditing.",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
audit_ignore_vulns = StrListOption(
|
|
36
|
+
default=[],
|
|
37
|
+
help="Vulnerability IDs to ignore (e.g., 'GHSA-xxxx-xxxx-xxxx').",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
audit_fail_on_warning = BoolOption(
|
|
41
|
+
default=False,
|
|
42
|
+
help="Fail the audit if any warnings are found (not just errors).",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Lock file settings
|
|
46
|
+
lock_file = StrOption(
|
|
47
|
+
default="uv.lock",
|
|
48
|
+
help="Path to the uv lock file.",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
require_lock = BoolOption(
|
|
52
|
+
default=True,
|
|
53
|
+
help="Require a lock file to exist for auditing.",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Output format
|
|
57
|
+
output_format = StrOption(
|
|
58
|
+
default="text",
|
|
59
|
+
help="Output format for audit results ('text', 'json', 'github').",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Additional arguments
|
|
63
|
+
extra_args = StrListOption(
|
|
64
|
+
default=[],
|
|
65
|
+
help="Additional arguments to pass to uv commands.",
|
|
66
|
+
)
|
|
@@ -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
|
+
)
|