jaymd96-pants-baseline 0.2.8__py3-none-any.whl → 0.2.13__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jaymd96-pants-baseline
3
- Version: 0.2.8
3
+ Version: 0.2.13
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,7 +1,7 @@
1
- pants_baseline/__about__.py,sha256=rYvO_FgZBX0E61te4WmlaIkWMVFRmzs4_mVxriX6Ut8,98
1
+ pants_baseline/__about__.py,sha256=On-8H4CVaZnmDHdrclfVLENOgMLUZoIe0eVC5y4_GDg,99
2
2
  pants_baseline/__init__.py,sha256=uVRGi1D2gFjc7emmeewWdcvpO-NsUuKsMbX3rztOxWU,655
3
3
  pants_baseline/bundled_claude_plugins.py,sha256=rHchQRQ_UabOOKyQOxVwoyE2xLjE8eiUFVN7oERDCe0,1608
4
- pants_baseline/register.py,sha256=_ahV7CRNWxv4lUXb03ZBM9vJnP4ekLw8DgnpInVK35o,1078
4
+ pants_baseline/register.py,sha256=1ROcYLg3JYoHIxxaytrEFHuqL3cvCmKWqkNIl7G6RpU,1426
5
5
  pants_baseline/targets.py,sha256=Z9O09Aqd5inMqwIUFt4HSE9HtWjn8pGSU4FZHg22Tpo,3379
6
6
  pants_baseline/goals/__init__.py,sha256=pf6KU2CIQuDkx8ER3IS0H-kuNbBtX-AH5B5SnSP9_yw,192
7
7
  pants_baseline/goals/audit.py,sha256=i7zyyKssWw6EE2zN5putWP9sikkcjUKn7g3Jrapv994,2380
@@ -11,16 +11,16 @@ pants_baseline/goals/test.py,sha256=THW4kJAFbAzPCjLbq1dxg81T19QdywXYiwTNKSB4z8M,
11
11
  pants_baseline/goals/typecheck.py,sha256=nqfwy1BZqhEzlDX-_hme9mKuDI2KqH-XpN4ygzWMQ6Y,2626
12
12
  pants_baseline/rules/__init__.py,sha256=UpvDpGVImhRfp2_VeUNsRPGiWjBbMI6AV1-Yx3kS0Gg,252
13
13
  pants_baseline/rules/audit_rules.py,sha256=5VzHExJdvB00KrVIAuxlb7pwNfTC0djr5QzF8wXMYws,2906
14
- pants_baseline/rules/fmt_rules.py,sha256=O8vVpfQMvgrITJEMXIldyBmMWEBP3VCXmkTJuMImqYg,3682
15
- pants_baseline/rules/lint_rules.py,sha256=EdHmydXbAom2p3vPdq_JGS8ZrylQZ0UPtn-TWYOBoPI,4252
14
+ pants_baseline/rules/fmt_rules.py,sha256=p7nvsISynBDkCGDOjgleEKwW7cmgs3YDSIQEOTGvur0,3447
15
+ pants_baseline/rules/lint_rules.py,sha256=TP5x52cVPXPFaxWFtdGptL5RTXkDmGpRBJsZ33TTUYI,4200
16
16
  pants_baseline/rules/test_rules.py,sha256=Q_opWXkNS2IDSRQmDdYz-PETl9QEXgwaO_iPN4QWHjY,4268
17
17
  pants_baseline/rules/typecheck_rules.py,sha256=5jr7S9IPzDQOdO5kwwpn3q6m45GKJVlEDO2FN8wN6Ac,4579
18
18
  pants_baseline/subsystems/__init__.py,sha256=LteH_qmUIgRAnXYmmi7f6o894QfpY3hMNH5dlvJbSoM,387
19
19
  pants_baseline/subsystems/baseline.py,sha256=CU8ZhNCJw8BSXSyuvZ1eH-Y2CSPggp2O-I2bVqF3WEU,2187
20
- pants_baseline/subsystems/ruff.py,sha256=47fQg4fM_qzLGfxb_WFLYT1URL_4VxkJWw7LBOEQyT0,4248
20
+ pants_baseline/subsystems/ruff.py,sha256=qUt7cFVpaVYrrbzY6U6hCTloqny3KopyJ4I7UJPX3X0,4610
21
21
  pants_baseline/subsystems/ty.py,sha256=F9F2YyYlbt1PlvsVP8qMAa_l0C-JezyjiDnBs4RMTIc,3722
22
22
  pants_baseline/subsystems/uv.py,sha256=z8gflmuuF0mEN4Bhlp29w2BlrM0M-4cYv7Y0wKhjOnk,3369
23
- jaymd96_pants_baseline-0.2.8.dist-info/METADATA,sha256=EoHbSJMNHtdFpzOilFP2Qkbq4uIoonk1ZUpBVGMl0UQ,8764
24
- jaymd96_pants_baseline-0.2.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
25
- jaymd96_pants_baseline-0.2.8.dist-info/licenses/LICENSE,sha256=oLGLZv7XKM_oKCbdMW1bZB37SXsdexmhNSuh3Xg4m4I,10754
26
- jaymd96_pants_baseline-0.2.8.dist-info/RECORD,,
23
+ jaymd96_pants_baseline-0.2.13.dist-info/METADATA,sha256=sXYVvhf7dCZ17cLRud1aJJqxXDNTnmienK1dXGD25q8,8765
24
+ jaymd96_pants_baseline-0.2.13.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
25
+ jaymd96_pants_baseline-0.2.13.dist-info/licenses/LICENSE,sha256=oLGLZv7XKM_oKCbdMW1bZB37SXsdexmhNSuh3Xg4m4I,10754
26
+ jaymd96_pants_baseline-0.2.13.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  """Version information for jaymd96-pants-baseline."""
2
2
 
3
- __version__ = "0.2.8"
3
+ __version__ = "0.2.13"
4
4
  __author__ = "James"
@@ -7,11 +7,14 @@ This plugin integrates with Pants' built-in lint, fmt, and check goals
7
7
  rather than providing custom goals.
8
8
  """
9
9
 
10
- from typing import Iterable
10
+ from typing import Iterable, Type
11
11
 
12
12
  from pants.engine.rules import Rule
13
+ from pants.option.subsystem import Subsystem
13
14
 
14
15
  from pants_baseline.rules import fmt_rules, lint_rules
16
+ from pants_baseline.subsystems.baseline import BaselineSubsystem
17
+ from pants_baseline.subsystems.ruff import RuffSubsystem
15
18
  from pants_baseline.targets import BaselinePythonProject
16
19
 
17
20
 
@@ -32,3 +35,11 @@ def rules() -> Iterable[Rule]:
32
35
  def target_types() -> Iterable[type]:
33
36
  """Return all custom target types provided by this plugin."""
34
37
  return [BaselinePythonProject]
38
+
39
+
40
+ def subsystems() -> Iterable[Type[Subsystem]]:
41
+ """Return all subsystems provided by this plugin."""
42
+ return [
43
+ BaselineSubsystem,
44
+ RuffSubsystem,
45
+ ]
@@ -6,12 +6,12 @@ from typing import Any, Iterable
6
6
  from pants.core.goals.fmt import FmtResult, FmtTargetsRequest
7
7
  from pants.core.util_rules.external_tool import DownloadedExternalTool, download_external_tool
8
8
  from pants.core.util_rules.partitions import PartitionerType
9
- from pants.engine.fs import Digest, MergeDigests, Snapshot
10
- from pants.engine.intrinsics import digest_to_snapshot, merge_digests
9
+ from pants.engine.fs import Digest, MergeDigests
10
+ from pants.engine.intrinsics import merge_digests
11
11
  from pants.engine.platform import Platform
12
12
  from pants.engine.process import FallibleProcessResult, Process, execute_process_or_raise
13
13
  from pants.engine.rules import collect_rules, implicitly, rule
14
- from pants.engine.target import FieldSet, Target
14
+ from pants.engine.target import FieldSet
15
15
  from pants.util.logging import LogLevel
16
16
  from pants.util.meta import classproperty
17
17
 
@@ -75,13 +75,12 @@ async def run_ruff_fmt(
75
75
  )
76
76
 
77
77
  # Build Ruff format command
78
+ # Note: quote-style and indent-style are config file options only in ruff 0.9+
78
79
  argv = [
79
80
  downloaded_ruff.exe,
80
81
  "format",
81
82
  f"--target-version=py{baseline_subsystem.python_version.replace('.', '')}",
82
83
  f"--line-length={baseline_subsystem.line_length}",
83
- f"--quote-style={ruff_subsystem.quote_style}",
84
- f"--indent-style={ruff_subsystem.indent_style}",
85
84
  *snapshot.files,
86
85
  ]
87
86
 
@@ -96,15 +95,9 @@ async def run_ruff_fmt(
96
95
  )
97
96
  )
98
97
  )
99
- output_snapshot: Snapshot = await digest_to_snapshot(result.output_digest)
100
-
101
- return FmtResult(
102
- input=snapshot,
103
- output=output_snapshot,
104
- stdout=result.stdout.decode(),
105
- stderr=result.stderr.decode(),
106
- formatter_name="baseline-ruff-fmt",
107
- )
98
+
99
+ # FmtResult.create() is async and takes 2 args in Pants 2.30+
100
+ return await FmtResult.create(request, result)
108
101
 
109
102
 
110
103
  def rules() -> Iterable:
@@ -8,11 +8,11 @@ from pants.core.util_rules.external_tool import DownloadedExternalTool, download
8
8
  from pants.core.util_rules.partitions import PartitionerType
9
9
  from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest, determine_source_files
10
10
  from pants.engine.fs import Digest, MergeDigests
11
- from pants.engine.intrinsics import merge_digests
11
+ from pants.engine.intrinsics import execute_process, merge_digests
12
12
  from pants.engine.platform import Platform
13
- from pants.engine.process import FallibleProcessResult, Process, execute_process_or_raise
13
+ from pants.engine.process import Process
14
14
  from pants.engine.rules import collect_rules, implicitly, rule
15
- from pants.engine.target import FieldSet, Target
15
+ from pants.engine.target import FieldSet
16
16
  from pants.util.logging import LogLevel
17
17
  from pants.util.meta import classproperty
18
18
 
@@ -89,35 +89,31 @@ async def run_ruff_lint(
89
89
  select_args = [f"--select={','.join(ruff_subsystem.select)}"] if ruff_subsystem.select else []
90
90
  ignore_args = [f"--ignore={','.join(ruff_subsystem.ignore)}"] if ruff_subsystem.ignore else []
91
91
 
92
+ # Build Ruff check command
93
+ # Note: line-length is a config file option only in ruff 0.9+
92
94
  argv = [
93
95
  downloaded_ruff.exe,
94
96
  "check",
95
97
  f"--target-version=py{baseline_subsystem.python_version.replace('.', '')}",
96
- f"--line-length={baseline_subsystem.line_length}",
97
98
  *select_args,
98
99
  *ignore_args,
99
- "--output-format=text",
100
+ "--output-format=concise",
100
101
  *sources.files,
101
102
  ]
102
103
 
103
- result: FallibleProcessResult = await execute_process_or_raise(
104
- **implicitly(
105
- Process(
106
- argv=argv,
107
- input_digest=input_digest,
108
- description=f"Run Ruff lint on {len(sources.files)} files",
109
- level=LogLevel.DEBUG,
110
- )
111
- )
104
+ # execute_process returns FallibleProcessResult which LintResult.create accepts directly
105
+ process_result = await execute_process(
106
+ Process(
107
+ argv=argv,
108
+ input_digest=input_digest,
109
+ description=f"Run Ruff lint on {len(sources.files)} files",
110
+ level=LogLevel.DEBUG,
111
+ ),
112
+ **implicitly(),
112
113
  )
113
114
 
114
- return LintResult.create(
115
- request,
116
- exit_code=result.exit_code,
117
- stdout=result.stdout.decode(),
118
- stderr=result.stderr.decode(),
119
- strip_chroot_path=True,
120
- )
115
+ # LintResult.create() takes 2 args in Pants 2.30+
116
+ return LintResult.create(request, process_result)
121
117
 
122
118
 
123
119
  def rules() -> Iterable:
@@ -22,11 +22,11 @@ class RuffSubsystem(ExternalTool):
22
22
 
23
23
  default_version = "0.9.6"
24
24
  default_known_versions = [
25
- # Ruff 0.9.6 - January 2025
26
- "0.9.6|macos_arm64|sha256:a18dc93aa6cdb70d0c6e7d69b827f0ded6ae53c8cc5dee7fd64a7f3ac1eec2b6|11036800",
27
- "0.9.6|macos_x86_64|sha256:8d2c42f60d81e17c29b88f4e41f0d94a1c89d3c5858bc6c9e7f7c6e1b0b0c0d0|11547136",
28
- "0.9.6|linux_arm64|sha256:c5c72a6d0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c|10941952",
29
- "0.9.6|linux_x86_64|sha256:d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4d4|11689472",
25
+ # Ruff 0.9.6 - Format: version|platform|sha256_hash|file_size_bytes
26
+ "0.9.6|macos_arm64|a3132eb5e3d95f36d378144082276fbed0309789dadb19d8a4c41ec5e80451fb|11124436",
27
+ "0.9.6|macos_x86_64|ec88c095036b25e95391ea202fcc9496d565f4e43152db10785eb9757ea0815d|11663591",
28
+ "0.9.6|linux_arm64|cf796c953def5a7102002372893942fac875ac718355698a4a70405104dfbb6c|11946730",
29
+ "0.9.6|linux_x86_64|bed850f15d4d5aaaef2b6a131bfecd5b9d7d3191596249d07e576bd9fd37078e|12511815",
30
30
  ]
31
31
 
32
32
  def generate_url(self, plat: Platform) -> str:
@@ -43,7 +43,14 @@ class RuffSubsystem(ExternalTool):
43
43
 
44
44
  def generate_exe(self, plat: Platform) -> str:
45
45
  """Return the path to the ruff executable within the downloaded archive."""
46
- return "ruff"
46
+ platform_mapping = {
47
+ "macos_arm64": "aarch64-apple-darwin",
48
+ "macos_x86_64": "x86_64-apple-darwin",
49
+ "linux_arm64": "aarch64-unknown-linux-gnu",
50
+ "linux_x86_64": "x86_64-unknown-linux-gnu",
51
+ }
52
+ plat_str = platform_mapping.get(plat.value, "x86_64-unknown-linux-gnu")
53
+ return f"ruff-{plat_str}/ruff"
47
54
 
48
55
  # Skip option required by Pants for tool subsystems
49
56
  skip = SkipOption("lint", "fmt")