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

pantsbuild / pants / 19620129386

24 Nov 2025 12:57AM UTC coverage: 43.091% (-37.2%) from 80.283%
19620129386

Pull #22915

github

web-flow
Merge 62d8c85e9 into 612e19cd8
Pull Request #22915: Abstract PosixFS away.

25941 of 60200 relevant lines covered (43.09%)

0.86 hits per line

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

25.0
/src/python/pants/util/requirements.py
1
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from collections.abc import Iterator
2✔
4

5
from pants.util.pip_requirement import PipRequirement
2✔
6

7

8
def parse_requirements_file(content: str, *, rel_path: str) -> Iterator[PipRequirement]:
2✔
9
    """Parse all `PipRequirement` objects from a requirements.txt-style file.
10

11
    This will safely ignore any options starting with `--` and will ignore comments. Any pip-style
12
    VCS requirements will fail, with a helpful error message describing how to use PEP 440.
13
    """
14
    for i, line in enumerate(content.splitlines(), start=1):
×
15
        line, _, _ = line.partition("--")
×
16
        line = line.strip().rstrip("\\")
×
17
        if not line or line.startswith(("#", "-")):
×
18
            continue
×
19

20
        # Strip comments which are otherwise on a valid requirement line.
21
        comment_pos = line.find("#")
×
22
        if comment_pos != -1:
×
23
            line = line[0:comment_pos].strip()
×
24

25
        yield PipRequirement.parse(line, description_of_origin=f"{rel_path} at line {i}")
×
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

© 2026 Coveralls, Inc