jaymd96-pants-baseline 0.1.8__py3-none-any.whl → 0.1.10__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.8.dist-info → jaymd96_pants_baseline-0.1.10.dist-info}/METADATA +1 -1
- {jaymd96_pants_baseline-0.1.8.dist-info → jaymd96_pants_baseline-0.1.10.dist-info}/RECORD +10 -10
- pants_baseline/__about__.py +1 -1
- pants_baseline/register.py +17 -12
- pants_baseline/rules/fmt_rules.py +20 -15
- pants_baseline/rules/lint_rules.py +14 -9
- pants_baseline/rules/typecheck_rules.py +6 -1
- pants_baseline/subsystems/ruff.py +4 -1
- {jaymd96_pants_baseline-0.1.8.dist-info → jaymd96_pants_baseline-0.1.10.dist-info}/WHEEL +0 -0
- {jaymd96_pants_baseline-0.1.8.dist-info → jaymd96_pants_baseline-0.1.10.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jaymd96-pants-baseline
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: Opinionated Python code quality baseline plugin for Pants build system
|
|
5
5
|
Project-URL: Homepage, https://github.com/jaymd96/pants-baseline
|
|
6
6
|
Project-URL: Repository, https://github.com/jaymd96/pants-baseline.git
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
pants_baseline/__about__.py,sha256=
|
|
1
|
+
pants_baseline/__about__.py,sha256=gA6PwyUIMFpJMjnryFcu8PLgyYfMETKQQRSAzoOqAz4,99
|
|
2
2
|
pants_baseline/__init__.py,sha256=uVRGi1D2gFjc7emmeewWdcvpO-NsUuKsMbX3rztOxWU,655
|
|
3
|
-
pants_baseline/register.py,sha256=
|
|
3
|
+
pants_baseline/register.py,sha256=gdODsaI7VIzU2tGONANsg9KbKZkHidmLs2AyvUNIypg,1675
|
|
4
4
|
pants_baseline/targets.py,sha256=Z9O09Aqd5inMqwIUFt4HSE9HtWjn8pGSU4FZHg22Tpo,3379
|
|
5
5
|
pants_baseline/goals/__init__.py,sha256=pf6KU2CIQuDkx8ER3IS0H-kuNbBtX-AH5B5SnSP9_yw,192
|
|
6
6
|
pants_baseline/goals/audit.py,sha256=i7zyyKssWw6EE2zN5putWP9sikkcjUKn7g3Jrapv994,2380
|
|
@@ -10,16 +10,16 @@ pants_baseline/goals/test.py,sha256=THW4kJAFbAzPCjLbq1dxg81T19QdywXYiwTNKSB4z8M,
|
|
|
10
10
|
pants_baseline/goals/typecheck.py,sha256=nqfwy1BZqhEzlDX-_hme9mKuDI2KqH-XpN4ygzWMQ6Y,2626
|
|
11
11
|
pants_baseline/rules/__init__.py,sha256=UpvDpGVImhRfp2_VeUNsRPGiWjBbMI6AV1-Yx3kS0Gg,252
|
|
12
12
|
pants_baseline/rules/audit_rules.py,sha256=gr-2u0u07z62Q42c9vXVGJng8UPIP5JzZ-SKrl9z7yM,2762
|
|
13
|
-
pants_baseline/rules/fmt_rules.py,sha256
|
|
14
|
-
pants_baseline/rules/lint_rules.py,sha256=
|
|
13
|
+
pants_baseline/rules/fmt_rules.py,sha256=O-JQVk565H8w6jlsG-cqndzNaig3alepqTV0zKhfyDw,4174
|
|
14
|
+
pants_baseline/rules/lint_rules.py,sha256=rYsbaPyYNDVDJn_dF91ews8iskcj2QoqnzZInLxkIzc,4219
|
|
15
15
|
pants_baseline/rules/test_rules.py,sha256=jj4lk3-mueOPujPFPK2TCdBFZZA_vovdDdHED9jGp7U,4225
|
|
16
|
-
pants_baseline/rules/typecheck_rules.py,sha256=
|
|
16
|
+
pants_baseline/rules/typecheck_rules.py,sha256=XmL6uIXwjphB1YDVMrCM6A_Wa_1H-gHuLg8x59v_YQo,4499
|
|
17
17
|
pants_baseline/subsystems/__init__.py,sha256=LteH_qmUIgRAnXYmmi7f6o894QfpY3hMNH5dlvJbSoM,387
|
|
18
18
|
pants_baseline/subsystems/baseline.py,sha256=KWDRMdLOUN5cNHntY8f97bSsoITXwmX4ET6n2aW-cRk,2049
|
|
19
|
-
pants_baseline/subsystems/ruff.py,sha256=
|
|
19
|
+
pants_baseline/subsystems/ruff.py,sha256=NW0AFv59-j6ANkZG8LjvuXPzWBD4yDsEr7Pb6eZbdck,3941
|
|
20
20
|
pants_baseline/subsystems/ty.py,sha256=OpaU8Z7Bk6kj5QAfhPom5L9v8sKNR8XF664_U5mUVJw,3419
|
|
21
21
|
pants_baseline/subsystems/uv.py,sha256=dXmVzg4ZxzHa4g_TowEZXMYuhKiTOHjqqadkNrZQ9jk,3066
|
|
22
|
-
jaymd96_pants_baseline-0.1.
|
|
23
|
-
jaymd96_pants_baseline-0.1.
|
|
24
|
-
jaymd96_pants_baseline-0.1.
|
|
25
|
-
jaymd96_pants_baseline-0.1.
|
|
22
|
+
jaymd96_pants_baseline-0.1.10.dist-info/METADATA,sha256=D1fkzXNiYUzeX9dwCowPYkGkdEw-gr26O6BRkFklHrQ,7935
|
|
23
|
+
jaymd96_pants_baseline-0.1.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
24
|
+
jaymd96_pants_baseline-0.1.10.dist-info/licenses/LICENSE,sha256=oLGLZv7XKM_oKCbdMW1bZB37SXsdexmhNSuh3Xg4m4I,10754
|
|
25
|
+
jaymd96_pants_baseline-0.1.10.dist-info/RECORD,,
|
pants_baseline/__about__.py
CHANGED
pants_baseline/register.py
CHANGED
|
@@ -6,7 +6,7 @@ It registers all rules, targets, and subsystems provided by this plugin.
|
|
|
6
6
|
|
|
7
7
|
from typing import Iterable
|
|
8
8
|
|
|
9
|
-
from pants.engine.rules import Rule
|
|
9
|
+
from pants.engine.rules import Rule
|
|
10
10
|
|
|
11
11
|
from pants_baseline.goals import audit as audit_goal
|
|
12
12
|
from pants_baseline.goals import fmt as fmt_goal
|
|
@@ -22,18 +22,23 @@ from pants_baseline.targets import BaselinePythonProject
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def rules() -> Iterable[Rule]:
|
|
25
|
-
"""Return all rules provided by this plugin.
|
|
25
|
+
"""Return all rules provided by this plugin.
|
|
26
|
+
|
|
27
|
+
Each module's rules() function returns both @rule decorated functions
|
|
28
|
+
AND UnionRule registrations. We must call the rules() functions directly
|
|
29
|
+
rather than using collect_rules() which only collects @rule functions.
|
|
30
|
+
"""
|
|
26
31
|
return [
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
*lint_rules.rules(),
|
|
33
|
+
*fmt_rules.rules(),
|
|
34
|
+
*typecheck_rules.rules(),
|
|
35
|
+
*test_rules.rules(),
|
|
36
|
+
*audit_rules.rules(),
|
|
37
|
+
*lint_goal.rules(),
|
|
38
|
+
*fmt_goal.rules(),
|
|
39
|
+
*typecheck_goal.rules(),
|
|
40
|
+
*test_goal.rules(),
|
|
41
|
+
*audit_goal.rules(),
|
|
37
42
|
]
|
|
38
43
|
|
|
39
44
|
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Iterable
|
|
5
5
|
|
|
6
|
-
from pants.core.goals.fmt import FmtResult, FmtTargetsRequest
|
|
6
|
+
from pants.core.goals.fmt import FmtResult, FmtTargetsRequest, PartitionerType
|
|
7
7
|
from pants.core.util_rules.external_tool import DownloadedExternalTool, ExternalToolRequest
|
|
8
8
|
from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest
|
|
9
9
|
from pants.engine.fs import Digest, MergeDigests, Snapshot
|
|
10
10
|
from pants.engine.platform import Platform
|
|
11
11
|
from pants.engine.process import FallibleProcessResult, Process
|
|
12
12
|
from pants.engine.rules import Get, MultiGet, collect_rules, rule
|
|
13
|
-
from pants.engine.target import FieldSet
|
|
14
|
-
from pants.engine.unions import UnionRule
|
|
13
|
+
from pants.engine.target import FieldSet, Target
|
|
15
14
|
from pants.util.logging import LogLevel
|
|
16
15
|
|
|
17
16
|
from pants_baseline.subsystems.baseline import BaselineSubsystem
|
|
@@ -28,38 +27,44 @@ class RuffFmtFieldSet(FieldSet):
|
|
|
28
27
|
sources: BaselineSourcesField
|
|
29
28
|
skip_fmt: SkipFormatField
|
|
30
29
|
|
|
30
|
+
@classmethod
|
|
31
|
+
def opt_out(cls, tgt: Target) -> bool:
|
|
32
|
+
"""Allow targets to opt out of formatting."""
|
|
33
|
+
return tgt.get(SkipFormatField).value
|
|
34
|
+
|
|
31
35
|
|
|
32
36
|
class RuffFmtRequest(FmtTargetsRequest):
|
|
33
37
|
"""Request to run Ruff formatting."""
|
|
34
38
|
|
|
35
39
|
field_set_type = RuffFmtFieldSet
|
|
36
|
-
|
|
40
|
+
tool_subsystem = RuffSubsystem
|
|
41
|
+
partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION
|
|
37
42
|
|
|
38
43
|
|
|
39
44
|
@rule(desc="Format with Ruff", level=LogLevel.DEBUG)
|
|
40
45
|
async def run_ruff_fmt(
|
|
41
|
-
request: RuffFmtRequest,
|
|
46
|
+
request: RuffFmtRequest.Batch,
|
|
42
47
|
ruff_subsystem: RuffSubsystem,
|
|
43
48
|
baseline_subsystem: BaselineSubsystem,
|
|
44
49
|
platform: Platform,
|
|
45
50
|
) -> FmtResult:
|
|
46
51
|
"""Run Ruff formatter on Python files."""
|
|
52
|
+
field_sets = request.elements
|
|
53
|
+
snapshot = request.snapshot
|
|
54
|
+
|
|
47
55
|
if not baseline_subsystem.enabled:
|
|
48
56
|
return FmtResult(
|
|
49
|
-
input=
|
|
50
|
-
output=
|
|
57
|
+
input=snapshot,
|
|
58
|
+
output=snapshot,
|
|
51
59
|
stdout="",
|
|
52
60
|
stderr="",
|
|
53
61
|
formatter_name="ruff",
|
|
54
62
|
)
|
|
55
63
|
|
|
56
|
-
# Filter out skipped targets
|
|
57
|
-
field_sets = [fs for fs in request.field_sets if not fs.skip_fmt.value]
|
|
58
|
-
|
|
59
64
|
if not field_sets:
|
|
60
65
|
return FmtResult(
|
|
61
|
-
input=
|
|
62
|
-
output=
|
|
66
|
+
input=snapshot,
|
|
67
|
+
output=snapshot,
|
|
63
68
|
stdout="No targets to format",
|
|
64
69
|
stderr="",
|
|
65
70
|
formatter_name="ruff",
|
|
@@ -79,8 +84,8 @@ async def run_ruff_fmt(
|
|
|
79
84
|
|
|
80
85
|
if not sources.files:
|
|
81
86
|
return FmtResult(
|
|
82
|
-
input=
|
|
83
|
-
output=
|
|
87
|
+
input=snapshot,
|
|
88
|
+
output=snapshot,
|
|
84
89
|
stdout="No files to format",
|
|
85
90
|
stderr="",
|
|
86
91
|
formatter_name="ruff",
|
|
@@ -129,5 +134,5 @@ def rules() -> Iterable:
|
|
|
129
134
|
"""Return all format rules."""
|
|
130
135
|
return [
|
|
131
136
|
*collect_rules(),
|
|
132
|
-
|
|
137
|
+
*RuffFmtRequest.rules(),
|
|
133
138
|
]
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Iterable
|
|
5
5
|
|
|
6
|
-
from pants.core.goals.lint import LintResult, LintTargetsRequest
|
|
6
|
+
from pants.core.goals.lint import LintResult, LintTargetsRequest, PartitionerType
|
|
7
7
|
from pants.core.util_rules.external_tool import DownloadedExternalTool, ExternalToolRequest
|
|
8
|
+
from pants.core.util_rules.partitions import Partitions
|
|
8
9
|
from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest
|
|
9
10
|
from pants.engine.fs import Digest, MergeDigests
|
|
10
11
|
from pants.engine.platform import Platform
|
|
11
12
|
from pants.engine.process import FallibleProcessResult, Process
|
|
12
13
|
from pants.engine.rules import Get, MultiGet, collect_rules, rule
|
|
13
|
-
from pants.engine.target import FieldSet
|
|
14
|
-
from pants.engine.unions import UnionRule
|
|
14
|
+
from pants.engine.target import FieldSet, Target
|
|
15
15
|
from pants.util.logging import LogLevel
|
|
16
16
|
|
|
17
17
|
from pants_baseline.subsystems.baseline import BaselineSubsystem
|
|
@@ -28,17 +28,23 @@ class RuffLintFieldSet(FieldSet):
|
|
|
28
28
|
sources: BaselineSourcesField
|
|
29
29
|
skip_lint: SkipLintField
|
|
30
30
|
|
|
31
|
+
@classmethod
|
|
32
|
+
def opt_out(cls, tgt: Target) -> bool:
|
|
33
|
+
"""Allow targets to opt out of linting."""
|
|
34
|
+
return tgt.get(SkipLintField).value
|
|
35
|
+
|
|
31
36
|
|
|
32
37
|
class RuffLintRequest(LintTargetsRequest):
|
|
33
38
|
"""Request to run Ruff linting."""
|
|
34
39
|
|
|
35
40
|
field_set_type = RuffLintFieldSet
|
|
36
|
-
|
|
41
|
+
tool_subsystem = RuffSubsystem
|
|
42
|
+
partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION
|
|
37
43
|
|
|
38
44
|
|
|
39
45
|
@rule(desc="Lint with Ruff", level=LogLevel.DEBUG)
|
|
40
46
|
async def run_ruff_lint(
|
|
41
|
-
request: RuffLintRequest,
|
|
47
|
+
request: RuffLintRequest.Batch,
|
|
42
48
|
ruff_subsystem: RuffSubsystem,
|
|
43
49
|
baseline_subsystem: BaselineSubsystem,
|
|
44
50
|
platform: Platform,
|
|
@@ -53,8 +59,7 @@ async def run_ruff_lint(
|
|
|
53
59
|
partition_description=None,
|
|
54
60
|
)
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
field_sets = [fs for fs in request.field_sets if not fs.skip_lint.value]
|
|
62
|
+
field_sets = request.elements
|
|
58
63
|
|
|
59
64
|
if not field_sets:
|
|
60
65
|
return LintResult(
|
|
@@ -121,7 +126,7 @@ async def run_ruff_lint(
|
|
|
121
126
|
stdout=result.stdout.decode(),
|
|
122
127
|
stderr=result.stderr.decode(),
|
|
123
128
|
linter_name="ruff",
|
|
124
|
-
partition_description=
|
|
129
|
+
partition_description=request.partition_metadata,
|
|
125
130
|
)
|
|
126
131
|
|
|
127
132
|
|
|
@@ -129,5 +134,5 @@ def rules() -> Iterable:
|
|
|
129
134
|
"""Return all lint rules."""
|
|
130
135
|
return [
|
|
131
136
|
*collect_rules(),
|
|
132
|
-
|
|
137
|
+
*RuffLintRequest.rules(),
|
|
133
138
|
]
|
|
@@ -10,7 +10,7 @@ from pants.engine.fs import Digest, MergeDigests
|
|
|
10
10
|
from pants.engine.platform import Platform
|
|
11
11
|
from pants.engine.process import FallibleProcessResult, Process
|
|
12
12
|
from pants.engine.rules import Get, MultiGet, collect_rules, rule
|
|
13
|
-
from pants.engine.target import FieldSet
|
|
13
|
+
from pants.engine.target import FieldSet, Target
|
|
14
14
|
from pants.engine.unions import UnionRule
|
|
15
15
|
from pants.util.logging import LogLevel
|
|
16
16
|
|
|
@@ -28,6 +28,11 @@ class TyFieldSet(FieldSet):
|
|
|
28
28
|
sources: BaselineSourcesField
|
|
29
29
|
skip_typecheck: SkipTypecheckField
|
|
30
30
|
|
|
31
|
+
@classmethod
|
|
32
|
+
def opt_out(cls, tgt: Target) -> bool:
|
|
33
|
+
"""Allow targets to opt out of type checking."""
|
|
34
|
+
return tgt.get(SkipTypecheckField).value
|
|
35
|
+
|
|
31
36
|
|
|
32
37
|
class TyCheckRequest(CheckRequest):
|
|
33
38
|
"""Request to run ty type checking."""
|
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from pants.core.util_rules.external_tool import ExternalTool
|
|
6
6
|
from pants.engine.platform import Platform
|
|
7
|
-
from pants.option.option_types import BoolOption, StrListOption, StrOption
|
|
7
|
+
from pants.option.option_types import BoolOption, SkipOption, StrListOption, StrOption
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class RuffSubsystem(ExternalTool):
|
|
@@ -42,6 +42,9 @@ class RuffSubsystem(ExternalTool):
|
|
|
42
42
|
"""Return the path to the ruff executable within the downloaded archive."""
|
|
43
43
|
return "ruff"
|
|
44
44
|
|
|
45
|
+
# Skip option required by Pants for tool subsystems
|
|
46
|
+
skip = SkipOption("lint", "fmt")
|
|
47
|
+
|
|
45
48
|
# Linting configuration
|
|
46
49
|
select = StrListOption(
|
|
47
50
|
default=[
|
|
File without changes
|
{jaymd96_pants_baseline-0.1.8.dist-info → jaymd96_pants_baseline-0.1.10.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|