[AstroPy] Coding Guidelines draft (comments encouraged)

Michael Droettboom mdroe at stsci.edu
Mon Jul 11 12:05:38 EDT 2011

With regard to: "C extensions will be allowed only when the provide a 
significant performance enhancement over pure python. When C extensions 
are used, the python interface must meet interface guidelines, and the 
use of Cython is strongly recommended."

In the case of something like pywcs, a C extension is used because the 
WCS standard is so difficult to implement that it was easier to use 
existing and well-tested code.  It's not clear whether there was a 
performance advantage over a Numpy-based implementation (I'm not taking 
a position either way, I'm saying that such an experiment was never 
done, and performance was not a motivating factor.)  There are a lot of 
good reasons beyond performance to use non-Python extension code, so I 
don't know if we should artificially limit ourselves here.

With respect to: "Packages can include data in [path tbd] as long as it 
is less than about 100 kb. These data should be accessed via the 
astropy.config.[funcname tbd] mechanism. If the data exceeds this size, 
it should be hosted outside the source code repository and downloaded 
using the astropy.config.[funcname tbd] mechanism."

I worry that there are often version dependencies between the code and 
the data.  (Matplotlib has a dependency on specific versions of the STIX 
math fonts, for example).  Having the data in a separate code repository 
makes keeping this synchronized trickier.  I would instead say: large 
data required for functioning of the library goes in the repository, but 
under a special directory that is not distributed as part of the binary 
distribution.  The mechanism for accessing this data when needed should 
be aware of the source code revision and download the corresponding 
revision of the data.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20110711/e71a55d9/attachment.html>

More information about the AstroPy mailing list