Skip to content

Make externals private? #11182

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

Closed
amueller opened this issue Jun 1, 2018 · 7 comments
Closed

Make externals private? #11182

amueller opened this issue Jun 1, 2018 · 7 comments

Comments

@amueller
Copy link
Member

amueller commented Jun 1, 2018

I think we should make externals private to make it easier to stop vendoring things. I don't think users should use the joblib that comes with sklearn.
I don't think externals should have ever been public, but in particular in light of #11166 and #11115 I think now is a good time to deprecate the public version. Otherwise we might end up having to provide backports for 2.7 when we don't support it any more...

@adrinjalali
Copy link
Member

I was just wondering: what should be done for the cases where the docs refer to the externals, such as when we talk about model persistence? #12171 reminded me of this.

Should there be public methods in sklearn somewhere, which use then _externals for the case we want to expose some public functionality like model persistence using joblib?

@jnothman
Copy link
Member

jnothman commented Sep 26, 2018 via email

@rth
Copy link
Member

rth commented Jan 5, 2019

I agree with the idea of making externals private, but we tried to rename joblib to _joblib and failed (see e.g. #11408 (comment)). The same applies to moving externals to _externals. I'm not saying that's not possible, maybe it's easier with Py3 only, but it would probably involve messing with the import mechanism: i.e. making,

from sklearn.externals.some_module import something

work (with a deprecation warning) without sklearn/externals/some_module.py existing on the file system, after it was moved to sklearn/_externals/
This can result in other unexpected issues and I don't think it's worth it.

In practice, arff and pilutils are already put in private modules within externals so what remains is joblib and six, both of which are going to be removed. Having a sklearn.externals that only contains private modules would be a bit equivalent in the end.

The question is how to remove joblib and six,

  • for six it was proposed in API Deprecate externals.six #12916 (cc @qinhanmin2014 ) let's move that discussion there.
  • for joblib, once we stop using the vendored version, putting a deprecation warning in joblib.__init__, making sure it's not collected by pytest and waiting for a few versions before removal could be enough?

@jnothman
Copy link
Member

jnothman commented Jan 7, 2019 via email

@rth
Copy link
Member

rth commented Jun 21, 2019

I think this was mostly solved. joblib is removed, and most other modules except for six are private,

ls sklearn/externals/
README  __init__.py  __pycache__  _arff.py  _pilutil.py  conftest.py  joblib  setup.py  six.py

we could rename the externals folder in a few versions as well (for now the only blocker is that sklearn.externals.joblib alias needs to exist to avoid breaking pickles).

@amueller
Copy link
Member Author

@rth I'm happy to close this, what do you think?

@rth
Copy link
Member

rth commented Jul 30, 2019

Sounds good.

@rth rth closed this as completed Jul 30, 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

No branches or pull requests

4 participants