-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Generate ERFA wrappers (with modifications to astropy-helpers) #3166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I don't really think this is necessary or desirable, though I admit I haven't taken a close look at the issues this is trying to resolve. My suspicion is that the machinery to accomplish what this is doing already exists and that this is mostly superfluous. I'm still hoping to refactor the setup too, so anything that involves adding more stuff that has to be called explicitly in setup.py will only make that work more complicated. |
|
@embray - well, this involves very little added machinery and indeed uses much of what is present. Please do open another PR if you have ideas of a different approach. This was just intended to stimulate discussion :) |
|
See #3170 which implements an alternative that requires no changes to |
db89440 to
ea5fcb4
Compare
|
@mdboom @embray @eteq @mhvk @taldcroft - I think this is the cleanest solution. No hacks involved. The only downside is that it requires small additions to astropy-helpers. Bonus: this enables preprocessing in any other subpackage of astropy (note, if we want to go ahead with this, I'll open a PR on the astropy-helpers repository - also, we can make this work properly with sdist by also calling the preprocessing when sdist is run) And Travis passes! \o/ |
|
@astrofrog - I cannot really just this well, but will say that compared to most parts of the |
|
👍 from me, given the dead end that #3170 turned out to be. |
|
Give me a chance to do this a little more generally in the form of pre-/post-command hooks supported via astropy-helpers, and then this would be fine as a pre-build_ext hook. If we can do it that way then I'd feel less locked in in terms of API. |
|
@embray - ok, sounds good! I like the idea of generalized pre-/post-command hooks! |
|
Not really related to this PR since it was already there, but this should not be here. If these files should be included in the source tarball they should just be added to the |
|
👍 from me too. @embray and @astrofrog - what are you thinking the timescale is for getting this in astropy_helpers? If it's soon, we should do this before #3173, but if it might take some time, perhaps merging #3173 now and building this from that makes sense? (#3173 does change the derived files, but not a huge amount, and it does a lot of renaming that conflicts with this. So it may be less work overall to merge it if you're already going to have to re-do this in |
|
@embray - as described in astropy/astropy-helpers#110, I can't use the latest astropy-helpers with astropy core (try it out to see what I mean). |
|
@astrofrog - note #3206. Does that do the trick? |
37646a7 to
8651c61
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once concern about this, is that since this also generates an extension module maybe it should also be a pre_build_ext_hook. The generation can just be moved to a separate function that is called by the hook points. Since it checks for whether the generated files already exist and need to be updated, it should still only do anything one time when calling ./setup.py build if I understand correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct, sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
8651c61 to
1193130
Compare
|
@eteq - I addressed your comment regarding sdist by:
I also added a mention of jinja2 to the building from source section in the docs. |
|
👍 from me! (assuming tests pass) I checked this both on its own and merged with my coordinate branch that uses a lot of erfa stuff for coordinate transforms, and both work just fine. So should be good to go! Am I right in assuming you're deferring the |
|
Oh, wait, one other thing, @astrofrog : I suggest you add a mention of the |
|
@eteq - I did the change for |
|
@embray - can you give this one more look to make sure I'm doing the hook stuff right? |
|
Mostly unrelated to this PR other than the note added to the changelog, but I'm 👎 on the requirement for Jinja2, on the basis that these templates are simple enough that they could be generated without it. But I don't have the time to submit a change to that effect right now, so if I'm the only complaintant don't worry about it for now, I guess? Unless someone else would like to make the change... |
|
@embray - I'm pretty sure it would be a lot of work to remove the jinja2 requirement - a large chunk of this would have to be thrown out and re-written. So I don't think that would be a productive use of anyone's time for v1.0, and we should merge this as-is. In the future, I think removing it would probably be less flexible for potential future improvements. After all, that was the point of using an already-existing template language. And jinja2 is necessary for sphinx, so I think it's not that much of a burden to expect devs to have it. So even in future versions I'm probably 👎 on replacing jinja2 with something we roll on our own. But I could be convinced if you (or someone else) re-writes these in a way that's at least equally clear and flexible for future changes. |
|
In any case, this build is passing (see https://travis-ci.org/astropy/astropy/builds/44260180, but the status isn't updating here, maybe due to the last [ci skip] commit) so feel free to merge this! (then we can move ahead with the other ERFA PRs) |
|
Alright, in the intereset of moving stuff along, I will merge this now. @embray, feel free to create an issue to remove the |
Generate ERFA wrappers (with modifications to astropy-helpers)
|
great! I'll start rebasing some of the other |
|
I concur with @mhvk that removing the jinja2 dependence is a very low priority: it's already a devel requirement due to the docs. And it's a known, rational templating system... |
|
There's travis-ci fails because Can someone please fix this? |
|
@cdeil - good point, we should add |
|
@astrofrog - I've added |
|
@cdeil - that's right, so probably the template should be updated, too. |
|
Oh, but if they're using a released version of astropy, it should be fine after 1.0 (because the generated files are generated with the tarballs) |
|
Just ran into this after a travis failure on sncosmo (testing against astropy dev version). Might want to announce it to the mail list for other affiliated package devs. |
|
Could we just add Jinja2 to setup_requires? I don't see why not, if we put Numpy there :) |
Because code-based discussions are better than code-less discussions! 😄
This is definitely WIP, but a proof-of-concept of the idea of adding a
preprocess_sourcefunction tosetup_package.py. Of course, we don't want all the stdout cluttering, we also may not want to always generate the output if it is up-to-date, etc. But I just thought this would be a good starting point to discuss how we could proceed.This also doesn't do anything (yet) about @mdboom's suggestion of generating only things that require Cython or Jinja for tarballs.
The changes in astropy-helpers are: https://github.com/astrofrog/astropy-helpers/compare/preprocess
cc @embray @mdboom @taldcroft @eteq @jwoillez @mhvk