Skip to main content
Version: 2.20

Common subsystem tasks

Common tasks for Subsystems

Skipping individual targets

Many subsystems allow skipping specific targets. For example, you might have Python files that you want to not typecheck with mypy. In Pants, this is achieved with a skip_* field on the target. This is simple to implement.

  1. Create a field for skipping your tool
from import BoolField

class SkipFortranLintField(BoolField):
alias = "skip_fortran_lint"
default = False
help = "If true, don't run fortran-lint on this target's code."
  1. Register this field on the appropriate targets.
def rules():
return [
  1. Add this field as part of your subsystems opt_out method:
from dataclasses import dataclass

from import FieldSet, Target

class FortranLintFieldSet(FieldSet):
required_fields = (FortranSourceField,)

source: FortranSourceField

def opt_out(cls, tgt: Target) -> bool:
return tgt.get(SkipFortranLintField).value