cds-astro / cds-healpix-python

cdshealpix python package
https://cds-astro.github.io/cds-healpix-python/
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Make ipython tab complete work #1

Closed cdeil closed 3 years ago

cdeil commented 5 years ago

@bmatthieu3 - For me, tab complete on functions in cdshealpix doesn't work:

$ ipython
Python 3.6.0 | packaged by conda-forge | (default, Feb 10 2017, 07:08:35) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import cdshealpix                                                                                                                                                                        

In [2]: dir(cdshealpix)                                                                                                                                                                          
Out[2]: ['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

In [3]: cdshealpix.                

I think you have to add __all__ lists. In Astropy and many packages this is done always in the file where a public data function or class is defined, and then the * imports in various __init__ files will drag those into the package namespaces where users access them. But I'm not sure, you'll probably have to experiment a bit to make it work.

cdeil commented 5 years ago

Sorry, I had a local directory called cdshealpix in the cwd and didn't actually import cdshealpix.

This is the current status:

In [1]: import cdshealpix                                                                                                                                                                        
di
In [2]: dir(cdshealpix)                                                                                                                                                                          
Out[2]: 
['Angle',
 'SkyCoord',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 '__version__',
 'bilinear_interpolation',
 'cdshealpix',
 'cone_search',
 'elliptical_cone_search',
 'external_neighbours',
 'from_ring',
 'healpix',
 'healpix_to_lonlat',
 'healpix_to_skycoord',
 'healpix_to_xy',
 'lonlat_to_healpix',
 'lonlat_to_xy',
 'neighbours',
 'nested',
 'np',
 'polygon_search',
 'skycoord_to_healpix',
 'to_ring',
 'u',
 'utils',
 'version',
 'vertices',
 'vertices_skycoord',
 'xy_to_lonlat']

Might still be useful to define __all__ lists to have a clean package namespace and make autodoc from Sphinx easy?

fxpineau commented 3 years ago

Should be fixed in https://github.com/cds-astro/cds-healpix-python/commit/77785d43a9ef93d66a78b9d2e300f9bfce0f57fe