##// END OF EJS Templates
Merge pull request #12086 from tacaswell/mnt_pytest...
Merge pull request #12086 from tacaswell/mnt_pytest MNT: update pytest.ini to work with pytest > 3

File last commit:

r25276:7995e64e
r25424:a6082c6f merge
Show More
setup.py
262 lines | 8.5 KiB | text/x-python | PythonLexer
Thomas Kluyver
Release scripts need to use Python 3
r24250 #!/usr/bin/env python3
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 # -*- coding: utf-8 -*-
"""Setup script for IPython.
Under Posix environments it works like a typical setup.py script.
Under Windows, the command sdist is not supported, since IPython
requires utilities which are not available under Windows."""
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2011, IPython Development Team.
# Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
# Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
# Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
#
# Distributed under the terms of the Modified BSD License.
#
Jonathan Frederic
s/COPYING.txt/COPYING.rst
r15990 # The full license is in the file COPYING.rst, distributed with this software.
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 #-----------------------------------------------------------------------------
Paul Ivanov
restore __future__ to print error in Python 2
r22977 from __future__ import print_function
Fernando Perez
Inform user at install time of minimal python requirements if not met....
r2493
Thomas Kluyver
Code style cleanups
r23546 import os
Fernando Perez
Inform user at install time of minimal python requirements if not met....
r2493 import sys
Thomas Kluyver
Clean up pip version check
r23544 # **Python version check**
#
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 # This check is also made in IPython/__init__, don't forget to update both when
# changing Python version requirements.
Matthias Bussonnier
Adopt NEP 29, Drop Python 3.5 and Numpy <1.14...
r25225 if sys.version_info < (3, 6):
Thomas Kluyver
Clean up pip version check
r23544 pip_message = 'This may be due to an out of date pip. Make sure you have pip >= 9.0.1.'
Matthias Bussonnier
more pip infos
r23539 try:
import pip
pip_version = tuple([int(x) for x in pip.__version__.split('.')[:3]])
if pip_version < (9, 0, 1) :
Thomas Kluyver
Clean up pip version check
r23544 pip_message = 'Your pip version is out of date, please install pip >= 9.0.1. '\
Matthias Bussonnier
more pip infos
r23539 'pip {} detected.'.format(pip.__version__)
Thomas Kluyver
Suppress message about pip if we do find a new enough pip
r23548 else:
# pip is new enough - it must be something else
pip_message = ''
Matthias Bussonnier
more pip infos
r23539 except Exception:
pass
Rastislav Barlik
Fix broken jedi auto-completion with newest jedi...
r24033
Matthias Bussonnier
Improve our error messages for non compatibility.
r22823 error = """
Matthias Bussonnier
Adopt NEP 29, Drop Python 3.5 and Numpy <1.14...
r25225 IPython 7.10+ supports Python 3.6 and above, following NEP 29.
Matthias Bussonnier
Improve our error messages for non compatibility.
r22823 When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Matthias Bussonnier
remove duplicate WatsNew from bad rebase
r24471 Python 3.3 and 3.4 were supported up to IPython 6.x.
Matthias Bussonnier
Adopt NEP 29, Drop Python 3.5 and Numpy <1.14...
r25225 Python 3.5 was supported with IPython 7.0 to 7.9.
Matthias Bussonnier
Improve our error messages for non compatibility.
r22823
See IPython `README.rst` file for more information:
https://github.com/ipython/ipython/blob/master/README.rst
Matthias Bussonnier
more pip infos
r23539 Python {py} detected.
{pip}
""".format(py=sys.version_info, pip=pip_message )
Matthias Bussonnier
Improve our error messages for non compatibility.
r22823
MinRK
update version-check message in setup.py and IPython.__init__...
r12473 print(error, file=sys.stderr)
sys.exit(1)
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829
# At least we're on the python version we need, move on.
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
from distutils.core import setup
# Our own imports
from setupbase import target_update
from setupbase import (
setup_args,
find_packages,
find_package_data,
MinRK
run check_package_data as part of build_py...
r15165 check_package_data_first,
Thomas Kluyver
Rework setup to allow installing on Python 2 and 3....
r13452 find_entry_points,
build_scripts_entrypt,
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 find_data_files,
MinRK
ensure submodules exist prior to doing anything...
r10484 git_prebuild,
Thomas Kluyver
Rework setup to allow installing on Python 2 and 3....
r13452 install_symlinked,
install_lib_symlink,
install_scripts_for_symlink,
Thomas Kluyver
Add 'unsymlink command to remove the symlink
r13862 unsymlink,
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 )
isfile = os.path.isfile
pjoin = os.path.join
#-------------------------------------------------------------------------------
# Handle OS specific things
#-------------------------------------------------------------------------------
MinRK
don't give up on weird os names...
r10087 if os.name in ('nt','dos'):
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 os_name = 'windows'
Ville M. Vainio
more crlf
r1033 else:
MinRK
don't give up on weird os names...
r10087 os_name = os.name
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829
# Under Windows, 'sdist' has not been supported. Now that the docs build with
# Sphinx it might work, but let's not turn it on until someone confirms that it
# actually works.
if os_name == 'windows' and 'sdist' in sys.argv:
print('The sdist command is not available under Windows. Exiting.')
sys.exit(1)
MinRK
ensure submodules exist prior to doing anything...
r10484
#-------------------------------------------------------------------------------
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 # Things related to the IPython documentation
#-------------------------------------------------------------------------------
# update the manuals when building a source dist
if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
# List of things to be updated. Each entry is a triplet of args for
# target_update()
to_update = [
('docs/man/ipython.1.gz',
['docs/man/ipython.1'],
'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'),
]
[ target_update(*t) for t in to_update ]
#---------------------------------------------------------------------------
# Find all the packages, package data, and data_files
#---------------------------------------------------------------------------
packages = find_packages()
package_data = find_package_data()
MinRK
only validate package_data when it might be used...
r15114
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 data_files = find_data_files()
setup_args['packages'] = packages
setup_args['package_data'] = package_data
setup_args['data_files'] = data_files
#---------------------------------------------------------------------------
MinRK
record sysinfo in sdist...
r7794 # custom distutils commands
MinRK
enable uploading wininst to PyPI with tools/release_windows.py...
r7792 #---------------------------------------------------------------------------
MinRK
record sysinfo in sdist...
r7794 # imports here, so they are after setuptools import if there was one
from distutils.command.sdist import sdist
MinRK
enable uploading wininst to PyPI with tools/release_windows.py...
r7792
MinRK
record sysinfo in sdist...
r7794 setup_args['cmdclass'] = {
Min RK
remove notebook-specific parts of setup, git-hooks
r21249 'build_py': \
check_package_data_first(git_prebuild('IPython')),
'sdist' : git_prebuild('IPython', sdist),
Thomas Kluyver
Rework setup to allow installing on Python 2 and 3....
r13452 'symlink': install_symlinked,
'install_lib_symlink': install_lib_symlink,
'install_scripts_sym': install_scripts_for_symlink,
Thomas Kluyver
Add 'unsymlink command to remove the symlink
r13862 'unsymlink': unsymlink,
MinRK
record sysinfo in sdist...
r7794 }
MinRK
enable uploading wininst to PyPI with tools/release_windows.py...
r7792
Min RK
disable install from master...
r21036
MinRK
enable uploading wininst to PyPI with tools/release_windows.py...
r7792 #---------------------------------------------------------------------------
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 # Handle scripts, dependencies, and setuptools specific things
#---------------------------------------------------------------------------
# For some commands, use setuptools. Note that we do NOT list install here!
# If you want a setuptools-enhanced install, just run 'setupegg.py install'
Thomas Kluyver
Code style cleanups
r23546 needs_setuptools = {'develop', 'release', 'bdist_egg', 'bdist_rpm',
MinRK
always construct requirements
r15030 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
'egg_info', 'easy_install', 'upload', 'install_egg_info',
Thomas Kluyver
Code style cleanups
r23546 }
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829
if len(needs_setuptools.intersection(sys.argv)) > 0:
import setuptools
# This dict is used for passing extra arguments that are setuptools
# specific to setup
setuptools_extra_args = {}
MinRK
always construct requirements
r15030 # setuptools requirements
extras_require = dict(
Min RK
ipython_parallel is now ipyparallel
r21326 parallel = ['ipyparallel'],
Min RK
jupyter_qtconsole is now qtconsole
r21338 qtconsole = ['qtconsole'],
Min RK
use napoleon instead of numpydoc
r21711 doc = ['Sphinx>=1.3'],
Matthias Bussonnier
Adopt NEP 29, Drop Python 3.5 and Numpy <1.14...
r25225 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel', 'numpy>=1.14'],
MinRK
add ipython[terminal] dependency group...
r16386 terminal = [],
Min RK
ipython_kernel is now ipykernel
r21337 kernel = ['ipykernel'],
Min RK
jupyter_nbformat is now nbformat
r21345 nbformat = ['nbformat'],
Min RK
ipython[notebook] should depend on ipywidgets
r21743 notebook = ['notebook', 'ipywidgets'],
Min RK
jupyter_nbconvert is now nbconvert...
r21339 nbconvert = ['nbconvert'],
MinRK
always construct requirements
r15030 )
Matthias Bussonnier
Make a few test non-optional....
r22379
MinRK
remove path from external
r20811 install_requires = [
Min RK
missing comma in setuptools requirement
r22035 'setuptools>=18.5',
Rastislav Barlik
Support older versions of jedi library
r24034 'jedi>=0.10',
MinRK
remove decorator from external
r20813 'decorator',
Min RK
remove pickleshare from external
r20844 'pickleshare',
Matthias Bussonnier
Require recent enough traitlets...
r22305 'traitlets>=4.2',
Jonathan Slenders
Run the prompt in a separate asyncio loop....
r25276 'prompt_toolkit>=2.0.0,<3.1.0,!=3.0.0,!=3.0.1',
Thomas Kluyver
Add explicit dependency on pygments...
r22126 'pygments',
Fabio Niephaus
Use `backcall` and introduce `ExecutionRequest`
r23996 'backcall',
MinRK
remove path from external
r20811 ]
MinRK
add ipython[terminal] dependency group...
r16386
Min RK
update platform-specific dependencies...
r21372 # Platform-specific dependencies:
# This is the correct way to specify these,
# but requires pip >= 6. pip < 6 ignores these.
Min RK
workaround setuptools misspelling of platform_python_implementation...
r21659
Min RK
update platform-specific dependencies...
r21372 extras_require.update({
':sys_platform != "win32"': ['pexpect'],
Min RK
only require gnureadline on CPython...
r21652 ':sys_platform == "darwin"': ['appnope'],
Thomas Kluyver
Don't require win_unicode_console on Python 3.6...
r22867 ':sys_platform == "win32"': ['colorama'],
Min RK
update platform-specific dependencies...
r21372 })
# FIXME: re-specify above platform dependencies for pip < 6
# These would result in non-portable bdists.
if not any(arg.startswith('bdist') for arg in sys.argv):
if sys.platform == 'darwin':
Min RK
only require gnureadline on CPython...
r21652 install_requires.extend(['appnope'])
Matthias Bussonnier
Remove readline related code. Pass 1
r22628
if not sys.platform.startswith('win'):
Min RK
update platform-specific dependencies...
r21372 install_requires.append('pexpect')
klonuo
Add WUC version requirement in setup.py
r22591
Min RK
workaround setuptools misspelling of platform_python_implementation...
r21659 # workaround pypa/setuptools#147, where setuptools misspells
# platform_python_implementation as python_implementation
if 'setuptools' in sys.modules:
for key in list(extras_require):
if 'platform_python_implementation' in key:
new_key = key.replace('platform_python_implementation', 'python_implementation')
extras_require[new_key] = extras_require.pop(key)
cgohlke
Remove PyReadline as a install requirement on Windows
r16244
Min RK
calculate 'all' dependency set after finishing the rest...
r20256 everything = set()
Min RK
don't include platform-specific dependencies in ipython[all]
r21644 for key, deps in extras_require.items():
if ':' not in key:
everything.update(deps)
Min RK
calculate 'all' dependency set after finishing the rest...
r20256 extras_require['all'] = everything
MinRK
always construct requirements
r15030
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 if 'setuptools' in sys.modules:
Matthias Bussonnier
Adopt NEP 29, Drop Python 3.5 and Numpy <1.14...
r25225 setuptools_extra_args['python_requires'] = '>=3.6'
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 setuptools_extra_args['zip_safe'] = False
Lev Abalkin
Closes #7558: Added pygments entry points for ipython lexers.
r20117 setuptools_extra_args['entry_points'] = {
'console_scripts': find_entry_points(),
'pygments.lexers': [
Thomas Kluyver
Move IPython lexers module to lib...
r20625 'ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer',
'ipython = IPython.lib.lexers:IPythonLexer',
'ipython3 = IPython.lib.lexers:IPython3Lexer',
Lev Abalkin
Closes #7558: Added pygments entry points for ipython lexers.
r20117 ],
}
MinRK
always construct requirements
r15030 setup_args['extras_require'] = extras_require
Thomas Kluyver
Remove unused code for building Windows installers
r23547 setup_args['install_requires'] = install_requires
Christoph Gohlke
Improve Windows start menu shortcuts
r8814
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 else:
Thomas Kluyver
Rework setup to allow installing on Python 2 and 3....
r13452 # scripts has to be a non-empty list, or install_scripts isn't called
setup_args['scripts'] = [e.split('=')[0].strip() for e in find_entry_points()]
setup_args['cmdclass']['build_scripts'] = build_scripts_entrypt
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829
#---------------------------------------------------------------------------
# Do the actual setup now
#---------------------------------------------------------------------------
setup_args.update(setuptools_extra_args)
Matthias Bussonnier
Add release instructions for IPython....
r21986
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 def main():
setup(**setup_args)
Fernando Perez
Move cleanup to main setup.py, where it belongs....
r2460
Thomas Kluyver
Remove separate setup.py file for Python 3.
r5829 if __name__ == '__main__':
main()