Skip to content

Commit 328b0ac

Browse files
authored
Merge pull request python3statement#128 from Carreau/setup.py
Try to give example of raise in setup.py
2 parents 7674cbb + 28de46b commit 328b0ac

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

_practicalities/intro.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,35 @@ Otherwise user code can fail at runtime arbitrarily later in the future, which c
284284
be a difficult to debug and fix. Get inspiration from the message of failure at
285285
runtime, and adapt for installation time.
286286

287+
288+
Here is for a simple version of how IPython handle old versions of Python and
289+
Pip that still try to install IPython 7.0+ on Python `< (3,4)`.
290+
291+
```python
292+
if sys.version_info < (3, 4):
293+
294+
error = """
295+
IPython 7.0+ supports Python 3.4 and above.
296+
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
297+
Python 3.3 was supported up to IPython 6.x.
298+
299+
See IPython `README.rst` file for more information:
300+
301+
https://github.com/ipython/ipython/blob/master/README.rst
302+
303+
Python {py} detected.
304+
305+
Try upgrading pip and retry.
306+
""".format(py='.'.join([str(v) for v in sys.version_info[:3]]))
307+
308+
print(error, file=sys.stderr)
309+
sys.exit(1)
310+
```
311+
312+
You can look at the [full
313+
check](https://github.com/ipython/ipython/blob/6a3e2db0c299dc05e636653c4a43d0aa756fb1c8/setup.py#L23-L58)
314+
that attempt to detect which version of pip is in used.
315+
287316
## Fix dependant libraries
288317

289318
If you control dependant packages, Make sure to include conditional dependencies

0 commit comments

Comments
 (0)