source: orange/Orange/__init__.py @ 10825:6afd3857cce8

Revision 10825:6afd3857cce8, 3.9 KB checked in by mitar, 2 years ago (diff)

Updated setup.py, README and current (future) version.

Line 
1from __future__ import absolute_import
2
3__version__ = "2.6a1"
4
5ADDONS_ENTRY_POINT = 'orange.addons'
6
7from . import orange
8
9# Definitely ugly, but I see no other workaround.
10# When, e.g. data.io executes "from orange import ExampleTable"
11# orange gets imported again since it is not in sys.modules
12# before this entire file is executed
13import sys
14sys.modules["orange"] = orange
15
16import warnings
17import pkg_resources
18
19alreadyWarned = False
20disabledMsg = "Some features will be disabled due to failing modules\n"
21def _import(name):
22    global alreadyWarned
23    try:
24        __import__(name, globals(), locals(), [], -1)
25    except ImportError, err:
26        warnings.warn("%sImporting '%s' failed: %s" %
27            (disabledMsg if not alreadyWarned else "", name, err),
28            UserWarning, 2)
29        alreadyWarned = True
30
31def _import_addons():
32    globals_dict = globals()
33    for entry_point in pkg_resources.iter_entry_points(ADDONS_ENTRY_POINT):
34        try:
35            module = entry_point.load()
36            if '.' not in entry_point.name:
37                globals_dict[entry_point.name] = module
38            sys.modules['Orange.%s' % (entry_point.name,)] = module
39        except ImportError, err:
40            warnings.warn("Importing add-on '%s' failed: %s" % (entry_point.name, err), UserWarning, 2)
41
42_import("utils")
43
44_import("data")
45_import("data.io")
46_import("data.sample")
47_import("data.outliers")
48_import("data.preprocess")
49_import("data.preprocess.scaling")
50_import("data.utils")
51_import("data.discretization")
52_import("data.continuization")
53_import("data.filter")
54_import("data.imputation")
55
56_import("feature")
57_import("feature.construction")
58_import("feature.construction.functionDecomposition")
59_import("feature.construction.univariate")
60_import("feature.discretization")
61_import("feature.imputation")
62_import("feature.scoring")
63_import("feature.selection")
64
65_import("network")
66
67_import("stat")
68
69_import("statistics")
70_import("statistics.estimate")
71_import("statistics.contingency")
72_import("statistics.distribution")
73_import("statistics.basic")
74_import("statistics.evd")
75
76_import("classification")
77_import("classification.tree")
78
79_import("classification.rules")
80
81_import("classification.lookup")
82_import("classification.bayes")
83_import("classification.svm")
84_import("classification.logreg")
85_import("classification.knn")
86_import("classification.majority")
87
88_import("tuning")
89
90_import("projection")
91_import("projection.linear")
92_import("projection.mds")
93_import("projection.som")
94
95_import("ensemble")
96_import("ensemble.bagging")
97_import("ensemble.boosting")
98_import("ensemble.forest")
99_import("ensemble.stacking")
100
101_import("regression")
102_import("regression.base")
103_import("regression.earth")
104_import("regression.lasso")
105_import("regression.linear")
106_import("regression.mean")
107_import("regression.pls")
108_import("regression.tree")
109
110_import("multitarget")
111_import("multitarget.tree")
112
113_import("multilabel")
114_import("multilabel.multibase")
115_import("multilabel.br")
116_import("multilabel.lp")
117_import("multilabel.mlknn")
118_import("multilabel.brknn")
119_import("multilabel.mulan")
120
121_import("associate")
122
123_import("distance")
124
125_import("wrappers")
126
127_import("featureConstruction")
128_import("featureConstruction.univariate")
129_import("featureConstruction.functionDecomposition")
130
131_import("evaluation")
132_import("evaluation.scoring")
133_import("evaluation.testing")
134_import("evaluation.reliability")
135
136_import("clustering")
137_import("clustering.kmeans")
138_import("clustering.hierarchical")
139_import("clustering.consensus")
140
141_import("misc")
142
143_import("utils") #TODO hide utils from the user
144_import("utils.environ")
145_import("utils.counters")
146_import("utils.addons")
147_import("utils.render")
148_import("utils.serverfiles")
149
150_import_addons()
151
152try:
153    from . import version
154    # Always use short_version here (see PEP 386)
155    __version__ = version.short_version
156    __hg_revision__ = version.hg_revision
157except ImportError:
158    # Leave the default version defined at the top.
159    pass
160
161del _import
162del _import_addons
163del alreadyWarned
164del disabledMsg
Note: See TracBrowser for help on using the repository browser.