• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/python/pants/backend/python/subsystems/setup_py_generation.py
1
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
UNCOV
3
import enum
×
4

UNCOV
5
from pants.option.option_types import BoolOption, EnumOption
×
UNCOV
6
from pants.option.subsystem import Subsystem
×
UNCOV
7
from pants.util.strutil import softwrap
×
8

9

UNCOV
10
@enum.unique
×
UNCOV
11
class FirstPartyDependencyVersionScheme(enum.Enum):
×
UNCOV
12
    EXACT = "exact"  # i.e., ==
×
UNCOV
13
    COMPATIBLE = "compatible"  # i.e., ~=
×
UNCOV
14
    ANY = "any"  # i.e., no specifier
×
15

16

UNCOV
17
class SetupPyGeneration(Subsystem):
×
UNCOV
18
    options_scope = "setup-py-generation"
×
UNCOV
19
    help = "Options to control how setup.py is generated from a `python_distribution` target."
×
20

21
    # Generating setup is the more aggressive thing to do, so we'd prefer that the default
22
    # be False. However that would break widespread existing usage, so we'll make that
23
    # change in a future deprecation cycle.
UNCOV
24
    generate_setup_default = BoolOption(
×
25
        default=True,
26
        help=softwrap(
27
            """
28
            The default value for the `generate_setup` field on `python_distribution` targets.
29
            Can be overridden per-target by setting that field explicitly. Set this to False
30
            if you mostly rely on handwritten setup files (`setup.py`, `setup.cfg` and similar).
31
            Leave as True if you mostly rely on Pants generating setup files for you.
32
            """
33
        ),
34
    )
35

UNCOV
36
    first_party_dependency_version_scheme = EnumOption(
×
37
        default=FirstPartyDependencyVersionScheme.EXACT,
38
        help=softwrap(
39
            """
40
            What version to set in `install_requires` when a `python_distribution` depends on
41
            other `python_distribution`s. If `exact`, will use `==`. If `compatible`, will
42
            use `~=`. If `any`, will leave off the version. See
43
            https://www.python.org/dev/peps/pep-0440/#version-specifiers.
44
            """
45
        ),
46
    )
47

UNCOV
48
    def first_party_dependency_version(self, version: str) -> str:
×
49
        """Return the version string (e.g. '~=4.0') for a first-party dependency.
50

51
        If the user specified to use "any" version, then this will return an empty string.
52
        """
53
        scheme = self.first_party_dependency_version_scheme
×
54
        if scheme == FirstPartyDependencyVersionScheme.ANY:
×
55
            return ""
×
56
        specifier = "==" if scheme == FirstPartyDependencyVersionScheme.EXACT else "~="
×
57
        return f"{specifier}{version}"
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc