Validate the declared minimum dependency versions of workspace packages. Returns: ``0`` if all checked packages pass, ``1`` otherwise.
()
| 538 | |
| 539 | |
| 540 | def main() -> int: |
| 541 | """Validate the declared minimum dependency versions of workspace packages. |
| 542 | |
| 543 | Returns: |
| 544 | ``0`` if all checked packages pass, ``1`` otherwise. |
| 545 | """ |
| 546 | parser = argparse.ArgumentParser(description=__doc__) |
| 547 | parser.add_argument( |
| 548 | "packages", |
| 549 | nargs="*", |
| 550 | help="Package directory names to check (default: all checkable packages).", |
| 551 | ) |
| 552 | parser.add_argument( |
| 553 | "--list", |
| 554 | action="store_true", |
| 555 | help="Print the checkable packages as a JSON array and exit.", |
| 556 | ) |
| 557 | parser.add_argument( |
| 558 | "--check-dev-pins", |
| 559 | action="store_true", |
| 560 | help="Instead of type-checking, scan the selected packages' declared dependencies " |
| 561 | "for development-release (*.dev) pins and exit non-zero if any are found.", |
| 562 | ) |
| 563 | parser.add_argument( |
| 564 | "--python", |
| 565 | default=DEFAULT_PYTHON, |
| 566 | help=f"Interpreter version for the isolated environment (default: {DEFAULT_PYTHON}).", |
| 567 | ) |
| 568 | parser.add_argument( |
| 569 | "-j", |
| 570 | "--jobs", |
| 571 | type=int, |
| 572 | default=1, |
| 573 | help="Number of packages to check in parallel (default: 1).", |
| 574 | ) |
| 575 | args = parser.parse_args() |
| 576 | |
| 577 | if args.check_dev_pins: |
| 578 | return check_dev_pins(args.packages) |
| 579 | |
| 580 | all_packages = discover_packages() |
| 581 | |
| 582 | if args.list: |
| 583 | print(json.dumps([p.name for p in all_packages])) |
| 584 | return 0 |
| 585 | |
| 586 | by_name = {p.name: p for p in all_packages} |
| 587 | if args.packages: |
| 588 | unknown = [name for name in args.packages if name not in by_name] |
| 589 | if unknown: |
| 590 | parser.error( |
| 591 | f"unknown package(s): {', '.join(unknown)}. " |
| 592 | f"Choose from: {', '.join(by_name)}" |
| 593 | ) |
| 594 | selected = [by_name[name] for name in args.packages] |
| 595 | else: |
| 596 | selected = all_packages |
| 597 |
no test coverage detected