Repository navigation
Conversation
|
I know this is not ready for merging, but just wanted to confirm that this builds and the tests run on MacOS 10.6 with Python 2.7. |
|
I noticed a few absolute imports, e.g. in |
There was a problem hiding this comment.
Is there a need for this since we require minimum Python 2.6? (Minor point).
There was a problem hiding this comment.
Nope--and there are a few other things that can be taken out since we're not supporting 2.5. I've yet to clean those things out. In part because I'm holding off on a decision about what to do with the py3k-compat bits as a whole.
|
Skimmed through the general utilities and Python 3 stuff. There is some redundancy there with stuff in vo.table, less so with pywcs (which has a lot less Python code). My only comment would be to consider if it made sense to separate out the generic Python 3 compatibility stuff from the numpy-specific stuff -- but it's not a huge deal. I think it's probably easiest to tackle the cross-subproject refactoring and redundant code removal after merging this pull request. |
|
@mdboom: Agreed on worrying about refactoring more after things are merged. As for where the numpy-specific fixes go, I'm fine putting it in a separate module. Though it's still worth stressing that these are Python3-specific fixes. @astrofrog: Some of the absolute imports are intentional because I simply didn't like imports that had like four dots in them. And I figured that for tests maybe absolute imports aren't necessary since, after all, you're testing the interface rather than using it internally. I can fix it though. |
|
I've also waffled about relative vs. absolute imports in tests. I think I converted everything to relative in wcs and vo here, but there's definitely an argument to be made for using absolute in tests. Probably a minor point. This brings up one thing that also appears to be missing -- the "legacy" pyfits compatibility shim. That would be a great thing to have and test with existing code, as I think it will be important to the adoption of astropy. But again, that can be done post this pull request. |
|
I actually wouldn't be against putting in the pyfits shim in this pull request. Which brings up another question which is what to do with deprecated stuff: My plan was to go ahead and remove all deprecated code since this is sort of a "fresh" start. But it might be better to leave it in for the first n releases for the sake of adoption. Right now most of the things marked "deprecated" are just functions/methods that were given new PEP8-compliant names. However, there are some bigger changes incoming on one of my development branches... |
|
My gut feeling is to leave deprecated stuff in with DeprecationWarnings for the first release of Astropy. For the second major release we remove it. (And "import pyfits" would raise a DeprecationWarning, too, obviously). I think it might be easier to say "hey, use astropy, then you have fewer packages to install" rather than "hey, use astropy, make a bunch of changes to your code, and then you have fewer packages to install". The first hit should be free ;) |
|
I agree that leaving in deprecated stuff is reasonable. Make sure the deprecation warnings clearly state something like "future versions of astropy will remove these features". Given we have this plan of releasing a "preview" version, that one could perhaps have the compatibility stuff, and it could be removed in the later releases. Or, alternatively, allow an actual "compatibility mode" that you have to manually activate that allows old-style usage. That might be a pain though. We can figure it out later. |
|
And my feeling on the tests is that they should always be relative: I'm pretty sure that if I try to run a test with absolute imports by going into the source directory and typing I think its definitely a good idea to try to be consistent, and if the only reason is an aversion to seeing |
|
On Fri, Nov 4, 2011 at 8:47 PM, Erik Tollerud <
In most cases (certainly anything with C extensions), going into the source |
|
Right now, going into tests and running them always seems to work just fine... for example, I can run all the wcs tests by just cding to the It's not that big of a deal - more important I think is that we just agree on a consistent usage and try to stick with it so as to avoid weird, confusing bugs due to sometimes using the local and sometimes using the installed version. |
|
I've got three test failures in test_image.py using Python 2.7.1 and pytest-2.1.2 on Linux. I guess this must be known already, otherwise I can paste the errors. The output of the test session is: |
|
I'm also getting three failing tests, with Python 2.7.2 on MacOS 10.6.8. I'm going to paste the failures here for the record: |
|
This fork of astropy does not build on Python 3.2: |
|
@eteq: running "py.tests tests" in "astropy.wcs" doesn't work for me. The import fails because the C extension is not there. Is there something you're doing differently? |
|
@migueldvb @astrofrog The tests that are failing for you are ensuring that specific warning messages are being output. I need to modify the tests to just catch the warnings themselves. But this is still curious--could it be that on your systems the warnings are going to stdout instead of stderr? Or are you somehow running Python with all warnings turned off? |
|
I don't think I'm running Python with warnings turned off (or at least I've never set it up that way). Let me know if you want me to run any snippet to diagnose the issue. |
|
@astrofrog Then the only other thing I can think if is that your warnings are somehow going to stdout instead. A simple test you could try, if you're inclined is: def test(capsys):
import warnings
warnings.warn('Warning')
out, err = capsys.readouterr()
capsys.close()
print
print 'out', out
print 'err', errPut that in a module and run it with py.test and see which output stream the warning went to. But either way, I need to rewrite those tests to capture the warnings instead of relying on the text being in stdout/err. |
|
FWIW -- |
|
I have run that test with py.test with the following session log: ========================================== test session starts ========================================== test_err.py . ======================================= 1 passed in 0.01 seconds ======================================== I have installed the stock python 2.7 package from gentoo's portage tree On Mon, Nov 07, 2011 at 08:24:08AM -0800, Erik Bray wrote:
|
|
@migueldvb Sorry, I forgot to add you should run it with |
|
@iguananaut Thanks for the indication, the warning was sent to sdterr so |
|
@mdboom @iguananaut - Are you using Is there some practical reason that absolute imports are better in this case (other than aesthetics)? |
|
I always use develop mode. The fact that it makes compiled modules importable is very much an intended feature--it wouldn't be too useful without it (except for pure Python packages). I wrote the 'test' command to rebuild when necessary, I think. As for imports, I've been thinking about that and am leaning toward making them all relative. If nothing else it seems safer just to be consistent regardless of aesthetic hangups. |
…s of documentation updates in the header-refactoring branch, so I will wait until those changes are merged into trunk before doing any more here.
…s of documentation updates in the header-refactoring branch, so I will wait until those changes are merged into trunk before doing any more here.
…ent will continue here now, but the branch on PyFITS will make merges of changes from PyFITS easier I think...
…rk. Updated all imports so that it's at least possible to 'import astropy.io.fits' (though nothing works yet). Cleaned up various misc references to pyfits in documentation and such. Removed some pieces of deprecated functionality.
…ng collected (most still do not pass, however).
* Had to fix several remaining assert_* calls that weren't caught or properly
converted by the regexps I ran.
* Removed the stdout capture context manager I was using, since it didn't work
with py.test--instead used py.test's own stdout capture methods.
* There was one test ('test_io_manipulation' in test_image) where the original
test was not correctly written, and the output from PyFITS was not correctly
being compared against the expected data values. After fixing the test I
found that the values were still wrong. I don't if the test file changed
since that test was last written, or what. But the output from PyFITS was
correct (compared with cfitsio), so somehow it was the expected values that
were incorrect. Just thought that should be clarified.
…t that are no longer necessary here.
…ted 3.1). The tests will only work if you try this on top of my pull request at astropy#56 which adds 2to3 support to the setup.py test command. There are still two tests that fail for me under Python 3, but I know I've fixed that problem in PyFITS's SVN trunk, so I just need to merge that in.
…mar, wording, etc. (some of which would be worth backporting to PyFITS somehow...).
…om the fits documentation; it's still a pretty dumb replacement with references to PyFITS replaced with Astropy. Over time the documentation will morph to fit better into the overall flow of Astropy's documentation.
…hese all into a single commit for the same reason I ended up squashing all of PyFITS's previous history into a single commit: References to tickets/revisions in the commit messages that are irrelevant in the context of the git repository. To view the individual commits see the master branch on the PyFITS git repository. It will probably be doing a few more of these merges before PyFITS gets merged fully into Astropy.
Merge branch 'fits-squashed' of github.com:iguananaut/astropy into fits-squashed Conflicts: astropy/sphinx/conf.py astropy/tests/helper.py astropy/tests/tests/run_after_2to3.py astropy/tests/tests/test_run_tests.py docs/index.rst setup.py
This came from cherry-picking from the iguananaut/astropy/fits branch. I keep meaning to delete that branch and continue all pyfits->astropy merge work in this branch alone. I'm going to go ahead and delete the other fits branch so that I stop getting confused. This branch does not contain pyfits' entire SVN history, but it was already decided to omit that when merging into Astropy, so there's no point in keeping such a branch around. PyFITS' past history can be found through the PyFITS repository itself. Conflicts: astropy/io/fits/card.py astropy/io/fits/column.py astropy/io/fits/core.py astropy/io/fits/file.py astropy/io/fits/hdu/base.py astropy/io/fits/hdu/hdulist.py astropy/io/fits/hdu/image.py astropy/io/fits/hdu/nonstandard.py astropy/io/fits/hdu/streaming.py astropy/io/fits/hdu/table.py astropy/io/fits/header.py astropy/io/fits/tests/test_core.py astropy/io/fits/tests/test_division.py astropy/io/fits/tests/test_hdulist.py astropy/io/fits/tests/test_header.py astropy/io/fits/tests/test_image.py astropy/io/fits/tests/test_table.py Conflicts: astropy/io/fits/__init__.py astropy/io/fits/card.py astropy/io/fits/hdu/compressed.py astropy/io/fits/hdu/table.py astropy/io/fits/header.py astropy/io/fits/tests/test_core.py astropy/io/fits/tests/test_header.py astropy/io/fits/util.py docs/fits/users_guide/users_reference.rst docs/fits/users_guide/users_tutorial.rst docs/fits/users_guide/users_verification.rst
|
I'm closing this pull request, in part because I renamed the branch that it's based on, and I don't think GitHub liked that. At this point astropy.io.fits is a bit closer to merging too, so I think a new discussion/review is in order soon. Unless someone beats me to it, the new pull request will be #102. |
Fix minor string repr issue...
Fix remaining astropy test
This branch isn't quite ready for merging, for a number of reasons. But since it will happen eventually I figured I would open the pull request. Now is a good time to do so since this branch has astropy.io.fits fully functioning, at least in that all the tests run/pass.
To give some background on this pull request, this branch is based off of a different branch (https://github.com/iguananaut/astropy/tree/fits) which contains the entire history from PyFITS's SVN repository. However, for inclusion into Astropy all the previous SVN history (up to the last revision merged into Astropy from PyFITS which was r1202) was squashed into a single commit, and rebased on top of Astropy's master. I then applied my additional changes from the fits that get astropy.io.fits fully functioning on top of that. Sorry if that makes no sense--if anyone's really interested I can try drawing a graph of what happened.
Some things I need to do before this is merged:
And some other open questions that need discussing: