Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

reorganize requirements files (#1314)

Edgar Riba80f24492691c
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index 1df648127..1c02339ca 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -13,16 +13,10 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- - name: Cache pip
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
- restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
- pip install -r requirements-dev.txt
+ pip install -r requirements/dev.txt
python setup.py develop --user
- name: Run linter
@@ -32,16 +26,10 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- - name: Cache pip
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
- restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
- pip install -r requirements-dev.txt
+ pip install -r requirements/dev.txt
python setup.py develop --user
- name: Run mypy
@@ -51,16 +39,10 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- - name: Cache pip
- uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
- restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
- pip install -r requirements-dev.txt
+ pip install -r requirements/dev.txt
python setup.py develop --user
- name: Run doctest
diff --git a/.github/workflows/tests_cpu.yml b/.github/workflows/tests_cpu.yml
index bf356fb96..6befc4c0b 100644
--- a/.github/workflows/tests_cpu.yml
+++ b/.github/workflows/tests_cpu.yml
@@ -30,7 +30,7 @@ jobs:
run: |
conda install curl make -c conda-forge
conda install pytorch=${{ matrix.pytorch-version }} cpuonly -c pytorch
- pip install -r requirements-dev.txt
+ pip install -e .[all]
make install
- name: Run Tests
shell: bash -l {0}
@@ -61,7 +61,7 @@ jobs:
run: |
conda install curl make -c conda-forge
conda install pytorch=${{ matrix.pytorch-version }} cpuonly -c pytorch
- pip install -r requirements-dev.txt
+ pip install -e .[all]
make install
- name: Run Tests
shell: bash -l {0}
diff --git a/.github/workflows/tests_cpu_versions.yml b/.github/workflows/tests_cpu_versions.yml
index 11ea6429d..d6cea8454 100644
--- a/.github/workflows/tests_cpu_versions.yml
+++ b/.github/workflows/tests_cpu_versions.yml
@@ -29,7 +29,7 @@ jobs:
run: |
conda install curl make -c conda-forge
conda install pytorch=${{ matrix.pytorch-version }} cpuonly -c pytorch
- pip install -r requirements-dev.txt
+ pip install -e .[all]
make install
- name: Run Tests
shell: bash -l {0}
diff --git a/.github/workflows/tests_cuda.yml b/.github/workflows/tests_cuda.yml
index fce5f0c95..dcb51133b 100644
--- a/.github/workflows/tests_cuda.yml
+++ b/.github/workflows/tests_cuda.yml
@@ -23,8 +23,7 @@ jobs:
run: |
# NOTE: pytorch image does not include git
conda install -c anaconda git
- pip install -r requirements-dev.txt
- python setup.py install
+ pip install -e .[all]
- name: Run Tests
shell: bash -l {0}
run: pytest -v --device cuda --dtype float32,float64 ./test
diff --git a/requirements-dev.txt b/requirements/dev.txt
similarity index 83%
rename from requirements-dev.txt
rename to requirements/dev.txt
index 1f8fae060..a94f76999 100644
--- a/requirements-dev.txt
+++ b/requirements/dev.txt
@@ -1,4 +1,3 @@
-# test
pytest==6.2.5
pytest-flake8==1.0.7
pytest-cov==2.12.1
@@ -11,5 +10,3 @@ yapf
isort
numpy
scipy
-# x
-accelerate==0.4.0
diff --git a/requirements/x.txt b/requirements/x.txt
new file mode 100644
index 000000000..d511deed2
--- /dev/null
+++ b/requirements/x.txt
@@ -0,0 +1,2 @@
+accelerate==0.4.0
+dataclasses
diff --git a/setup.py b/setup.py
index 297187762..0651140c4 100644
--- a/setup.py
+++ b/setup.py
@@ -118,9 +118,17 @@ requirements = [
'packaging' # REMOVE once we deprecate pytorch > 1.7.1. See: issue #1264
]
+
+def load_requirements(filename: str):
+ with open(filename) as f:
+ return [x.strip() for x in f.readlines()]
+
+
requirements_extras = {
- "x": ["accelerate==0.4.0"],
+ "x": load_requirements("requirements/x.txt"),
+ "dev": load_requirements("requirements/dev.txt"),
}
+requirements_extras["all"] = requirements_extras["x"] + requirements_extras["dev"]
if __name__ == '__main__':