Repository: ExoCTK/exoctk (language: python)

Issue:
Installation issues when installing from setup.py on python 3.8
Following up after my conv. w/ @hover2pi and @jaymedina and related to https://github.com/ExoCTK/exoctk/issues/387

When installing exoctk into a fresh conda environment from setup.py I noticed a few minor issues, hopefully can be fixed up by: https://github.com/ExoCTK/exoctk/issues/464

Here are the two issues I noticed:

- setup.py does not specify a version of astropy, so it installs the latest. However, I've found that the `jwst_gtvt` package pinned in the setup.py file conflicts with newer versions of astropy. The last working version of astropy w/ `jwst_gtvt` is 4.0.4. Solution might be to update jwst_gtvt (no idea if newer versions work with newer versions of astropy) or pinning astropy to `<4.1`. Ideally `jwst_gtvt` would indicate which version of astropy it worked with so then the dependency resolver would take care of the rest...
- `jwst_gtvt` doesn't get installed automatically unless it's put into the `install_requires` section of the setup.py.  This I believe was a change to pip in version 19.0: https://pip.pypa.io/en/stable/news/#id449 you can add it to the requires section directly now:
`'jwst_gtvt @ git+https://github.com/spacetelescope/jwst_gtvt.git@cd6bc76f66f478eafbcc71834d3e735c73e03ed5'`

Really happy I don't have to create the data directories or env. variables anymore, thanks!
Add support and environment files for Python v3.8 and v3.9
Currently only Python v3.6 and v3.7 are supported. Add `yaml` files to `env` directory and new tests to Travis.


Discussion / hints:

Awesome! Would also be nice to have updated versions on pypi.org supporting these Python versions: https://pypi.org/project/exoctk/

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index ef6440fe..7ca58bea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,8 @@ before_cache:
   - rm -rf $HOME/miniconda3/pkgs/cache
   - rm -rf $HOME/miniconda3/envs/exoctk-3.6
   - rm -rf $HOME/miniconda3/envs/exoctk-3.7
+  - rm -rf $HOME/miniconda3/envs/exoctk-3.8
+  - rm -rf $HOME/miniconda3/envs/exoctk-3.9
 
 os:
   - linux
@@ -18,6 +20,8 @@ os:
 env:
   - PYTHON_VERSION="3.6"
   - PYTHON_VERSION="3.7"
+  - PYTHON_VERSION="3.8"
+  - PYTHON_VERSION="3.9"
 
 before_install:
   - export PATH="$HOME/miniconda3/bin:$PATH"
diff --git a/ci/install_conda.sh b/ci/install_conda.sh
index d402e115..e6e16b5d 100755
--- a/ci/install_conda.sh
+++ b/ci/install_conda.sh
@@ -23,10 +23,4 @@ conda config --set always_yes true --set changeps1 false || exit 1
 echo "Updating Miniconda"
 conda update conda
 conda update --all
-conda info -a || exit 1
-
-echo "Installing numpy"
-conda install numpy
-pip install Flask
-pip install sphinx
-pip install python-dateutil==2.8.0
\ No newline at end of file
+conda info -a || exit 1
\ No newline at end of file
diff --git a/ci/setup_conda_env.sh b/ci/setup_conda_env.sh
index a7c08990..4cbd2e1d 100755
--- a/ci/setup_conda_env.sh
+++ b/ci/setup_conda_env.sh
@@ -1,5 +1,12 @@
 #!/bin/bash
-echo "Creating conda environment for Python $PYTHON_VERSION"
-conda env create -f "env/environment-${PYTHON_VERSION}.yml" || exit 1
+echo "Creating base conda environment for Python $PYTHON_VERSION"
+conda create --yes --prefix /home/travis/envs python=$PYTHON_VERSION
+conda activate /home/travis/envs
+
+echo "Creating ExoCTK conda environment for Python $PYTHON_VERSION"
+conda env update -f "env/environment-${PYTHON_VERSION}.yml" || exit 1
 export CONDA_ENV=exoctk-$PYTHON_VERSION
-source activate $CONDA_ENV
\ No newline at end of file
+source activate $CONDA_ENV
+
+echo "The installed environment:"
+conda env export
\ No newline at end of file
diff --git a/env/environment-3.6.yml b/env/environment-3.6.yml
index cac508dd..686e9df4 100644
--- a/env/environment-3.6.yml
+++ b/env/environment-3.6.yml
@@ -20,6 +20,7 @@ dependencies:
   - numpydoc=1.1.0
   - pandas=1.1.3
   - paramiko=2.7.2
+  - pip=20.3.3
   - pytest=6.2.2
   - python=3.6.7
   - pyyaml
diff --git a/env/environment-3.7.yml b/env/environment-3.7.yml
index a84696ba..d4704603 100644
--- a/env/environment-3.7.yml
+++ b/env/environment-3.7.yml
@@ -3,7 +3,7 @@ channels:
   - defaults
   - http://ssb.stsci.edu/astroconda
 dependencies:
-  - astropy=4.0.2
+  - astropy<4.1
   - bokeh=2.2.3
   - boto3
   - cython=0.29.17
@@ -20,6 +20,7 @@ dependencies:
   - numpydoc=1.1.0
   - pandas=1.2.0
   - paramiko=2.7.2
+  - pip=20.3.3
   - pytest=6.2.2
   - python=3.7.1
   - pyyaml
