From 7316506792757efd328c7acf40f369ef256ed46c 2009-07-20 22:04:20 From: Brian Granger Date: 2009-07-20 22:04:20 Subject: [PATCH] Added compatibility layer for Shell/ipapi/iplib. These 3 top-level modules have been moved to core. But, to ease the transition to their new location, we have re-created these modules at the top-level. The new top-level modules print a warning statement and simple import the moved modules for now. In the long run, we can use these for further compatibility related things. --- diff --git a/IPython/Shell.py b/IPython/Shell.py new file mode 100644 index 0000000..9271cc4 --- /dev/null +++ b/IPython/Shell.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" +A backwards compatibility layer for IPython.Shell. + +Previously, IPython had an IPython.Shell module. IPython.Shell has been moved +to IPython.core.shell 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.shell. +""" + +#----------------------------------------------------------------------------- +# 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.Shell) has been moved to a new location +(IPython.core.shell) and is being refactored. Please update your code +to use the new IPython.core.shell module""" + +warn(msg, category=DeprecationWarning, stacklevel=1) + +from IPython.core.shell import * + diff --git a/IPython/ipapi.py b/IPython/ipapi.py new file mode 100644 index 0000000..39c3427 --- /dev/null +++ b/IPython/ipapi.py @@ -0,0 +1,29 @@ +#!/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 * + diff --git a/IPython/iplib.py b/IPython/iplib.py new file mode 100644 index 0000000..95dcc88 --- /dev/null +++ b/IPython/iplib.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" +A backwards compatibility layer for IPython.iplib. + +Previously, IPython had an IPython.iplib module. IPython.iplib has been moved +to IPython.core.iplib 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.iplib. +""" + +#----------------------------------------------------------------------------- +# 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.iplib) has been moved to a new location +(IPython.core.iplib) and is being refactored. Please update your code +to use the new IPython.core.iplib module""" + +warn(msg, category=DeprecationWarning, stacklevel=1) + +from IPython.core.iplib import * diff --git a/docs/source/development/reorg.txt b/docs/source/development/reorg.txt index c43e623..b302158 100644 --- a/docs/source/development/reorg.txt +++ b/docs/source/development/reorg.txt @@ -1,11 +1,11 @@ ============================= IPython module reorganization -============================= +=============================' -Currently, IPython has many top-level modules that serve many different purposes. -The lack of organization make it very difficult for developers to work on IPython -and understand its design. This document contains notes about how we will reorganize -the modules into sub-packages. +Currently, IPython has many top-level modules that serve many different +purposes. The lack of organization make it very difficult for developers to +work on IPython and understand its design. This document contains notes about +how we will reorganize the modules into sub-packages. .. warning:: @@ -71,7 +71,7 @@ We propose to create the following new sub-packages: standards, but that we plan on keeping. To be moved out of this sub-package a module needs to have a maintainer, tests and documentation. -Prodecure +Prodedure ========= 1. Move the file to its new location with its new name. @@ -79,18 +79,30 @@ Prodecure 3. Run PyFlakes on each changes module. 3. Add tests/test_imports.py to test it. -Need to modify iptests to properly skip modules that are no longer top -level modules. +Status +====== + +The new subpackages have been created and the top-level modules have been +moved and renamed. Import tests have been created for all of the moved and +renamed modules. The build infrastructure (setup.py and friends) have been +updated and tested on Mac and Windows. Finally, a compatibility layer has been +added for iplib, ipapi and Shell. The follow things still need to be done:: + +* I need to modify iptests to properly skip modules that are no longer top + level modules. -Need to update the top level IPython/__init__.py file. +* I Need to update the top level IPython/__init__.py file. We need to make + sure that as we change how this is setup, that all modules still import. -Need to get installation working correctly. +* When running python setup.py sdist, the Sphinx API docs fail to build + because of something going on with IPython.core.fakemodule -When running python setup.py sdist, the Sphinx API docs fail to build because -of something going on with IPython.core.fakemodule +* :file:`Extensions`. This needs to be gone through separately. Minimally, + the package should be renamed to :file:`extensions` and the PYTHONPATH + setting in __init__.py needs to be updated. -Where things will be moved -========================== +Where things have been moved +============================ Top-level modules: @@ -133,9 +145,6 @@ Top-level modules: * :file:`twshell.py`. Move to :file:`IPython.sandbox`. -* :file:`Extensions`. This needs to be gone through separately. Minimally, - the package should be renamed to :file:`extensions`. - * :file:`history.py`. Move to :file:`IPython.core`. * :file:`hooks.py`. Move to :file:`IPython.core`. @@ -148,7 +157,7 @@ Top-level modules: * :file:`ipstruct.py`. Move to :file:`IPython.python`. -* :file:`irunner.py`. Move to :file:`IPython.scripts`. ??? +* :file:`irunner.py`. Move to :file:`IPython.scripts`. * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in :file:`IPython.external`. @@ -176,9 +185,8 @@ Top-level modules: * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or :file:`IPython/frontend/prompts.py`. -* :file:`PyColorize.py`. Replace with pygments? If not, move to - :file:`IPython/core/pycolorize.py`. Maybe move to :mod:`IPython.lib` or - :mod:`IPython.python`? +* :file:`PyColorize.py`. Move to :file:`IPython/utils/pycolorize.py`. Explore + replacing with pygments. * :file:`Release.py`. Move to ??? or remove?