Skip to content

Conversation

@busunkim96
Copy link
Contributor

@busunkim96 busunkim96 commented Feb 17, 2021

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
  1. Create/update a constraints file:
lower-bound-checker update --package-name google-cloud-foo
--constraints-file testing/constraints-3.6.txt

Add a lower bound checker to be invoked on the command line
by client libraries.

Example Usage:

lower-bound-checker check --package-name google-cloud-bigquery
--constraints-file testing/constraints-3.6.txt

lower-bound-checker update --package-name google-cloud-bigquery
--constraints-file testing/constraints-3.6.txt
@busunkim96 busunkim96 requested a review from a team as a code owner February 17, 2021 00:06
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Feb 17, 2021
Copy link
Contributor

@parthea parthea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome tool! Just one observation. Otherwise, LGTM

Co-authored-by: Anthonios Partheniou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants