• 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

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

4
from __future__ import annotations
1✔
5

6
import logging
1✔
7
import os
1✔
8
from pathlib import Path
1✔
9

10
from pants.base.build_root import BuildRoot
1✔
11
from pants.engine.internals import native_engine
1✔
12
from pants.version import VERSION
1✔
13

14
logger = logging.getLogger(__name__)
1✔
15

16

17
def pants_version() -> str:
1✔
18
    """Returns the pants semantic version number as a string: http://semver.org/"""
19
    return VERSION
1✔
20

21

22
def get_buildroot() -> str:
1✔
23
    """Returns the Pants build root, calculating it if needed.
24

25
    :API: public
26
    """
27
    return BuildRoot().path
1✔
28

29

30
def get_pants_cachedir() -> str:
1✔
31
    """Return the Pants global cache directory."""
32
    return native_engine.default_cache_path()
1✔
33

34

35
def get_default_pants_config_file() -> str:
1✔
36
    """Return the default location of the Pants config file."""
UNCOV
37
    return os.path.join(get_buildroot(), "pants.toml")
×
38

39

40
def is_in_container() -> bool:
1✔
41
    """Return true if this process is likely running inside of a container."""
42
    # https://stackoverflow.com/a/49944991/38265 and https://github.com/containers/podman/issues/3586
43
    cgroup = Path("/proc/self/cgroup")
1✔
44
    return (
1✔
45
        Path("/.dockerenv").exists()
46
        or Path("/run/.containerenv").exists()
47
        or (cgroup.exists() and "docker" in cgroup.read_text("utf-8"))
48
    )
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