Repository: yt-project/yt

Issue:
Add requirements.txt
We should define environments for testing (py2, py3) and docs building at least. How about:
* requirements.txt (for common deps)
* requirements-test-py2.txt
* requirements-test-py3.txt
* requirements-docs.txt


Discussion:
-1 on a top-level requirements.txt file. We used to have one, it went out of date, and people got confused and used it anyway. I’m +1 with having test-specific requirements files in the `tests` directory though.
I like the idea of a `requirements.txt` file simply because it gets seen by lots of other tools, and would increase our ability to be deployed with those tools.  Perhaps this is not really a big deal and I'm overthinking it, but it seems like this could be a reasonably straightforward thing to do and keep up to date.
yt is a library though, `requirements.txt` files are for apps. What would it help to have one that's not encoded in yt's `install_requires` in the setup.py?

I definitely agree with kacper that having a requirements file for the tests would be useful, as that's a specific deployment of yt for testing purposes and is more like setting up an app where having a requirements file with a explicitly listed exact set of dependencies makes sense.
https://github.com/yt-project/yt/pull/1844 is definitely an example that this should be fixed sooner, rather than later.
A PR adding a test requirements file that the jenkins host uses to install dependencies from would be accepted pretty quickly I think :)

Resolving patch:
diff --git a/yt/visualization/plot_modifications.py b/yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -486,7 +486,7 @@ def __init__(self, field, ncont=5, factor=4, clim=None,
                  label_args=None, text_args=None, data_source=None):
         PlotCallback.__init__(self)
         def_plot_args = {'colors':'k'}
-        def_text_args = {'color':'w'}
+        def_text_args = {'colors':'w'}
         self.ncont = ncont
         self.field = field
         self.factor = factor


Test patch:
diff --git a/doc/source/developing/testing.rst b/doc/source/developing/testing.rst
--- a/doc/source/developing/testing.rst
+++ b/doc/source/developing/testing.rst
@@ -70,6 +70,24 @@ run:
 
    $ nosetests yt/visualization/tests/test_plotwindow.py
 
+Handling yt dependencies
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+We attempt to make yt compatible with a wide variety of downstream software versions. However, sometimes a specific version of a project that yt depends on causes some breakage and must be blacklisted in the tests or a more experimental project that yt depends on optionally might change sufficiently that the yt community decides not to support an old version of that project.
+
+To handle cases like this, the versions of downstream software projects installed on the machines running the yt test suite are pinned to specific version numbers that must be updated manually. This prevents breaking the yt tests when a new version of a downstream dependency is released and allows us to manage updates in downstream projects at our pace.
+
+If you would like to add a new dependency for yt (even an optional dependency)
+or would like to update a version of a yt depdendency, you must edit the
+``tests/test_requirements.txt`` file, this path is relative to the root of the
+repository. This file contains an enumerated list of direct depdnencies and
+pinned version numbers. For new dependencies, simply append the name of the new
+depdendency to the end of the file, along with a pin to the latest version
+number of the package. To update a package's version, simply update the version
+number in the entry for that package.
+
+Finally, we also run a set of tests with "minimal" dependencies installed. Please make sure any new tests you add that depend on an optional dependency are properly set up so that the test is not run if the dependency is not installed. If for some reason you need to update the listing of packages that are installed for the "minimal" dependency tests, you will need to edit ``tests/test_minimal_requirements.txt``.
+
 How to Write Unit Tests
 ^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -183,121 +201,23 @@ How to Run the Answer Tests
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The very first step is to make a directory and copy over the data against which
-you want to test.  Currently, we test:
-
-NMSU ART
-~~~~~~~~
-
-* ``D9p_500/10MpcBox_HartGal_csf_a0.500.d``
-
-ARTIO
-~~~~~
-
-* ``sizmbhloz-clref04SNth-rs9_a0.9011/sizmbhloz-clref04SNth-rs9_a0.9011.art``
-
-Athena
-~~~~~~
-
-* ``ShockCloud/id0/Cloud.0050.vtk``
-* ``MHDBlast/id0/Blast.0100.vtk``
-* ``RamPressureStripping/id0/rps.0062.vtk``
-* ``MHDSloshing/virgo_low_res.0054.vtk``
-
-Boxlib
-~~~~~~
-
-* ``RadAdvect/plt00000``
-* ``RadTube/plt00500``
-* ``StarParticles/plrd01000``
-
-Chombo
-~~~~~~
-
-* ``TurbBoxLowRes/data.0005.3d.hdf5``
-* ``GaussianCloud/data.0077.3d.hdf5``
-* ``IsothermalSphere/data.0000.3d.hdf5``
-* ``ZeldovichPancake/plt32.2d.hdf5``
-* ``KelvinHelmholtz/data.0004.hdf5``
-
-Enzo
-~~~~
-
-* ``DD0010/moving7_0010`` (available in ``tests/`` in the yt distribution)
-* ``IsolatedGalaxy/galaxy0030/galaxy0030``
-* ``enzo_tiny_cosmology/DD0046/DD0046``
-* ``enzo_cosmology_pluts/DD0046/DD0046``
-
-FITS
-~~~~
-
-* ``radio_fits/grs-50-cube.fits``
-* ``UnigridData/velocity_field_20.fits``
-
-FLASH
-~~~~~
-
-* ``WindTunnel/windtunnel_4lev_hdf5_plt_cnt_0030``
-* ``GasSloshingLowRes/sloshing_low_res_hdf5_plt_cnt_0300``
-
-Gadget
-~~~~~~
-
-* ``IsothermalCollapse/snap_505``
-* ``IsothermalCollapse/snap_505.hdf5``
-* ``GadgetDiskGalaxy/snapshot_200.hdf5``
-
-GAMER
-~~~~~~
-
-* ``InteractingJets/jet_000002``
-* ``WaveDarkMatter/psiDM_000020``
-* ``Plummer/plummer_000000``
-
-Halo Catalog
-~~~~~~~~~~~~
-
-* ``owls_fof_halos/groups_001/group_001.0.hdf5``
-* ``owls_fof_halos/groups_008/group_008.0.hdf5``
-* ``gadget_fof_halos/groups_005/fof_subhalo_tab_005.0.hdf5``
-* ``gadget_fof_halos/groups_042/fof_subhalo_tab_042.0.hdf5``
-* ``rockstar_halos/halos_0.0.bin``
-
-MOAB
-~~~~
-
-* ``c5/c5.h5m``
-
-
-RAMSES
-~~~~~~
-
-* ``output_00080/info_00080.txt``
-
-Tipsy
-~~~~~
-
-* ``halo1e11_run1.00400/halo1e11_run1.00400``
-* ``agora_1e11.00400/agora_1e11.00400``
-* ``TipsyGalaxy/galaxy.00300``
-
-OWLS
-~~~~
-
-* ``snapshot_033/snap_033.0.hdf5``
-
-These datasets are available at http://yt-project.org/data/.
-
-Next, add the config parameter ``test_data_dir`` pointing to 
+you want to test. Next, add the config parameter ``test_data_dir`` pointing to
 directory with the test data you want to test with, e.g.:
 
