Skip to content

Commit

Permalink
[test] setup.py dependency testing (#1045)
Browse files Browse the repository at this point in the history
* [fix]: experimental import fix

* [test]: catch issue #1042 in the future

* revert trigger for failure

* add numpy dep for users

Co-authored-by: Min Xu <min.xu.public@gmail.com>
  • Loading branch information
min-xu-ai and flying-x committed Jul 29, 2022
1 parent 0a5737c commit d3bda79
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
22 changes: 17 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ jobs:
- <<: *check_test_list
- <<: *setup_venv

# Do this first to test repo dependencies. Basic import should work after this
# installation. See issue #1042 for an example.
- <<: *install_repo

# Cache the venv directory that contains dependencies
- restore_cache:
keys:
Expand All @@ -284,7 +288,6 @@ jobs:
- ~/venv
key: cache-key-cpu-py38-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}

- <<: *install_repo
- <<: *run_unittests
- <<: *run_doc_build

Expand All @@ -301,6 +304,10 @@ jobs:
- <<: *check_test_list
- <<: *setup_venv

# Do this first to test repo dependencies. Basic import should work after this
# installation. See issue #1042 for an example.
- <<: *install_repo

# Cache the venv directory that contains dependencies
- restore_cache:
keys:
Expand All @@ -313,7 +320,6 @@ jobs:
- ~/venv
key: cache-key-cpu-py39-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}

- <<: *install_repo
- <<: *run_unittests
- <<: *run_doc_build

Expand All @@ -330,6 +336,10 @@ jobs:
- <<: *check_test_list
- <<: *setup_venv

# Do this first to test repo dependencies. Basic import should work after this
# installation. See issue #1042 for an example.
- <<: *install_repo

# Cache the venv directory that contains dependencies
- restore_cache:
keys:
Expand All @@ -342,7 +352,6 @@ jobs:
- ~/venv
key: cache-key-cpu-py310-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}

- <<: *install_repo
- <<: *run_unittests
- <<: *run_doc_build

Expand Down Expand Up @@ -540,6 +549,11 @@ jobs:

- <<: *setup_venv

# Do this first to test an issue like #1042. We keep benchmark_1 doing it
# after requirements-dev.txt, but change benchmark_2 to do this earlier to
# ensure both cases are tested.
- <<: *install_repo

# Cache the venv directory that contains dependencies
- restore_cache:
keys:
Expand All @@ -558,8 +572,6 @@ jobs:
- ~/venv
key: cache-key-py-3-9-7-benchmarks-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}

- <<: *install_repo

- <<: *run_oss_benchmark

- save_cache:
Expand Down
2 changes: 1 addition & 1 deletion fairscale/experimental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

# Don't import sub-modules as experimental stuff otherwise gets imported directly
# when user does an `import fairscale`. This can cause experimental code's import
# dependencies (like pygit2) to be leaked into the fairscale main code.
# dependencies (like pygit2) to leak into the fairscale main dependency.

__all__: List[str] = []
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# FairScale should only depends on torch, not things higher level than torch.
# Note1: setup.py automatically reads this file to setup install time dependencies.
# Note2: we use >= in this file but == in requirements-dev.txt for determinism
# in testing.
torch >= 1.8.0
numpy >= 1.22.0

0 comments on commit d3bda79

Please sign in to comment.