Repository navigation
VO - #46
VO#46
Conversation
|
It looks like |
|
Yes, indeed. I was foiled by the "*.c" in .gitignore again ;) |
|
Ok, I get further, but I cannot build this branch on MacOS 10.6 with Python 2.7: |
|
@astrofrog: Sorry. Again, it was a missing file. I just tested with a fresh clone and it seems to be working now, and passing all tests. |
|
It installs fine now and all tests run successfully. |
|
The documentation has some mentions of the networking capability (e.g. |
|
Minor: on the main documentation page, the headings for the WCS and VO stuff aren't consistent ( |
|
Good catch. Yes. I think we should just remove those for now. |
|
Will fix the documentation headers to match wcs. I wasn't planning on including history -- after all the moves etc. it's not clear it would be directly useful. The SVN history will live on indefinitely as a resource in a bind. |
|
About the included expat: I didn't entirely understand your last comment there - you're saying we don't want to let the user build against the system expat... is this just for the performance reasons? I think we should still allow the system expat (or even the python builtin expat) to be used if the user desires, as long as we make it clear that it will be slower. I can certainly imagine systems where something goes wrong with the astropy expat builds, but the user says "screw it, I'm fine with a 15% slowdown because I don't want to bother figuring out how to compile astropy." Is there any reason why these can't be left as options? (For now, feel free to just put it in as a constant or something in |
|
Oh, also, just so we're clear, the cextern expat is only statically linked to iterparser, right? So an expat library file is never actually generated? |
There was a problem hiding this comment.
I wonder if these are "data" in the sense we've been discussing in other contexts... they are data that is necessary for the source code to work, rather than data needed to do specific things in the source code (that is, they are more like code constants than, say, spectroscopic line lists or something). So should the XML-related "data" not be in the data-storing scheme that I'm working on in the config package?
There was a problem hiding this comment.
ucd1p-words.txt is necessary to parse any VOTABLE 1.2 file. The other two are necessary only if one wishes to perform validation.
So yes, some of this could be moved to the new scheme once it's available.
There was a problem hiding this comment.
Ok, we can discuss it then. My thought is actually that these should not be data because validation is still nominally part of the code, rather than ancillary data that the code uses. But this is a rather blurry area...
There was a problem hiding this comment.
@eteq: I see what you're saying. I'm certainly open to reorganization. Here I mean data to mean "anything that isn't importable". You're right, though: it's not science data or anything of that sort.
|
I should have been more clear about the expat. Expat has a number of #defines that change how it is built, and different Linux distros build in different ways. The one that matters here is whether it returns utf-8 or ucs4 to the caller. To handle the system expat, we'd have to handle and test both cases, and also do extra work if it is built for utf-8. That's where the 15% comes in. vo.table also has a fallback to pure Python standard library for the XML parsing, but that is about 3x slower. So, IMO, it's preferable to build our own expat -- it's very simple to build -- and use that. And we have a pure Python fallback which could be selected using our forthcoming build configuration system in case building expat as part of astropy is a problem for some users (it seems very unlikely as it's very portable C code). To answer your question -- no standalone expat library is built, it simply builds the 4 required C files as part of the iterparse extension. |
|
Ah, that all makes sense re: expat. It's a bit annoying that we have to include it, but I see you point for why it's useful. We definitely want the option of a fallback to the python builtin version, but we can deal with that later (as you say). |
|
@eteq: Just to clarify -- the pure Python fallback already exists and is tested as part of the unit tests. The only thing missing is an option for a user to choose not to build the C extension. |
There was a problem hiding this comment.
What is this _build_mode being used for? Is it only for places where you're trying to import stuff at build-time? If so, it's safer (and more consistent with the other packages) to use try/except and catch ImportErrors.
There was a problem hiding this comment.
It's used in io/vo/__init__.py. It can not import anything under Python 3 in io.vo until 2to3 has been run on it. I'm worried about a blanket except ImportError: pass because that will hide any legitimate errors. I think this approach is more specific as to when we want to avoid importing.
There was a problem hiding this comment.
Well, something like python setup.py test will think it's in build mode, now, right? That's definitely not the correct behavior. I see your point about acidentally hiding ImportErrors, but in this case, the only way that could happen is if you didn't have the vo.exceptions module, right? Or were you planning on adding more sutuff to the vo __init__.py?
@iguananaut, do you have any thoughts on this matter, given that I think you wrote something like this in one of the other setup scripts? Is there a flag already built-in to distutils or distribute that we can use here?
There was a problem hiding this comment.
The ImportError could be triggered by any error that happens at import time inside of exceptions.py or anything it includes. (This is the problem with ImportError -- it's a real blunt tool and can't be used to determine if a module can not be found or has an error -- and if there is an error, it becomes silently hidden).
setup.py test runs the tests in a separate process, so it doesn't inherit the __builtins__ from the parent. It has to do this because the build first imports things with C extensions missing, yet ignores that to complete the build, and then needs to get at those C extensions.
@iguananaut pointed out on the mailing list that Numpy uses a similar approach to this.
There was a problem hiding this comment.
Hmm... I see your point here as a general problem.
One other thing to keep in mind, here, though: In the vision and at the meeting I thought we all agreed that importing should always work, even if actually doing anything with what you import might fail. So perhaps we want the blunt instrument here, because we want import astropy.io.vo to always work, even if import astropy.io.vo import parse or something like that fails. This isn't quite as relevant as in some other cases because the compilation is unnecessary if it falls back to the builtin expat, but we do want to leave the option open of having astropy be installed even when some of the compiled modules are not available.
@astrofrog, do you have any thoughts on this? I think we want to try to be consistent on this - either using the if is_in_build_mode() everywhere, or a except ImportError everywhere that we would otherwise use is_in_build_mode...
There was a problem hiding this comment.
Interesting...I was just playing around with a hack similar to this for pyfits. In my version it adds __ASTROPY_SETUP__ to builtins, a la numpy.
The tests aren't a problem because setup.py test runs the tests in a separate process, so __ASTROPY_SETUP__ won't be defined when the tests are run.
There was a problem hiding this comment.
I meant to add: In addition to __ASTROPY_SETUP__ I want to figure out if there's a way I can set a global variable that's only True if 2to3 has been run on the current code. That would allow even more flexibility: It would only prevent code from being imported if it's being run in Python 3 and is not Python 3-compatible. I just haven't looked into how that could be done yet.
|
I couldn't get github to show me all of the diffs, I think because this pull request has so many files in it. So the stuff above is inline comments that github isn't showing you the context for. |
|
One other thing: when I run the tests on this, it modifies the file |
|
Good catch about |
|
Does anyone know a way to make the diff's visible? I want to be able to look at the diffs for some of the files at the end of the list, but they're all hidden (I think because the page would be too big, otherwise) |
|
Yeah -- it's annoying. You can of course look at the diff offline, but then there's no code review ;) I could take expat out of here for now, but then we'll have a branch that doesn't actually "work". |
There was a problem hiding this comment.
This seems to import a lot of stuff like sys and os that clutters up the namespace. maybe implement an _all__ = ... in exceptions.py?
Also, I think it might be good to do from .table import parse,parse_single_table so that the user doesn't have to figure out what module they're looking for in the most-common use case.
…ow in the main docstring on astropy.io.vo.exceptions and pulled into the Sphinx build using automodule.
|
@eteq: I think this latest set of commits addresses everything you raised. |
|
So is this good to go? I don't see anything else that needs changes that can't be post-merge - @astrofrom and @iguananaut? Oh, and @mdboom - when it does get merged, can you create issues for the things we mentioned as "todo after merge"? Thanks. |
|
@eteq: it seems fine to me (disclaimer: I haven't checked it all line by line). |
|
Yeah, I think it's the sort of thing where it's going to be best to go ahead and get things merged in order to start tweaking them more. In particular we need to work on centralizing some of the Py3K hacks. |
|
Ok. Merging now... Will add some issues for various TODO list items as @eteq suggests. |
Allow for selecting the pkg-config executable
Remove ZBLANK logic from data property since this is handled at a lower level
Fixes Issue astropy#46 Adds WCSAxes to the affiliated package repo
This is an initial import of vo.table into astropy as astropy.io.vo.
This includes only the VOTABLE file format handling code. The VO networking (conesearch, ssa, image search etc.) stuff is still kind of half-baked and not ready -- that will live on a branch on my fork for a while.
There are some things left to do, but they are perhaps best left for after merging:
Some points: