spacetelescope / imexam

imexam is a python tool for simple image examination, and plotting, with similar functionality to IRAF's imexamine
http://imexam.readthedocs.io
BSD 3-Clause "New" or "Revised" License
74 stars 45 forks source link

Don't run 2to3 for Python 3 #21

Closed cdeil closed 9 years ago

cdeil commented 9 years ago

As mentioned in https://github.com/astropy/package-template/pull/93 it would be nice if Astropy and all affiliated packages worked with a single Python 2 / 3 codebase.

This is usually not hard to achieve ... set use_2to3=False in setup.py and then once run 2to3 on your package and manually go through the suggested changes to see which ones make sense.

@sosey I don't know, for imexam it might be difficult to get everything to work without 2to3?

embray commented 9 years ago

There might be some strings/bytes barrier issues when dealing with xpa, but I think the barrier there is probably pretty clear and fast.

sosey commented 9 years ago

I don't think I need 2to3 for imexam, actually, I didn't realize it was set to true, and I can compile it on python3 without issue (per the other ticket where we discusse pyfits in stsci.tools I removed stsci.tools)

cdeil commented 9 years ago

@sosey There's only a few things pointed out by 2to3 imexam, I think these are the only ones you need to change:

-import connect as _connect
+from . import connect as _connect

-def gaussian2dc((y, x), amp, xo, yo, sigma, offset):
+def gaussian2dc(xxx_todo_changeme, amp, xo, yo, sigma, offset):

-def gaussian2de((y, x), amp, xo, yo, sigmax, sigmay, theta, offset):
+def gaussian2de(xxx_todo_changeme1, amp, xo, yo, sigmax, sigmay, theta, offset):

(I didn't look at the gaussian functions that currently have a tuple listed as the first argument ... I've never see this, probably you should rename to position or accept two arguments x and y?)

Then all that needs to be done is set use_2to3=False in setup.py.

sosey commented 9 years ago

ah, forgot about that math module. will fix and update later today

sosey commented 9 years ago

changes commited in ddfe956308328e3e7d76c97378b35156306bafb0

cdeil commented 9 years ago

Thanks!