-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
60 lines (48 loc) · 2.04 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import sys
import warnings
from setuptools import setup
with open("README.md", encoding="utf-8") as f:
LONG_DESCRIPTION = f.read()
def likely_error():
accept_deprecated_sklearn_package_install = os.environ.get(
"SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL", "unset"
)
accept_deprecated_sklearn_package_install = (
accept_deprecated_sklearn_package_install.lower()
)
if accept_deprecated_sklearn_package_install == "true":
return
error_message = "\n".join(
[
"The 'sklearn' PyPI package is deprecated, use 'scikit-learn'",
"rather than 'sklearn' for pip commands. ",
"",
"Here is how to fix this error in the main use cases:",
"- use 'pip install scikit-learn' rather than 'pip install sklearn'",
"- replace 'sklearn' by 'scikit-learn' in your pip requirements files",
" (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)",
"- if the 'sklearn' package is used by one of your dependencies,",
" it would be great if you take some time to track which package uses",
" 'sklearn' instead of 'scikit-learn' and report it to their issue tracker",
"- as a last resort, set the environment variable",
" SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error",
"",
"More information is available at",
"https://github.com/scikit-learn/sklearn-pypi-package",
]
)
raise SystemExit(error_message)
if __name__ == "__main__":
# We allow python setup.py sdist to always work to be able to create the
# sdist and upload it to PyPI
sdist_mode = len(sys.argv) == 2 and sys.argv[1] == "sdist"
if not sdist_mode:
likely_error()
setup(
description="deprecated sklearn package, use scikit-learn instead",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
name="sklearn",
version="0.0.post12",
)