This repository was archived by the owner on Feb 9, 2026. It is now read-only.
Commit 5ebac9f
authored
feat: add lower bound checker (#8)
Add a lower bound checker to be invoked on the command line by client libraries. This accomplishes two things:
- Makes it easier to mass update/create constraints files.
- Adds another layer of checks to the lower bounds in setup.py / constraints files.
See googleapis/synthtool#869 for additional context on the lower bounds work.
`lower-bound-checker` is intentionally restrictive on the types of pins it permits in `setup.py` and `constraints.txt`. The tool doesn't try to `pip install` the package. It is assumed that other checks (e.g., setup.py lint, unit tests) will pick up on things like misspelled package names or a version range that cannot be fulfilled.
```
busunkim@busunkim:~/github/python-test-utils$ lower-bound-checker check --help
Usage: lower-bound-checker check [OPTIONS]
Check that the constraints-file pins to the lower bound specified in
package-name's setup.py for each requirement.
Requirements:
1. The setup.py pins every requirement in one of the following formats:
* foo==1.2.0
* foo>=1.2.0
* foo>=1.2.0, <2.0.0dev
* foo<2.0.0dev, >=1.2.0
2. The constraints file pins every requirement to a single version:
* foo==1.2.0
3. package-name is already be installed in the environment.
Options:
--package-name TEXT Name of the package. [required]
--constraints-file TEXT Path to constraints file. [required]
--help Show this message and exit.
```
**Example Usage:**
(for reviewers)
- Install this repo from source: `pip install /path/to/repo`
- Install another package from source: `pip install /path/to/google-cloud-foo`
1. Check an existing package and constraints file:
```
lower-bound-checker check --package-name google-cloud-foo
--constraints-file testing/constraints-3.6.txt
```
2. Create/update a constraints file:
```
lower-bound-checker update --package-name google-cloud-foo
--constraints-file testing/constraints-3.6.txt
```1 parent 8a3e156 commit 5ebac9f
File tree
11 files changed
+681
-8
lines changed- test_utils/lower_bound_checker
- testing
- tests/unit
- resources
- bad_package
- good_package
11 files changed
+681
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| 37 | + | |
| 38 | + | |
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
| |||
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
| |||
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
57 | | - | |
58 | | - | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
66 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
| |||
Whitespace-only changes.
0 commit comments