-
Notifications
You must be signed in to change notification settings - Fork 267
MRG: refactor modules into netCDF4 package #409
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
MRG: refactor modules into netCDF4 package #409
Conversation
6b89e0a
to
b8bac6a
Compare
I'm not sure what to do about the generated C files - these seem to include the paths with which I configured the build, when I build them with Cython, and that seems like a bad idea. I'm probably not understanding something about building the C files. |
9667e0f
to
42f8f19
Compare
I think I have found that building the c files involves:
Did I miss a utility to build the default generated C file? Given the library dependencies are fairly heavy, maybe it would be reasonable to make Cython an install-time dependency? |
42f8f19
to
6ee5133
Compare
that's right, you should start with all the values 0 in constants.pyx, then setup.py will check the HDF5 API to see which features are available and set entries to 1 if they are. netCDF4.c is then generated from netCDF4.pyx by cython. If you just want to use the defauilt constants.pyx and netCDF4.c (build without any of the newer API features and don't require cython), you can set use_cython=False in the setup.cfg file. I don't think you need to remove the docstrings at the top of netCDF4.pyx. |
For the constants.pyx - my problem was I was trying to generate the C files to be committed into the repo. So I did want to use Cython (to generate the C files) but I didn't want constants.pyx to be autogenerated on my system, otherwise the C files would assume HDF5 features that might not be present on the target system - such as travis-ci. In the end I had to generate the C files on another system that I had that happened to have an HDF missing these three features. |
You probably saw, I moved the docstring from the Cython module to the |
I guess it's OK there, as long as epydoc still finds it. Unfortunately, epydoc now doesn't work - running create_docs.sh gives +------------------------------------------------------------------------------------ Why did you leave netCDF4_utiis.py? the utilities need to be modified to use netCDF4.utils instead of netCDF4_utils. Also, a Changelog entry would be nice. |
I've been meaning to move away from epydoc, since it's no longer maintained. It looks like that may have to happen in order to do this. |
@jswhit I'm pretty sure @matthew-brett left around On the other hand, we don't actually document direct use of |
Yes, I left I don't think there are any remaining uses of that module, but please correct me if I'm wrong. Could you use sphinx / autodoc for the documentation? |
If you look in |
Fine by me to remove it. The tests import some private functions, which in fact come from the utils module, and I've put these imports into the |
All of the stuff in netCDF4_utils.py is private, and is not used outside of the tests and the utilities. |
I have a workaround for the epydoc problem. |
The workaround for epydoc involves moving the docstring out of init.py and back into _netCDF4.pyx. |
OK - so am I right in thinking that
is the right way to go? |
Yes, and in addition modify the utilities (ncinfo, nc3tonc4, nc4tonc3) to import from netCDF4.utils instead of netCDF4_utils. ...and add a Changelog entry, and it should then be ready to merge. |
47fdf8c
to
fc4edb0
Compare
OK - I think I have done all that, let me know if I missed something. |
fc4edb0
to
1566346
Compare
a minor suggestion - move utils.pyx (perhaps rename to _utils.pyx) into netCDF4 directory and rename 'src' directory 'include'. Also, the create_docs.sh script needs to be changed to
|
Isn't |
Ah no - sorry - I haven't had enough coffee - and I was thinking of I think I am right in thinking that |
* Make netCDF4 a package; * Move netCDF4, netCDF4_utils into package; * Make compatibility wrapper module for netCDF4_utils; * Rebuild c files from moved pyx files.
Python build products to .gitignore [skip ci]
5bb0b26
to
eeb504f
Compare
I renamed 'src' to 'include' and added the doc build line. |
good enough - thanks! I'll go ahead and merge. After the merge, I'll move all the code from utils.pyx to _netCDF4.pyx - it seems redundant to have the code split into two directories. |
MRG: refactor modules into netCDF4 package
Move netCDF4.so and netCDF4_utils into a netCDF4 package.
Closes : #408