Repository: facebookresearch/NeuralCompression (language: python)

Issue:
Consolidate *requirements.txt files into setup.cfg



Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index bd48f7c9..44266faa 100644
--- a/README.md
+++ b/README.md
@@ -38,16 +38,10 @@ to get the latest version from PyPI.
 ### Development Installation
 
 First, clone the repository and navigate to the NeuralCompression root
-directory. To match your local environment to the test environment, run
+directory and install the package in development mode by running:
 
 ```bash
-pip install -r dev-requirements.txt
-```
-
-Then, you can install the package in development mode by running
-
-```bash
-pip install -e .
+pip install --editable ".[dev, docs]"
 ```
 
 If you are not interested in matching the test environment, then you only need
diff --git a/dev-requirements.txt b/dev-requirements.txt
deleted file mode 100644
index 13e75a55..00000000
--- a/dev-requirements.txt
+++ /dev/null
@@ -1,9 +0,0 @@
--r requirements.txt
-flake8==3.9.2
-mypy==0.910
-pytest==6.2.4
-pillow==8.3.2
-tensorflow==2.5.1
-tensorflow-addons==0.13.0
-opencv-python==4.5.3.56
-isort==5.9.2
diff --git a/docs/requirements.txt b/docs/requirements.txt
deleted file mode 100644
index 0087e261..00000000
--- a/docs/requirements.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-pillow>=6.2.0
-sphinx-autodoc-typehints>=1.12.0
-sphinx-copybutton>=0.4.0
-sphinx-gallery>=0.10.0
-sphinx-rtd-theme>=0.5.1
-sphinx>=3.2.0
-sphinxcontrib-katex>=0.8.6
diff --git a/mypy.ini b/mypy.ini
deleted file mode 100644
index c1c1086f..00000000
--- a/mypy.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[mypy]
-
-# modules that don't play well with mypy
-[mypy-torchvision.*,PIL.*,compressai.*,tqdm.*,lpips.*,fvcore.*,neuralcompression.ext.*]
-ignore_missing_imports=True
diff --git a/requirements.txt b/requirements.txt
index 63207673..f3419b46 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,1 @@
-torch==1.9.1
-torchvision==0.10.1
-jax==0.2.17
-jaxlib==0.1.69
-compressai==1.1.5
-tqdm==4.61.2
-torchmetrics==0.4.1
-lpips==0.1.3
-fvcore==0.1.5.post20210624
+--editable ".[dev, docs]"
diff --git a/setup.cfg b/setup.cfg
index 8183238a..219d03af 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,61 @@
 [metadata]
 license_files = LICENSE
+
+[mypy]
+
+[mypy-PIL.*]
+ignore_missing_imports = True
+
+[mypy-compressai.*]
+ignore_missing_imports = True
+
+[mypy-fvcore.*]
+ignore_missing_imports = True
+
+[mypy-lpips.*]
+ignore_missing_imports = True
+
+[mypy-neuralcompression.entropy_coders.craystack.*]
+ignore_errors = True
+
+[mypy-neuralcompression.ext.*]
+ignore_errors = True
+
+[mypy-torchvision.*]
+ignore_missing_imports = True
+
+[mypy-tqdm.*]
+ignore_missing_imports = True
+
+[options]
+install_requires =
+    compressai~=1.1.8
+    fvcore~=0.1.5.post20211023
+    jax~=0.2.24
+    jaxlib~=0.1.73
+    lpips~=0.1.4
+    pillow~=8.4.0
+    pytorchvideo~=0.1.3
+    torch==1.9.1
+    torchmetrics~=0.5.1
+    torchvision==0.10.1
+    tqdm~=4.62.3
+
+[options.extras_require]
+dev =
+    black==21.4b2
+    flake8==4.0.1
+    isort==5.9.3
+    mypy==0.910
+    opencv-python~=4.5.4.58
+    pre-commit~=2.15.0
+    pytest==6.2.5
+    tensorflow~=2.6.0
+    tensorflow-addons~=0.14.0
+docs =
+    sphinx-autodoc-typehints~=1.12.0
+    sphinx-copybutton~=0.4.0
+    sphinx-gallery~=0.10.0
+    sphinx-rtd-theme~=1.0.0
+    sphinx~=4.2.0
+    sphinxcontrib-katex~=0.8.6
diff --git a/setup.py b/setup.py
index aff9f7d7..893eed09 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,6 @@
 from setuptools import find_packages, setup
 from torch.utils.cpp_extension import BuildExtension, CppExtension
 
-
 # from https://github.com/facebookresearch/ClassyVision/blob/master/setup.py
 # get version string from module
 with open(
@@ -26,20 +25,6 @@
 with open("README.md", encoding="utf8") as f:
     readme = f.read()
 
-# alphabetical order
-install_requires = [
-    "compressai>=1.1.4",
-    "fvcore>=0.1.5",
-    "jax>=0.2.12",
-    "jaxlib>=0.1.65",
-    "lpips>=0.1.3",
-    "pytorchvideo>=0.1.3",
-    "torch==1.9.1",
-    "torchmetrics>=0.3.2",
-    "torchvision==0.10.1",
-    "tqdm>=4.61.0",
-]
-
 setup(
     name="neuralcompression",
     version=version,
@@ -53,7 +38,6 @@
     },
     python_requires=">=3.6",
     setup_requires=["wheel"],
-    install_requires=install_requires,
     packages=find_packages(
         exclude=[
             "tests",
@@ -70,18 +54,6 @@
         "Topic :: Scientific/Engineering :: Artificial Intelligence",
         "Topic :: System :: Archiving :: Compression",
     ],
-    extras_require={
-        "dev": [
-            "black>=21.9b0",
-            "pre-commit>=2.15.0",
-        ],
-        "docs": [
-            "pytorch_sphinx_theme @ git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme",
-            "sphinx-autodoc-typehints>=1.12.0",
-            "sphinx-copybutton>=0.3.1",
-            "sphinx>=4.2.0",
-        ],
-    },
     ext_modules=[
         CppExtension(
             "neuralcompression.ext._pmf_to_quantized_cdf",


Test patch:
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index ee087358..22de95fc 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -66,8 +66,7 @@ jobs:
         run: |
           python -m pip install --upgrade pip
           pip install --upgrade wheel
-          pip install -r dev-requirements.txt
-          pip install -e .\[dev\]
+          pip install --editable ".[dev, docs]"
       - name: Check Formatting and Lint
         run: |
           python --version
diff --git a/tests/test_complexity.py b/tests/test_complexity.py
index a42d2903..d2a555bb 100644
--- a/tests/test_complexity.py
+++ b/tests/test_complexity.py
@@ -132,7 +132,7 @@ def test_flop_count_hyperprior(
     _, _, unsupported_ops = ncF.count_flops(
         model, inputs, use_single_flop_estimates=True
     )
-    assert len(unsupported_ops) == 0
+    assert len(unsupported_ops) == 1
 
 
 def test_flop_counter_overrides():