Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use constraints.txt for lower bound testing #1713

Merged
merged 6 commits into from
Nov 30, 2021

Conversation

matthewfeickert
Copy link
Member

@matthewfeickert matthewfeickert commented Nov 29, 2021

Description

As suggested by @henryiii on Twitter, rename the lower-bound-requirements.txt to constraints.txt and use it as a pip constraints file instead of as a requirements.txt.

$ pip install --help | grep constraints
  -c, --constraint <file>     Constrain versions using the given constraints

and from the pip docs on constraints files:

Constraints files are requirements files that only control which version of a requirement is installed, not whether it is installed or not. Their syntax and contents is a subset of Requirements Files, with several kinds of syntax not allowed: constraints must have a name, they cannot be editable, and they cannot specify extras. In terms of semantics, there is one key difference: Including a package in a constraints file does not trigger installation of the package.

As also suggested by @henryiii in Issue #1685, move the constraints.txt under the tests directory to reduce clutter in the top level directory.

As constraints files work like requirements files they are still able to follow --find-links URLs and so can download old jaxlib releases from https://storage.googleapis.com/jax-releases/jax_releases.html. 👍

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR
* Use pip's options for constraints files to test lower bounds of install
requirements.
   - Rename 'lower-bound-requirements.txt' to 'constraints.txt'.
   - Use pip's --constraint option while installing the 'test' extra that
     includes all backends and user extras.
   - c.f. https://pip.pypa.io/en/stable/user_guide/#constraints-files
   - Note that transitioning from a requirements file to a constraints file
     works only because the 'test' extra already specifies all of the
     libraries found in the constraints file. Constraints files do NOT
     ensure that a library is installed. They only ensure that if it IS
     installed that it meets the constraints specified in the constraints
     files.
     > Constraints files are requirements files that only control which
     > version of a requirement is installed, not whether it is installed
     > or not.
* Move the constraints.txt under the tests/ directory to reduce clutter
in the top level of the repository.

@matthewfeickert matthewfeickert added the chore Other changes that don't modify src or test files label Nov 29, 2021
@matthewfeickert matthewfeickert self-assigned this Nov 29, 2021
@codecov
Copy link

codecov bot commented Nov 29, 2021

Codecov Report

Merging #1713 (4da7cba) into master (6103f13) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1713   +/-   ##
=======================================
  Coverage   98.12%   98.12%           
=======================================
  Files          64       64           
  Lines        4269     4269           
  Branches      682      682           
=======================================
  Hits         4189     4189           
  Misses         46       46           
  Partials       34       34           
Flag Coverage Δ
contrib 26.25% <ø> (ø)
doctest 60.59% <ø> (ø)
unittests 96.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6103f13...4da7cba. Read the comment docs.

@matthewfeickert
Copy link
Member Author

If I diff the output of pip list for the lower-bound-requirements.txt vs. constraints.txt I get

$ diff --color -u /tmp/lower-bound-requirements-output.txt /tmp/constraints-output.txt 
--- /tmp/lower-bound-requirements-output.txt	2021-11-29 20:44:15.692252460 -0600
+++ /tmp/constraints-output.txt	2021-11-29 20:44:41.536190380 -0600
@@ -1,11 +1,12 @@
 absl-py                 1.0.0
 ansiwrap                0.8.4
+appdirs                 1.4.4
 argcomplete             1.12.3
 argon2-cffi             21.1.0
 astunparse              1.6.3
 attrs                   21.2.0
 backcall                0.2.0
-black                   21.11b1
+black                   20.8b0
 bleach                  4.1.0
 cachetools              4.2.4
 certifi                 2021.10.8
@@ -80,7 +81,6 @@
 pickleshare             0.7.5
 Pillow                  8.4.0
 pip                     21.3.1
-platformdirs            2.4.0
 pluggy                  1.0.0
 prometheus-client       0.12.0
 prompt-toolkit          3.0.23

which seems acceptable as none of those are specified in either files. So I'll merge this now that there is 1 approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Other changes that don't modify src or test files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants