Skip to content

[MRG] Replace absolute imports with relative ones#13653

Merged
NicolasHug merged 9 commits intoscikit-learn:masterfrom
aditya1702:fix-absolute-imports
Apr 17, 2019
Merged

[MRG] Replace absolute imports with relative ones#13653
NicolasHug merged 9 commits intoscikit-learn:masterfrom
aditya1702:fix-absolute-imports

Conversation

@aditya1702
Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #13629

What does this implement/fix? Explain your changes.

Replaces absolute imports with relative imports

Any other comments?

@aditya1702 aditya1702 changed the title [MRG] Replace absolute imports with relative ones [WIP] Replace absolute imports with relative ones Apr 16, 2019
@aditya1702
Copy link
Copy Markdown
Contributor Author

I will squash commits once this passes

@adrinjalali
Copy link
Copy Markdown
Member

you don't need to squash commits, and it's nice if you would avoid a force push. We squash the commits before merge anyway.

@jnothman
Copy link
Copy Markdown
Member

Tests are failing @aditya1702. let us know if you need help.

Copy link
Copy Markdown
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful with the diff. You should not change in docstrings for example

NotFittedError('This LinearSVC instance is not fitted yet'...)

.. versionchanged:: 0.18
Moved from sklearn.utils.validation.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert


.. versionchanged:: 0.18
Moved from sklearn.base.
Moved from .base.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert

@aditya1702
Copy link
Copy Markdown
Contributor Author

you don't need to squash commits, and it's nice if you would avoid a force push. We squash the commits before merge anyway.

@adrinjalali Got it. I dont force push commits :)

# Note: BSD sed -i needs an argument unders OSX
# so first renaming to .bak and then deleting backup files
find joblib -name "*.py" | xargs sed -i.bak "s/from joblib/from sklearn.externals.joblib/"
find joblib -name "*.py" | xargs sed -i.bak "s/from joblib/from .joblib/"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to revert I think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be okay, and despite @NicolasHug's comment, the changes in sklearn/externals/joblib are consistent with this


try:
from sklearn.externals.joblib.externals.cloudpickle import dumps, loads
from ..cloudpickle import dumps, loads
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure about these ones here @ogrisel @tomMoral

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anything joblib related can be ignored since we're unvendoring #13531

Note that 'sag' and 'saga' fast convergence is only guaranteed on
features with approximately the same scale. You can
preprocess the data with a scaler from sklearn.preprocessing.
.preprocess the data with a scaler from sklearn.preprocessing.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

Note that 'sag' and 'saga' fast convergence is only guaranteed on
features with approximately the same scale. You can preprocess the data
with a scaler from sklearn.preprocessing.
with a scaler from ..preprocessing.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

if not isinstance(cv, Iterable) or isinstance(cv, str):
raise ValueError("Expected cv as an integer, cross-validation "
"object (from sklearn.model_selection) "
"object (from .) "
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

sklearn/setup.py Outdated
import os

from sklearn._build_utils import maybe_cythonize_extensions
from _build_utils import maybe_cythonize_extensions
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

Additional tests for classifiers, regressors, clustering or transformers
will be run if the Estimator class inherits from the corresponding mixin
from sklearn.base.
from ..base.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

@aditya1702 aditya1702 changed the title [WIP] Replace absolute imports with relative ones [MRG] Replace absolute imports with relative ones Apr 17, 2019
@aditya1702
Copy link
Copy Markdown
Contributor Author

cc @agramfort @jnothman @NicolasHug

@NicolasHug
Copy link
Copy Markdown
Member

That looks good for the most part, but please revert the changes related to sklearn.external.joblib. Sorry, I should have pointed that earlier in the issue. You should be able to do this simply with

git checkout master -- sklearn/externals/joblib

(also please merge master to sort out the merge conflict with sklearn/metrics/cluster/bicluster.py)

# Note: BSD sed -i needs an argument unders OSX
# so first renaming to .bak and then deleting backup files
find joblib -name "*.py" | xargs sed -i.bak "s/from joblib/from sklearn.externals.joblib/"
find joblib -name "*.py" | xargs sed -i.bak "s/from joblib/from .joblib/"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be okay, and despite @NicolasHug's comment, the changes in sklearn/externals/joblib are consistent with this

@aditya1702
Copy link
Copy Markdown
Contributor Author

@NicolasHug Resolved the conflicts

@NicolasHug NicolasHug merged commit 301076e into scikit-learn:master Apr 17, 2019
@NicolasHug
Copy link
Copy Markdown
Member

Thanks @aditya1702 !

jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Apr 25, 2019
@aditya1702 aditya1702 deleted the fix-absolute-imports branch April 25, 2019 18:03
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove absolute imports

5 participants