-.. code-block:: none
+.. code-block:: bash
 
    $ yt config set yt test_data_dir /Users/tomservo/src/yt-data
 
-More data will be added over time.  To run the answer tests, you must first
-generate a set of test answers locally on a "known good" revision, then update
-to the revision you want to test, and run the tests again using the locally
-stored answers.
+We use a number of real-world datasets for the tests that must be downloaded and
+unzipped in the ``test_data_dir`` path you have set. The test datasets, can be
+downloaded from http://yt-project.org/data/. We do not explicitly list the
+datasets we use in the tests here because the list of necessary datasets changes
+regularly, instead you should take a look at the tests you would like to run and
+make sure that the necessary data files are downloaded before running the tests.
+
+To run the answer tests, you must first generate a set of test answers locally
+on a "known good" revision, then update to the revision you want to test, and
+run the tests again using the locally stored answers.
 
 Let's focus on running the answer tests for a single frontend. It's possible to
 run the answer tests for **all** the frontends, but due to the large number of
diff --git a/tests/lint_requirements.txt b/tests/lint_requirements.txt
new file mode 100644
--- /dev/null
+++ b/tests/lint_requirements.txt
@@ -0,0 +1,4 @@
+flake8==3.6.0
+mccabe==0.6.1
+pycodestyle==2.4.0
+pyflakes==2.0.0
\ No newline at end of file
diff --git a/tests/test_minimal_requirements.txt b/tests/test_minimal_requirements.txt
new file mode 100644
--- /dev/null
+++ b/tests/test_minimal_requirements.txt
@@ -0,0 +1,10 @@
+cython==0.24
+ipython==1.0.0
+matplotlib==1.5.3
+numpy==1.10.4
+sympy==1.0
+nose==1.3.7
+nose-timer==0.7.3
+coverage==4.5.1
+codecov==2.0.15
+mock==2.0.0; python_version < '3.0'
diff --git a/tests/test_requirements.txt b/tests/test_requirements.txt
new file mode 100644
--- /dev/null
+++ b/tests/test_requirements.txt
@@ -0,0 +1,25 @@
+astropy==3.0.5; python_version >= '3.0'
+astropy==2.0.9; python_version < '3.0'
+codecov==2.0.15
+coverage==4.5.1
+cython==0.29
+fastcache==1.0.2
+glueviz==0.13.3; python_version >= '3.0'
+h5py==2.8.0
+ipython==7.1.1; python_version >= '3.0'
+ipython==5.8.0; python_version < '3.0'
+matplotlib==3.0.1; python_version >= '3.0'
+matplotlib==2.2.3; python_version < '3.0'
+mock==2.0.0; python_version < '3.0'
+nose-timer==0.7.3
+nose==1.3.7
+numpy==1.15.3
+pandas==0.23.4
+requests==2.20.0
+scipy==1.1.0
+sympy==1.3
+pyqt5==5.11.3; python_version >= '3.0'
+thingking==1.0.2; python_version < '3.0'
+pint==0.8.1
+netCDF4==1.4.2
+libconf==1.0.1
\ No newline at end of file
diff --git a/tests/tests.yaml b/tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -47,7 +47,7 @@ answer_tests:
   local_owls_002:
     - yt/frontends/owls/tests/test_outputs.py
 
-  local_pw_024:
+  local_pw_025:
     - yt/visualization/tests/test_plotwindow.py:test_attributes
     - yt/visualization/tests/test_plotwindow.py:test_attributes_wt
     - yt/visualization/tests/test_particle_plot.py:test_particle_projection_answers