diff --git a/env/environment-3.8.yml b/env/environment-3.8.yml
new file mode 100644
index 00000000..c3315e4b
--- /dev/null
+++ b/env/environment-3.8.yml
@@ -0,0 +1,48 @@
+name: exoctk-3.8
+channels:
+  - defaults
+  - http://ssb.stsci.edu/astroconda
+dependencies:
+  - astropy<4.1
+  - bokeh=2.2.3
+  - boto3
+  - cython=0.29.21
+  - docopt=0.6.2
+  - docutils=0.16
+  - flake8=3.8.4
+  - flask=1.1.2
+  - gunicorn=20.0.4
+  - h5py=2.10.0
+  - ipython=7.20.0
+  - jupyter=1.0.0
+  - matplotlib=3.3.4
+  - numpy=1.19.2
+  - numpydoc=1.1.0
+  - pandas=1.2.1
+  - paramiko=2.7.2
+  - pip=20.3.3
+  - pytest=6.2.2
+  - python=3.8.5
+  - pyyaml
+  - scipy=1.6.0
+  - scp=0.13.3
+  - sphinx=3.4.3
+  - sqlalchemy=1.3.23
+  - wtforms=2.3.3
+  - pip:
+    - asteval==0.9.22
+    - astroquery==0.4.1
+    - awscli
+    - bandit==1.7.0
+    - batman-package==2.4.7
+    - bibtexparser==1.2.0
+    - corner==2.1.0
+    - flask_wtf==0.14.3
+    - lmfit==1.0.2
+    - platon==5.1.2
+    - pysiaf==0.10.0
+    - pysynphot==1.0.0
+    - sphinx_astropy==1.3
+    - svo-filters==0.2.16
+    - werkzeug==0.16.1
+    - git+https://github.com/spacetelescope/jwst_gtvt.git@cd6bc76f66f478eafbcc71834d3e735c73e03ed5
\ No newline at end of file
diff --git a/env/environment-3.9.yml b/env/environment-3.9.yml
new file mode 100644
index 00000000..f3d72bdc
--- /dev/null
+++ b/env/environment-3.9.yml
@@ -0,0 +1,48 @@
+name: exoctk-3.9
+channels:
+  - defaults
+  - http://ssb.stsci.edu/astroconda
+dependencies:
+  - astropy=4.2
+  - bokeh=2.2.3
+  - boto3
+  - cython=0.29.21
+  - docopt=0.6.2
+  - flake8=3.8.4
+  - flask=1.1.2
+  - h5py=2.10.0
+  - ipython=7.20.0
+  - jupyter=1.0.0
+  - matplotlib=3.3.4
+  - numpy=1.19.2
+  - numpydoc=1.1.0
+  - pandas=1.2.2
+  - paramiko=2.7.2
+  - pip=20.3.3
+  - pytest=6.2.2
+  - python=3.9.1
+  - pyyaml
+  - scipy=1.6.0
+  - scp=0.13.3
+  - sphinx=3.4.3
+  - sqlalchemy=1.3.23
+  - wtforms=2.3.3
+  - pip:
+    - asteval==0.9.22
+    - astroquery==0.4.1
+    - awscli
+    - bandit==1.7.0
+    - batman-package==2.4.7
+    - bibtexparser==1.2.0
+    - corner==2.1.0
+    - docutils==0.15.2
+    - flask_wtf==0.14.3
+    - gunicorn==20.0.4
+    - lmfit==1.0.2
+    - platon==5.1.2
+    - pysiaf==0.10.0
+    - pysynphot==1.0.0
+    - sphinx_astropy==1.3
+    - svo-filters==0.2.16
+    - werkzeug==0.16.1
+    - git+https://github.com/spacetelescope/jwst_gtvt.git@cd6bc76f66f478eafbcc71834d3e735c73e03ed5
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 8a3d89ad..6a0e2929 100755
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 from setuptools import setup, find_packages
 
 REQUIRES = ['asteval',
-            'astropy',
+            'astropy<4.1',
             'astroquery',
             'bandit',
             'bibtexparser',
@@ -37,10 +37,8 @@
             'sqlalchemy',
             'svo_filters',
             'wtforms',
-            'werkzeug==0.16.1']
-
-DEPENDENCY_LINKS = [
-    'git+https://github.com/spacetelescope/jwst_gtvt.git@cd6bc76f66f478eafbcc71834d3e735c73e03ed5']
+            'werkzeug==0.16.1',
+            'jwst_gtvt @ git+https://github.com/spacetelescope/jwst_gtvt.git@cd6bc76f66f478eafbcc71834d3e735c73e03ed5']
 
 FILES = []
 for root, _, files in os.walk("exoctk"):
@@ -57,7 +55,6 @@
     package_data={
         'exoctk': FILES},
     install_requires=REQUIRES,
-    dependency_links=DEPENDENCY_LINKS,
     author='The ExoCTK Group',
     author_email='exoctk@gmail.com',
     license='MIT',


Test patch:
diff --git a/exoctk/tests/test_visibilityPA.py b/exoctk/tests/test_visibilityPA.py
index 6ea059a1..d5bb72d0 100644
--- a/exoctk/tests/test_visibilityPA.py
+++ b/exoctk/tests/test_visibilityPA.py
@@ -1,6 +1,11 @@
+import sys
+
+import pytest
+
 from exoctk.contam_visibility import visibilityPA
 
 
+@pytest.mark.skipif(sys.version_info > (3, 9), reason='jwst_gtvt does not currently support python>=3.9.')
 def test_using_gtvt():
     instrument = 'NIRISS'