Closed GoogleCodeExporter closed 9 years ago
should we keep the packages and have imports be required:
import pysal.weights
versus having from pysal import *
work?
i think packages is cleaner and less error prone. before we finalize the import
scheme we should decide on
packages or?
Original comment by sjsrey
on 31 May 2010 at 7:54
The attached GraphViz files show the dependancy structure within PySAL. The
structure seems overly complicated and trying to simplify the import structure
for a 1.0 release doesn't seem very realistic at this point.
As this relates to maintainability let make sure this get high-priority for 1.1.
Original comment by schmi...@gmail.com
on 31 Jul 2010 at 4:08
Attachments:
PySAL NameSpace Cleanup.
Version 1.0:
['Box_Plot', 'DistanceBand', 'Equal_Interval', 'Fisher_Jenks', 'Geary',
'Jenks_Caspall', 'Jenks_Caspall_Forced', 'Jenks_Caspall_Sampled',
'Join_Counts', 'KDTree', 'K_classifiers', 'Kernel', 'LISA_Markov', 'Markov',
'Max_P_Classifier', 'Maximum_Breaks', 'Maxp', 'Maxp_LISA', 'Moran', 'Moran_BV',
'Moran_BV_matrix', 'Moran_Local', 'Natural_Breaks', 'Percentiles', 'Quantiles',
'ROD', 'SpatialTau', 'Spatial_Markov', 'Std_Mean', 'Theil', 'TheilD',
'TheilDSim', 'Theta', 'User_Defined', 'W', '__all__', '__builtins__',
'__doc__', '__file__', '__name__', '__package__', '__path__',
'adaptive_kernelW', 'adaptive_kernelW_from_shapefile', 'bin', 'bin1d', 'binC',
'buildContiguity', 'cdist', 'cg', 'comb', 'common', 'copy', 'core',
'directional', 'distance_matrix', 'ergodic', 'esda', 'full', 'gadf', 'get_ids',
'get_points_array_from_shapefile', 'higher_order', 'inequality', 'kernelW',
'kernelW_from_shapefile', 'knnW', 'knnW_from_array', 'knnW_from_shapefile',
'la', 'lag_spatial', 'lat2W', 'math', 'min_threshold_dist_from_shapefile',
'min_threshold_distance', 'np', 'open', 'order', 'os', 'pdist', 'pysal',
'quantile', 'queen_from_shapefile', 'random', 'regime_weights', 'region',
'remap_ids', 'rook_from_shapefile', 'shimbel', 'sp', 'spatial_dynamics',
'stats', 'sys', 'threshold_binaryW_from_array',
'threshold_binaryW_from_shapefile', 'threshold_continuousW_from_array',
'threshold_continuousW_from_shapefile', 'time', 'unittest', 'version',
'w_difference', 'w_intersection', 'w_subset', 'w_symmetric_difference',
'w_union', 'weights']
Removed "from common import*"
['Box_Plot', 'DistanceBand', 'Equal_Interval', 'Fisher_Jenks', 'Geary',
'Jenks_Caspall', 'Jenks_Caspall_Forced', 'Jenks_Caspall_Sampled',
'Join_Counts', 'K_classifiers', 'Kernel', 'LISA_Markov', 'Markov',
'Max_P_Classifier', 'Maximum_Breaks', 'Maxp', 'Maxp_LISA', 'Moran', 'Moran_BV',
'Moran_BV_matrix', 'Moran_Local', 'Natural_Breaks', 'Percentiles', 'Quantiles',
'SpatialTau', 'Spatial_Markov', 'Std_Mean', 'Theil', 'TheilD', 'TheilDSim',
'Theta', 'User_Defined', 'W', '__all__', '__builtins__', '__doc__', '__file__',
'__name__', '__package__', '__path__', 'adaptive_kernelW',
'adaptive_kernelW_from_shapefile', 'bin', 'bin1d', 'binC', 'buildContiguity',
'cg', 'comb', 'common', 'core', 'directional', 'ergodic', 'esda', 'full',
'gadf', 'get_ids', 'get_points_array_from_shapefile', 'higher_order',
'inequality', 'kernelW', 'kernelW_from_shapefile', 'knnW', 'knnW_from_array',
'knnW_from_shapefile', 'lag_spatial', 'lat2W',
'min_threshold_dist_from_shapefile', 'min_threshold_distance', 'np', 'open',
'order', 'os', 'pysal', 'quantile', 'queen_from_shapefile', 'regime_weights',
'region', 'remap_ids', 'rook_from_shapefile', 'shimbel', 'spatial_dynamics',
'threshold_binaryW_from_array', 'threshold_binaryW_from_shapefile',
'threshold_continuousW_from_array', 'threshold_continuousW_from_shapefile',
'version', 'w_difference', 'w_intersection', 'w_subset',
'w_symmetric_difference', 'w_union', 'weights']
Added __all__ to weights.user,
['Box_Plot', 'DistanceBand', 'Equal_Interval', 'Fisher_Jenks', 'Geary',
'Jenks_Caspall', 'Jenks_Caspall_Forced', 'Jenks_Caspall_Sampled',
'Join_Counts', 'K_classifiers', 'Kernel', 'LISA_Markov', 'Markov',
'Max_P_Classifier', 'Maximum_Breaks', 'Maxp', 'Maxp_LISA', 'Moran', 'Moran_BV',
'Moran_BV_matrix', 'Moran_Local', 'Natural_Breaks', 'Percentiles', 'Quantiles',
'SpatialTau', 'Spatial_Markov', 'Std_Mean', 'Theil', 'TheilD', 'TheilDSim',
'Theta', 'User_Defined', 'W', '__all__', '__builtins__', '__doc__', '__file__',
'__name__', '__package__', '__path__', 'adaptive_kernelW',
'adaptive_kernelW_from_shapefile', 'bin', 'bin1d', 'binC', 'buildContiguity',
'cg', 'comb', 'common', 'core', 'directional', 'ergodic', 'esda', 'full',
'gadf', 'higher_order', 'inequality', 'kernelW', 'kernelW_from_shapefile',
'knnW', 'knnW_from_array', 'knnW_from_shapefile', 'lag_spatial', 'lat2W',
'min_threshold_dist_from_shapefile', 'open', 'order', 'quantile',
'queen_from_shapefile', 'regime_weights', 'region', 'remap_ids',
'rook_from_shapefile', 'shimbel', 'spatial_dynamics',
'threshold_binaryW_from_array', 'threshold_binaryW_from_shapefile',
'threshold_continuousW_from_array', 'threshold_continuousW_from_shapefile',
'version', 'w_difference', 'w_intersection', 'w_subset',
'w_symmetric_difference', 'w_union', 'weights']
Original comment by schmi...@gmail.com
on 7 Jan 2011 at 9:15
define __all__ in all modules.
module.__all__ = ['X','Y','Z']
move "code" from module/__init__.py to module/module.py
__init__.py should include from module import *
Original comment by schmi...@gmail.com
on 7 Jan 2011 at 9:16
i opened this back up as i'm not sure the final changes to the toplevel
pysal.__init__ file were made. It looks like we still have explicit imports in
there and not the scheme from module import *
do we keep the explicit imports (i.e., from Markov import Spatial_Markov)?
Original comment by sjsrey
on 18 Jan 2011 at 3:24
The "from module import *" scheme is only for sub-packages. The top level
__init__.py needs to remain explicit.
This allows us to maintain the 2 level structure where pysal.X is a flat
sub-package of pysal. In the long run the pysal namespace should contain only
the half dozen or so sub-packages and optionally objects that at common to all
sub-packages.
Original comment by schmi...@gmail.com
on 18 Jan 2011 at 7:30
Pysal's top level __init__.py will keep explicit imports.
I think this issue is resolved. tests.py is reporting all modules that still
need work. Re-open if this issues needs more clarification.
Original comment by schmi...@gmail.com
on 19 Jan 2011 at 7:27
Original issue reported on code.google.com by
schmi...@gmail.com
on 14 May 2010 at 9:56