Skip to content

Commit 6caf752

Browse files
committed
Tweak wording in error message and rearrange README
1 parent f609c70 commit 6caf752

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Goal
22

3-
This repo implements brownout for the deprecated `sklearn` package on PyPI.
3+
This repo implements the brownout for deprecating the `sklearn` package on PyPI.
4+
5+
# How to fix the error for the main use cases
6+
7+
- use `pip install scikit-learn` rather than `pip install sklearn`
8+
- replace `sklearn` by `scikit-learn` in your pip requirements files
9+
(`requirements.txt`, `setup.py,` `setup.cfg`, `Pipfile`, etc ...)
10+
- if the `sklearn` package is used by one of your dependencies
11+
it would be great if you take some time to track which package uses
12+
`sklearn` instead of `scikit-learn` and report it to their issue tracker
13+
- as last resort, set the environment variable ,
14+
`SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True` to avoid this error
415

516
# Brownout schedule
617

@@ -17,16 +28,20 @@ raised if you attempt to install the `sklearn` package from PyPI.
1728
| 2023 October 1st - November 30th | :00-:20 and :00-50 every hour |
1829
| 2023 December 1st onwards | always raise an exception |
1930

20-
# How to fix the error for the main use cases
31+
# Testing whether a package will be affected by the `sklearn` deprecation
2132

22-
- use `pip install scikit-learn` rather than `pip install sklearn`
23-
- replace `sklearn` by `scikit-learn` in your pip requirements files
24-
(`requirements.txt`, `setup.py,` `setup.cfg`, `Pipfile`, etc ...)
25-
- if the `sklearn` package is used by one of your dependencies
26-
it would be great if you take some time to track which package uses
27-
`sklearn` instead of `scikit-learn` and report it to their issue tracker
28-
- as last resort, set the environment variable ,
29-
`SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True` to avoid this error
33+
If you want to test whether a package has `sklearn` in its dependencies
34+
independently of the brownout schedule, you can do:
35+
36+
```
37+
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=False \
38+
pip install package-to-test-goes-here
39+
```
40+
41+
If you get an error that means that the package has `sklearn` in one of its
42+
dependencies. It would be greatly appreciated if you track which package it is,
43+
and if you report it to the appropriate project issue tracker to make them
44+
aware of the `sklearn` deprecation.
3045

3146
# Reason for the deprecation
3247

@@ -52,17 +67,3 @@ implemented:
5267
list` output prompting questions like "why do I have scikit-learn 1.1.1 and
5368
sklearn 0.0, and what does it even mean"?
5469

55-
# Testing whether a package will be affected by the `sklearn` deprecation
56-
57-
If you want to test whether a package has `sklearn` in its dependencies
58-
independently of the brownout schedule, you can do:
59-
60-
```
61-
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=False \
62-
pip install package-to-test-goes-here
63-
```
64-
65-
If you get an error that means that the package has `sklearn` in one of its
66-
dependencies. It would be greatly appreciated if you track which package it is,
67-
and if you report it to the appropriate project issue tracker to make them
68-
aware of the `sklearn` deprecation.

setup.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ def maybe_raise_error(checked_datetime):
5757

5858
error_message = "\n".join(
5959
[
60-
"The 'sklearn' PyPI package is deprecated, use 'scikit-learn' ",
60+
"The 'sklearn' PyPI package is deprecated, use 'scikit-learn'",
6161
"rather than 'sklearn' for pip commands. ",
6262
"",
63-
"The brownout schedule for sklearn deprecation can be found at ",
64-
"https://github.com/scikit-learn/sklearn-pypi-package#brownout-schedule",
65-
"",
6663
"Here is how to fix this error in the main use cases:",
6764
"- use 'pip install scikit-learn' rather than 'pip install sklearn'",
68-
"- replace sklearn by scikit-learn in your pip requirements files",
65+
"- replace 'sklearn' by 'scikit-learn' in your pip requirements files",
6966
" (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)",
70-
"- if the sklearn package is used by one of your dependencies, ",
71-
" it would be great if you take some time to track which package uses ",
72-
" sklearn instead of scikit-learn and report it to their issue tracker",
73-
"- as last resort, set the environment variable ",
67+
"- if the 'sklearn' package is used by one of your dependencies,",
68+
" it would be great if you take some time to track which package uses",
69+
" 'sklearn' instead of 'scikit-learn' and report it to their issue tracker",
70+
"- as a last resort, set the environment variable",
7471
" SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error",
7572
"",
76-
"If the previous advice does not cover your use case, feel free to report it at:",
73+
"More information is available at",
74+
"https://github.com/scikit-learn/sklearn-pypi-package",
75+
"",
76+
"If the previous advice does not cover your use case, feel free to report it at",
7777
"https://github.com/scikit-learn/sklearn-pypi-package/issues/new",
7878
]
7979
)
@@ -89,11 +89,11 @@ def maybe_raise_error(checked_datetime):
8989
if __name__ == "__main__":
9090
# We allow python setup.py sdist to always work to be able to create the
9191
# sdist and upload it to PyPI
92-
sdist_mode = len(sys.argv) == 2 and sys.argv[1] == 'sdist'
92+
sdist_mode = len(sys.argv) == 2 and sys.argv[1] == "sdist"
9393

9494
if not sdist_mode:
9595
# environment variable for test purposes
96-
datetime_str = os.getenv('SKLEARN_DEPRECATED_SKLEARN_CHECKED_DATETIME', None)
96+
datetime_str = os.getenv("SKLEARN_DEPRECATED_SKLEARN_CHECKED_DATETIME", None)
9797
if datetime_str is None:
9898
checked_datetime = datetime.now()
9999
else:

0 commit comments

Comments
 (0)