Skip to content

Test against python 3.7-dev - #264

Closed
namurphy wants to merge 16 commits into
PlasmaPy:masterfrom
namurphy:python-dev-test
Closed

namurphy wants to merge 16 commits into
PlasmaPy:masterfrom
namurphy:python-dev-test

Conversation

@namurphy

Copy link
Copy Markdown
Member

Python 3.7 is now in beta, and is likely to be released around this summer. We should make sure our 0.1.0 release works with the most recent development version of Python 3.7 since our 0.2.0 release will probably not occur until a few months after the Python 3.7 release. This pull request adds a line in .travis.yml to test against Python 3.7-dev.

@namurphy namurphy added this to the v0.1 milestone Feb 14, 2018
@namurphy namurphy changed the title Test against python 3.7-dev in Travis CI Test against python 3.7-dev Feb 14, 2018
@namurphy

Copy link
Copy Markdown
Member Author

I'm getting an error for Travis CI that says:

We couldn't find the repository PlasmaPy/PlasmaPy

so there may be a problem with Travis CI at the moment. In a while we should trigger another Travis CI build so that this issue will hopefully get resolved.

The instructions on the Travis CI webpage to use "3.7-dev" as the
Python version hasn't worked out.  I'm not sure how to go about
testing against Python 3.7-dev, so in the meantime I added a few lines
for possibilities.
@lemmatum

Copy link
Copy Markdown
Contributor

