-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
BLD lazy import of tempita to avoid cython dependency #15313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
916c6ce
47b2dea
31a58ed
a36a37d
4ad3d74
65060e0
1f6f612
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import os | ||
|
||
import numpy | ||
|
||
from sklearn._build_utils import gen_from_templates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. out of curiosity, can you explain me why an absolute import is required here ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't work if we use a relative import? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, they also did it for the deprecated modules in sklearn/setup.py |
||
|
||
|
||
def configuration(parent_package='', top_path=None): | ||
from numpy.distutils.misc_util import Configuration | ||
|
||
|
@@ -22,19 +24,8 @@ def configuration(parent_package='', top_path=None): | |
libraries=libraries) | ||
|
||
# generate sag_fast from template | ||
sag_cython_file = 'sklearn/linear_model/_sag_fast.pyx.tp' | ||
sag_file = sag_cython_file.replace('.tp', '') | ||
|
||
if not (os.path.exists(sag_file) and | ||
os.stat(sag_cython_file).st_mtime < os.stat(sag_file).st_mtime): | ||
|
||
with open(sag_cython_file, "r") as f: | ||
tmpl = f.read() | ||
from Cython import Tempita # noqa | ||
tmpl_ = Tempita.sub(tmpl) | ||
|
||
with open(sag_file, "w") as f: | ||
f.write(tmpl_) | ||
templates = ['sklearn/linear_model/_sag_fast.pyx.tp'] | ||
gen_from_templates(templates, top_path) | ||
|
||
config.add_extension('_sag_fast', | ||
sources=['_sag_fast.pyx'], | ||
|
Uh oh!
There was an error while loading. Please reload this page.