cds-astro / ipyaladin

An IPython Widget for Aladin Lite, the sky viewer.
https://cds-astro.github.io/ipyaladin/
BSD 3-Clause "New" or "Revised" License
126 stars 26 forks source link

Simplify import convention in examples #2

Closed cdeil closed 1 year ago

cdeil commented 7 years ago

Currently all of your examples use this import / naming convention:

https://github.com/cds-astro/ipyaladin/blob/master/examples/2_Base_Commands.ipynb

import ipyaladin.aladin_widget as ipyal
aladin_instance= ipyal.Aladin(...)
aladin_instance.target= 'NGC 2175'

I would suggest you change to this simpler import / naming convention everywhere:

from ipyaladin import Aladin
aladin = Aladin(...)
aladin.target = NGC 2175'

This is just simpler to remember for users because it's shorter (and it's uncommon to attach "_instance" to variable names in Python).

Note that this would be equivalent to the first example for http://jupyter.org/widgets.html at:

from ipyleaflet import Map
Map(center=[34.6252978589571, -77.34580993652344], zoom=10)

Or is there a technical problem why exposing Aladin in the top-level ipyaladin package namespace doesn't work out of the box?

tboch commented 7 years ago

@GoldReaper : could you have a look at this when you have time? I support @cdeil 's suggestion to simplify the import. Please also remove the _instance at the end of the variable in our examples.