File: check_requirements.py

package info (click to toggle)
nbconvert 7.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,056 kB
  • sloc: python: 8,449; makefile: 199; javascript: 2
file content (32 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Verify that the "all" reqs are in sync."""

import sys

from tomli import load

with open("pyproject.toml", "rb") as fid:
    data = load(fid)

all_reqs = data["project"]["optional-dependencies"]["all"]
remaining_all = all_reqs.copy()
errors = []

for key, reqs in data["project"]["optional-dependencies"].items():
    if key == "all":
        continue
    for req in reqs:
        if req not in all_reqs:
            errors.append(req)
        elif req in remaining_all:
            remaining_all.remove(req)

if errors:
    print('Missing deps in "all" reqs:')
    print(list(errors))

if remaining_all:
    print('Reqs in "all" but nowhere else:')
    print(list(remaining_all))

if errors or remaining_all:
    sys.exit(1)