Skip to content

WIP: Python 3.5 support - #4027

Merged
embray merged 15 commits into
astropy:masterfrom
mdboom:python-3.5
Sep 16, 2015
Merged

embray merged 15 commits into
astropy:masterfrom
mdboom:python-3.5

Conversation

@mdboom

@mdboom mdboom commented Jul 31, 2015

Copy link
Copy Markdown
Contributor

There were two classes of issues:

  1. re.sub now cares about the replacement string looking reasonable in terms of escape characters, and we were doing %Y to \d\d\d\d etc. (and it doesn't like the \d). It turns out that where we were using it, str.replace works just as well.

  2. inspect.getargspec now raises a DeprecationWarning. I made a little wrapper around it that doesn't do that, but long term, we should look at all of the call sites that use it to make sure that the logic makes sense in the face of non-positional-keyword arguments (a Python 3.x feature). My fix here essentially papering that over, which allows our tests to pass since we don't use that Python 3.x feature anywhere, but it could bite us in the future.

Also, this required upgrading pytest to git master. I think we should put this PR on ice until there is a py.test release made that's officially Python 3.5 compatible.

@mdboom mdboom added this to the Future milestone Jul 31, 2015
@mdboom mdboom added the build label Jul 31, 2015
@mdboom

mdboom commented Jul 31, 2015

Copy link
Copy Markdown
Contributor Author

Oh -- and I forgot we're using Conda here. We'll also need to wait until Conda has a Python 3.5 channel (or write a dependency script based on pyenv...)

@astrofrog

Copy link
Copy Markdown
Member

@mdboom - for the deprecation warning, could we also not just filter that here?

https://github.com/astropy/astropy/blob/master/astropy/tests/helper.py#L440

We are already doing it for some other warnings.

@mdboom

mdboom commented Aug 3, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog: This PR adds such a filter. However, it's not sufficient because the (a) warning is emitted on import before the filter even has a chance, and (b) it still spams the user during normal operation (which is different from the other warnings we filter for). Also, in this case it does indicate a real shortcoming in our code -- mainly that some features aren't compatible with keyword-only-arguments, so, long term at least, we should fix all the call sites.

@embray

embray commented Aug 3, 2015

Copy link
Copy Markdown
Member

Regarding getargspec, we already include a backport of inspect.signature. The getargspec wrapper can be done away with, and code that uses inspect.getargspec can instead use from astropy.utils.compat.funcsigs import signature (and related utilities).

@mdboom

mdboom commented Aug 3, 2015

Copy link
Copy Markdown
Contributor Author

Ah -- I didn't know about the backport of signature. That seems like the way to go.

@embray

embray commented Aug 3, 2015

Copy link
Copy Markdown
Member

Yes, it's a much nicer interface. Admittedly, more work to change over to in all the relevant places.

@mdboom

mdboom commented Aug 6, 2015

Copy link
Copy Markdown
Contributor Author

This has been updated to use signature in place of getargspec.

I think we should still wait on py.test here before merging this -- don't know when they plan to release a Python 3.5-compatible version. Maybe after 3.5 is released.

@embray

embray commented Aug 6, 2015

Copy link
Copy Markdown
Member

I just ran py.tests's test suit (from its latest trunk) on Python 3.5b4 and it passed, so presumably their next release will be Python 3.5-compatible if it isn't already.

@mdboom

mdboom commented Aug 6, 2015

Copy link
Copy Markdown
Contributor Author

This PR updates py.test to the latest git master as well (which is why it works at all)... I just think we should wait for a py.test release and not vendor an unreleased version.

@embray embray mentioned this pull request Sep 14, 2015
@mdboom
mdboom force-pushed the python-3.5 branch 2 times, most recently from 5933f17 to 9049a1f Compare September 14, 2015 18:49
@mdboom

mdboom commented Sep 14, 2015

Copy link
Copy Markdown
Contributor Author

I've removed the py.test upgrade from this PR -- this should then pass on Travis for everything but Python 3.5 (if all goes well).

@astrofrog

Copy link
Copy Markdown
Member

What about adding 3.5 to the allowed failures for now on Travis, but merge (if it passes otherwise) so that the fixes we know are needed are at least in master?

@mdboom

mdboom commented Sep 14, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog: I was thinking of something like that. Still working out the last kinks and then will make the appropriate action on Travis.

@embray

embray commented Sep 14, 2015

Copy link
Copy Markdown
Member

Thanks @mdboom for prioritizing this!

@embray embray modified the milestones: v1.0.5, Future Sep 14, 2015
@embray

embray commented Sep 14, 2015

Copy link
Copy Markdown
Member

I want to include this in v1.0.5. The backport probably won't be completely clean, but I'll take care of that.

@embray

embray commented Sep 14, 2015

Copy link
Copy Markdown
Member

Once this is ready please also add a note about Python 3.5 support in the changes for 1.0.5.

Comment thread .travis.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to add this to the allow_failures line below (in addition to here)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah -- I just wanted to test it first, because the failures on 3.5 have been spurious, and I was hoping I could knock them out altogether.

@mdboom

mdboom commented Sep 14, 2015

Copy link
Copy Markdown
Contributor Author

In the end, I've marked Python 3.5 as an allowed failure -- the failures there are nondeterministic, but do seem related to py.test itself and not us.

@mdboom

mdboom commented Sep 15, 2015

Copy link
Copy Markdown
Contributor Author

This seems to be passing now -- though 3.5 is still an "allowed failure". We'll still need py.test to catch up for that one, I think.

@mdboom

mdboom commented Sep 15, 2015

Copy link
Copy Markdown
Contributor Author

py.test 2.7.3 (with Python 3.5 support) was just announced minutes ago. I'm going to test this with that and see how it goes.

@mdboom

mdboom commented Sep 15, 2015

Copy link
Copy Markdown
Contributor Author

I think the AppVeyor failure here is a network timeout (probably unrelated to this change).

Other than that, I think this is good to go. Official fully-working Python 3.5 support!

@embray

embray commented Sep 15, 2015

Copy link
Copy Markdown
Member

fingers crossed Once this passes I'll try to get v1.0.5 out.

@mdboom

mdboom commented Sep 16, 2015

Copy link
Copy Markdown
Contributor Author

This seems to be good to go.

@embray

embray commented Sep 16, 2015

Copy link
Copy Markdown
Member

👍

Comment thread CHANGES.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have crept in from #4147 somehow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@embray

embray commented Sep 16, 2015

Copy link
Copy Markdown
Member

Thanks in particular for updating all the argument parsing stuff--that looks like it was a pain.

embray added a commit that referenced this pull request Sep 16, 2015
@embray
embray merged commit c9eb861 into astropy:master Sep 16, 2015
@astrofrog

Copy link
Copy Markdown
Member

Thanks @mdboom! \o/

embray added a commit that referenced this pull request Sep 18, 2015
WIP: Python 3.5 support
Conflicts:
	.travis.yml
	astropy/cosmology/core.py
	astropy/modeling/core.py
	astropy/modeling/utils.py
	astropy/stats/bayesian_blocks.py
	astropy/time/formats.py
	astropy/utils/tests/test_decorators.py
	astropy/visualization/hist.py
embray added a commit that referenced this pull request Sep 23, 2015
WIP: Python 3.5 support
Conflicts:
	.travis.yml
	astropy/cosmology/core.py
	astropy/modeling/core.py
	astropy/modeling/utils.py
	astropy/stats/bayesian_blocks.py
	astropy/time/formats.py
	astropy/utils/tests/test_decorators.py
	astropy/visualization/hist.py
embray added a commit that referenced this pull request Sep 28, 2015
WIP: Python 3.5 support
Conflicts:
	.travis.yml
	astropy/cosmology/core.py
	astropy/modeling/core.py
	astropy/modeling/utils.py
	astropy/stats/bayesian_blocks.py
	astropy/time/formats.py
	astropy/utils/tests/test_decorators.py
	astropy/visualization/hist.py
@astrofrog astrofrog mentioned this pull request Sep 29, 2015
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