From d6c98ebce5f71ed7c60d75d6220d0803c10c67d8 2009-09-18 02:59:36 From: Brian Granger Date: 2009-09-18 02:59:36 Subject: [PATCH] Removed ipapi compatability layer and updated top-level functions. The ipapi.py module has been completely deprecated as of this point. No new code should use it and all existing code that uses it will migrate away from it. The launch_new_instance function has been moved to ipapp and the setup.py scripts have been updated. --- diff --git a/IPython/core/ipapi.py b/IPython/core/ipapi.py index e4d2df2..dc1f1f5 100644 --- a/IPython/core/ipapi.py +++ b/IPython/core/ipapi.py @@ -1,19 +1,10 @@ #!/usr/bin/env python # encoding: utf-8 """ -Oh my @#*%, where did ipapi go? - -Originally, this module was designed to be a public api for IPython. It is -now deprecated and replaced by :class:`IPython.core.Interactive` shell. -Almost all of the methods that were here are now there, but possibly renamed. - -During our transition, we will keep this simple module with its :func:`get` -function. It too will eventually go away when the new component querying -interface is fully used. - -Authors: - -* Brian Granger +This module is *completely* deprecated and should no longer be used for +any purpose. Currently, we have a few parts of the core that have +not been componentized and thus, still rely on this module. When everything +has been made into a component, this module will be sent to deathrow. """ #----------------------------------------------------------------------------- @@ -42,17 +33,3 @@ def get(): if inst.created > most_recent.created: most_recent = inst return most_recent - -def launch_new_instance(): - """Create a run a full blown IPython instance""" - from IPython.core.ipapp import IPythonApp - app = IPythonApp() - app.start() - - - - - - - - diff --git a/IPython/core/ipapp.py b/IPython/core/ipapp.py index b8540c5..3e03325 100644 --- a/IPython/core/ipapp.py +++ b/IPython/core/ipapp.py @@ -538,6 +538,8 @@ def load_default_config(ipythondir=None): return config -if __name__ == '__main__': +def launch_new_instance(): + """Create a run a full blown IPython instance""" app = IPythonApp() - app.start() \ No newline at end of file + app.start() + diff --git a/IPython/ipapi.py b/IPython/ipapi.py deleted file mode 100644 index 8a4dd65..0000000 --- a/IPython/ipapi.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -""" -A backwards compatibility layer for IPython.ipapi. - -Previously, IPython had an IPython.ipapi module. IPython.ipapi has been moved -to IPython.core.ipapi and is being refactored. This new module is provided -for backwards compatability. We strongly encourage everyone to start using -the new code in IPython.core.ipapi. -""" - -#----------------------------------------------------------------------------- -# Copyright (C) 2008-2009 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- - -from warnings import warn - -msg = """ -This module (IPython.ipapi) has been moved to a new location -(IPython.core.ipapi) and is being refactored. Please update your code -to use the new IPython.core.ipapi module""" - -warn(msg, category=DeprecationWarning, stacklevel=1) - -from IPython.core.ipapi import get, launch_new_instance - diff --git a/IPython/scripts/ipython b/IPython/scripts/ipython index f3860f1..65fec55 100755 --- a/IPython/scripts/ipython +++ b/IPython/scripts/ipython @@ -1,28 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -"""IPython -- An enhanced Interactive Python -This is just the startup wrapper script, kept deliberately to a minimum. - -The shell's mainloop() takes an optional argument, sys_exit (default=0). If -set to 1, it calls sys.exit() at exit time. You can use the following code in -your PYTHONSTARTUP file: - -import IPython -IPython.Shell.IPShell().mainloop(sys_exit=1) - -[or simply IPython.Shell.IPShell().mainloop(1) ] - -and IPython will be your working environment when you start python. The final -sys.exit() call will make python exit transparently when IPython finishes, so -you don't have an extra prompt to get out of. - -This is probably useful to developers who manage multiple Python versions and -don't want to have correspondingly multiple IPython versions. Note that in -this mode, there is no way to pass IPython any command-line options, as those -are trapped first by Python itself. -""" - -from IPython.core.ipapi import launch_new_instance +from IPython.core.ipapp import launch_new_instance launch_new_instance() diff --git a/MANIFEST.in b/MANIFEST.in index 749ecd9..841d4ea 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -18,7 +18,6 @@ graft IPython/scripts graft IPython/testing graft IPython/utils -recursive-include IPython/extensions igrid_help* graft docs exclude docs/\#* diff --git a/setup.py b/setup.py index afca429..0826f67 100755 --- a/setup.py +++ b/setup.py @@ -167,7 +167,7 @@ if 'setuptools' in sys.modules: setuptools_extra_args['zip_safe'] = False setuptools_extra_args['entry_points'] = { 'console_scripts': [ - 'ipython = IPython.core.ipapi:launch_new_instance', + 'ipython = IPython.core.ipapp:launch_new_instance', 'pycolor = IPython.utils.PyColorize:main', 'ipcontroller = IPython.kernel.scripts.ipcontroller:main', 'ipengine = IPython.kernel.scripts.ipengine:main', @@ -190,10 +190,6 @@ if 'setuptools' in sys.modules: # Allow setuptools to handle the scripts scripts = [] else: - # package_data of setuptools was introduced to distutils in 2.4 - cfgfiles = filter(isfile, glob(pjoin('IPython','config','userconfig'))) - if sys.version_info < (2,4): - data_files.append(('lib', pjoin('IPython','config','userconfig'), cfgfiles)) # If we are running without setuptools, call this function which will # check for dependencies an inform the user what is needed. This is # just to make life easy for users. diff --git a/setupbase.py b/setupbase.py index 2d667b8..93559e9 100644 --- a/setupbase.py +++ b/setupbase.py @@ -103,7 +103,7 @@ def find_packages(): Find all of IPython's packages. """ packages = ['IPython'] - add_package(packages, 'config', tests=True) + add_package(packages, 'config', tests=True, others=['default','profile']) add_package(packages, 'core', tests=True) add_package(packages, 'deathrow', tests=True) add_package(packages , 'extensions')