• 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

75.0
/src/python/pants/engine/internals/options_parsing.py
1
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from dataclasses import dataclass
1✔
5

6
from pants.engine.internals.session import SessionValues
1✔
7
from pants.engine.rules import collect_rules, rule
1✔
8
from pants.engine.unions import UnionMembership
1✔
9
from pants.option.options import Options
1✔
10
from pants.option.options_bootstrapper import OptionsBootstrapper
1✔
11
from pants.option.scope import OptionsParsingSettings, Scope, ScopedOptions
1✔
12
from pants.util.memo import memoized_property
1✔
13

14

15
@dataclass(frozen=True)
1✔
16
class _Options:
1✔
17
    """A wrapper around bootstrapped options values: not for direct consumption.
18

19
    TODO: This odd indirection exists because the `Options` type does not have useful `eq`, but
20
    OptionsBootstrapper and BuildConfiguration both do.
21
    """
22

23
    options_bootstrapper: OptionsBootstrapper
24
    options_parsing_settings: OptionsParsingSettings
25
    union_membership: UnionMembership
26

27
    def __post_init__(self) -> None:
1✔
28
        # Touch the options property to ensure that it is eagerly initialized at construction time,
29
        # rather than potentially much later in the presence of concurrency.
30
        assert self.options is not None
×
31

32
    @memoized_property
1✔
33
    def options(self) -> Options:
1✔
34
        return self.options_bootstrapper.full_options(
×
35
            self.options_parsing_settings.known_scope_infos,
36
            self.union_membership,
37
            self.options_parsing_settings.allow_unknown_options,
38
        )
39

40

41
@rule
1✔
42
async def parse_options(
1✔
43
    options_parsing_settings: OptionsParsingSettings,
44
    session_values: SessionValues,
45
    union_membership: UnionMembership,
46
) -> _Options:
47
    # TODO: Once the OptionsBootstrapper has been removed from all relevant QueryRules, this lookup
48
    # should be extracted into a separate @rule.
49
    options_bootstrapper = session_values[OptionsBootstrapper]
×
50
    return _Options(options_bootstrapper, options_parsing_settings, union_membership)
×
51

52

53
@rule
1✔
54
async def scope_options(scope: Scope, options: _Options) -> ScopedOptions:
1✔
55
    return ScopedOptions(scope, options.options.for_scope(scope.scope))
×
56

57

58
def rules():
1✔
UNCOV
59
    return collect_rules()
×
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