I think your first try was correct (Here's the Travis from that one) as Travis does find Python 3.7-dev:

$ python --version
Python 3.7.0a4+

But then astropy's ci-helpers fails because it tries to fetch python3.7-dev from conda and ends up installing Python3.6.3:

$ source ci-helpers/travis/setup_conda.sh
==================== Starting executing ci-helpers scripts =====================
--2018-02-14 17:15:31--  https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.continuum.io (repo.continuum.io)... 104.16.19.10, 104.16.18.10, 2400:cb00:2048:1::6810:120a, ...
Connecting to repo.continuum.io (repo.continuum.io)|104.16.19.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 57669415 (55M) [application/x-sh]
Saving to: ‘miniconda.sh’
100%[======================================>] 57,669,415   213MB/s   in 0.3s   
2018-02-14 17:15:31 (213 MB/s) - ‘miniconda.sh’ saved [57669415/57669415]
PREFIX=/home/travis/miniconda
installing: python-3.6.3-h6c0c0dc_5 ...
Python 3.6.3 :: Anaconda, Inc.

Further down

installation finished.
Package plan for installation in environment /home/travis/miniconda:
The following packages will be DOWNGRADED:
    conda: 4.3.31-py36_0 --> 4.3.27-py36h2866c0b_0
PackageNotFoundError: Packages missing in current channels:
            
  - python 3.7-dev*
We have searched for the packages in the following channels:
            
  - https://repo.continuum.io/pkgs/main/linux-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/linux-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/linux-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/linux-64
  - https://repo.continuum.io/pkgs/pro/noarch

So I would revert this back to 3.7-dev and then start playing with this line: - source ci-helpers/travis/setup_conda.sh.

There may some flag or something you can throw at ci-helpers to force it to use the already installed python3.7 rather than fetching it via conda. I think conda only has stable builds of cpython.

@lemmatum

Copy link
Copy Markdown
Contributor

One hacky idea might be to add a line before source ci-helpers/travis/setup_conda.sh which makes python 3.7-dev an alias of whatever gets returned from $ python --version

@lemmatum

lemmatum commented Feb 15, 2018 •

Copy link
Copy Markdown
Contributor

Digging into ci-helpers, I think this line is the culprit

if [[ -z $PYTHON_VERSION ]]; then
    PYTHON_VERSION=$TRAVIS_PYTHON_VERSION
fi

So if no $PYTHON_VERSION is declared it then defaults to whatever we passed to Travis, which is 3.7-dev and then anaconda can't find that because that is not the actual name of the python version we just installed, it's just an alias that Travis uses.

I'm going to add some lines to travis.yml to test for this. If this is indeed the problem then we can add a line which does something like

if [[ -z $PYTHON_VERSION ]]; then
    # fetches python --version output
    version="$(python --version 2>&1)"
    echo "Current version is $version"
    # binds output of python --version to PYTHON_VERSION
    PYTHON_VERSION="$version"
    echo "PYTHON_VERSION is now $PYTHON_VERSION"
fi

This would be placed before source ci-helpers/travis/setup_conda.sh

Hack to get around `source ci-helpers/travis/setup_conda.sh` not finding correct version of Python when `3.7-dev` is installed via Travis.
Attempting to fix ci-helpers getting wrong version of Python when working with `3.7-dev`.
This hack binds the `3.7-dev` version of Python to `$PYTHON_VERSION` which is searched for by ci-helpers.
@lemmatum

Copy link
Copy Markdown
Contributor

Any idea what this rake business is all about?
The command "rake" exited with 1.

@lemmatum

Copy link
Copy Markdown
Contributor

Looks like the last commit which didn't have this rake error was fb857af, I think...
https://travis-ci.org/PlasmaPy/PlasmaPy/builds/341539086

I think using the wrong kind of white space is causing the rake error
I am ROOT!
@lemmatum

Copy link
Copy Markdown
Contributor

Looks like my hacky bash script isn't working... it doesn't even echo the python version back to Travis. Or is that just suppressed because it is stdout instead of stderr?

@lemmatum

Copy link
Copy Markdown
Contributor

Progress! The script seems to sort of work, although it needs to be parsed out to just give the version numbers with no spaces

PackageNotFoundError: Packages missing in current channels:
            
  - python Python*

Had an error where the whole string from `python --version` output was being bound to the environment variable (e.g., "Python 3.6.3") whereas we just want the number.
@lemmatum

Copy link
Copy Markdown
Contributor

So version number now gets correctly passed using the hack script, and 3.6 tests are building again, but conda doesn't like 3.7. Does anyone know of a way to force conda to fall back on the system installed version of python?

Setting DEBUG flag to find out where in `setup_conda.sh` the installation fails.
@lemmatum

lemmatum commented Feb 16, 2018 •

Copy link
Copy Markdown
Contributor

We are now indeed failing here where conda tries to conda create -n test python=3.7.0a4+ and then throws CondaValueError: invalid package specification: python=3.7.0a4+.

Python 3.7-dev is definitely in Travis's PATH, but it is behind miniconda's version of python
++++PATH=/home/travis/miniconda/bin:/home/travis/virtualenv/python3.7-dev/bin:

Maybe we can force conda to use the 3.7-dev version by rearranging PATH and symlinks, like so?

EDIT: we might be able to leverage $CONDA_ENVIRONMENT to hack our way around setting up the virtualenv.

@lemmatum

lemmatum commented Feb 16, 2018 •

Copy link
Copy Markdown
Contributor

TODO:

  • Check why we are using ci-helpers in the first place
  • Setup a .sh script or a line in travis.yml which checks whether $TRAVIS_PYTHON_VERSION has dev in its name. If it does then avoid ci-helpers when setting up the virtualenv, if it doesn't then run ci-helpers as usual.

@namurphy

Copy link
Copy Markdown
Member Author

I wonder if we can figure out how to test against astropy-dev as well, which we tried to figure out how to do in #172.

@Cadair

Cadair commented Feb 17, 2018

Copy link
Copy Markdown
Contributor

for astropy-dev with ci-helpers you can just do ASTROPY_VERSION='dev'?!

@namurphy namurphy added the status: on hold Issues & PRs that are being intentionally delayed label Mar 3, 2018
@lemmatum

Copy link
Copy Markdown
Contributor

@Cadair Does that also test against python 3.7 (or whatever current dev version of Python is) or does it just test the dev version of astropy?

@namurphy

namurphy commented Apr 6, 2018

Copy link
Copy Markdown
Member Author

I'm closing this because figuring out a way to test against the development version of Python 3.7 is probably not worth the effort since it's going to be released in ~2-3 months anyway.

@namurphy namurphy closed this Apr 6, 2018
@namurphy namurphy mentioned this pull request May 3, 2018
@namurphy namurphy removed Availability status: on hold Issues & PRs that are being intentionally delayed labels Jul 23, 2018
@namurphy
namurphy deleted the python-dev-test branch October 4, 2018 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants