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

pantsbuild / pants / 19381742489

15 Nov 2025 12:52AM UTC coverage: 49.706% (-30.6%) from 80.29%
19381742489

Pull #22890

github

web-flow
Merge d961abf79 into 42e1ebd41
Pull Request #22890: Updated all python subsystem constraints to 3.14

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

14659 existing lines in 485 files now uncovered.

31583 of 63540 relevant lines covered (49.71%)

0.79 hits per line

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

69.44
/src/python/pants/version.py
1
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
import os
2✔
5
from typing import Any
2✔
6

7
from packaging.version import Version as _Version
2✔
8

9
import pants._version
2✔
10

11
# Generate an inferable dependency on the `pants._version` package and its associated resources.
12
from pants.util.resources import read_resource
2✔
13

14

15
# Simple derived class to enable comparison with strings in BUILD files.
16
class Version(_Version):
2✔
17
    def __hash__(self):
2✔
18
        # This is required to be directly implemented because we implement __eq__,
19
        # see the docs for object.__hash__:
20
        # https://docs.python.org/3/reference/datamodel.html#object.__hash__
UNCOV
21
        return super().__hash__()
×
22

23
    def __eq__(self, other: Any):
2✔
24
        if isinstance(other, str):
1✔
25
            other = Version(other)
×
26
        return super().__eq__(other)
1✔
27

28
    def __ne__(self, other: Any):
2✔
29
        if isinstance(other, str):
1✔
30
            other = Version(other)
×
31
        return super().__ne__(other)
1✔
32

33
    def __lt__(self, other: Any):
2✔
UNCOV
34
        if isinstance(other, str):
×
35
            other = Version(other)
×
UNCOV
36
        return super().__lt__(other)
×
37

38
    def __le__(self, other: Any):
2✔
39
        if isinstance(other, str):
2✔
40
            other = Version(other)
×
41
        return super().__le__(other)
2✔
42

43
    def __gt__(self, other: Any):
2✔
44
        if isinstance(other, str):
×
45
            other = Version(other)
×
46
        return super().__gt__(other)
×
47

48
    def __ge__(self, other: Any):
2✔
49
        if isinstance(other, str):
2✔
50
            other = Version(other)
×
51
        return super().__ge__(other)
2✔
52

53

54
# Set this env var to override the version pants reports. Useful for testing.
55
# Do not change. (see below)
56
_PANTS_VERSION_OVERRIDE = "_PANTS_VERSION_OVERRIDE"
2✔
57

58

59
VERSION: str = (
2✔
60
    # Do not remove/change this env var without coordinating with `pantsbuild/scie-pants` as it is
61
    # being used when bootstrapping Pants with a released version.
62
    os.environ.get(_PANTS_VERSION_OVERRIDE)
63
    or
64
    # NB: We expect VERSION to always have an entry and want a runtime failure if this is false.
65
    # NB: Since "pants" is the namespace for multiple packages, we need to put VERSION underneath
66
    # the tree that only the `pantsbuild.pants` package owns. Hence `pants._version`.
67
    # Furthermore, we can't outright move the file there from its previous home of pants/VERSION, as
68
    # (as of the time of writing) the Pants shim expects it at pants/VERSION. So we symlink the new
69
    # home to the old home, knowing that Pants is symlink oblivious when collecting sources.
70
    read_resource(pants._version.__name__, "VERSION").decode().strip()
71
)
72

73
PANTS_SEMVER = Version(VERSION)
2✔
74

75
# E.g. 2.0 or 2.2.
76
MAJOR_MINOR = f"{PANTS_SEMVER.major}.{PANTS_SEMVER.minor}"
2✔
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