##// END OF EJS Templates
update copyright to 2011/20xx-2011...
update copyright to 2011/20xx-2011 Closes #1033 (rebased to prevent recursive merge). Closes #2. 459 *.py files in : 39 empty files 176 files without copyright 36 have copyright but don't cite the dev team 208 have copyright and cite the dev team ----------------------------------------- 0 not up to date (cite dev team but not right year) FYI, list of files that don't have copyright (and are not empty..) [ 'IPython/config/profile/cluster/ipython_config.py', 'IPython/config/profile/math/ipython_config.py', 'IPython/config/profile/pylab/ipython_config.py', 'IPython/config/profile/pysh/ipython_config.py', 'IPython/config/profile/python3/ipython_config.py', 'IPython/config/profile/sympy/ipython_config.py', 'IPython/core/shadowns.py', 'IPython/core/tests/refbug.py', 'IPython/core/tests/simpleerr.py', 'IPython/core/tests/tclass.py', 'IPython/core/tests/test_application.py', 'IPython/core/tests/test_autocall.py', 'IPython/core/tests/test_completer.py', 'IPython/core/tests/test_fakemodule.py', 'IPython/core/tests/test_formatters.py', 'IPython/core/tests/test_handlers.py', 'IPython/core/tests/test_history.py', 'IPython/core/tests/test_imports.py', 'IPython/core/tests/test_iplib.py', 'IPython/core/tests/test_logger.py', 'IPython/core/tests/test_magic.py', 'IPython/core/tests/test_plugin.py', 'IPython/core/tests/test_prefilter.py', 'IPython/core/tests/test_profile.py', 'IPython/core/tests/test_run.py', 'IPython/core/tests/test_splitinput.py', 'IPython/deathrow/astyle.py', 'IPython/deathrow/dtutils.py', 'IPython/deathrow/Gnuplot2.py', 'IPython/deathrow/GnuplotInteractive.py', 'IPython/deathrow/GnuplotRuntime.py', 'IPython/deathrow/gui/wx/ipshell_nonblocking.py', 'IPython/deathrow/gui/wx/ipython_history.py', 'IPython/deathrow/gui/wx/thread_ex.py', 'IPython/deathrow/ibrowse.py', 'IPython/deathrow/igrid.py', 'IPython/deathrow/ipipe.py', 'IPython/deathrow/ipy_defaults.py', 'IPython/deathrow/ipy_kitcfg.py', 'IPython/deathrow/ipy_legacy.py', 'IPython/deathrow/ipy_p4.py', 'IPython/deathrow/ipy_profile_none.py', 'IPython/deathrow/ipy_profile_numpy.py', 'IPython/deathrow/ipy_profile_scipy.py', 'IPython/deathrow/ipy_profile_sh.py', 'IPython/deathrow/ipy_traits_completer.py', 'IPython/deathrow/ipy_vimserver.py', 'IPython/deathrow/numeric_formats.py', 'IPython/deathrow/oldfrontend/process/__init__.py', 'IPython/deathrow/oldfrontend/wx/ipythonx.py', 'IPython/deathrow/scitedirector.py', 'IPython/deathrow/tests/test_prefilter.py', 'IPython/deathrow/twshell.py', 'IPython/extensions/__init__.py', 'IPython/extensions/autoreload.py', 'IPython/extensions/storemagic.py', 'IPython/extensions/tests/test_autoreload.py', 'IPython/external/__init__.py', 'IPython/external/argparse/__init__.py', 'IPython/external/decorator/__init__.py', 'IPython/external/decorators/__init__.py', 'IPython/external/decorators/_decorators.py', 'IPython/external/decorators/_numpy_testing_noseclasses.py', 'IPython/external/decorators/_numpy_testing_utils.py', 'IPython/external/guid/__init__.py', 'IPython/external/Itpl/__init__.py', 'IPython/external/mglob/__init__.py', 'IPython/external/mglob/_mglob.py', 'IPython/external/path/__init__.py', 'IPython/external/path/_path.py', 'IPython/external/pexpect/__init__.py', 'IPython/external/pyparsing/__init__.py', 'IPython/external/qt.py', 'IPython/external/qt_for_kernel.py', 'IPython/external/simplegeneric/__init__.py', 'IPython/external/simplegeneric/_simplegeneric.py', 'IPython/frontend/html/notebook/__init__.py', 'IPython/frontend/html/notebook/tests/test_kernelsession.py', 'IPython/frontend/qt/base_frontend_mixin.py', 'IPython/frontend/qt/console/ansi_code_processor.py', 'IPython/frontend/qt/console/bracket_matcher.py', 'IPython/frontend/qt/console/call_tip_widget.py', 'IPython/frontend/qt/console/completion_lexer.py', 'IPython/frontend/qt/console/completion_widget.py', 'IPython/frontend/qt/console/console_widget.py', 'IPython/frontend/qt/console/history_console_widget.py', 'IPython/frontend/qt/console/ipython_widget.py', 'IPython/frontend/qt/console/kill_ring.py', 'IPython/frontend/qt/console/mainwindow.py', 'IPython/frontend/qt/console/pygments_highlighter.py', 'IPython/frontend/qt/console/qtconsoleapp.py', 'IPython/frontend/qt/console/rich_ipython_widget.py', 'IPython/frontend/qt/console/styles.py', 'IPython/frontend/qt/console/tests/test_ansi_code_processor.py', 'IPython/frontend/qt/console/tests/test_completion_lexer.py', 'IPython/frontend/qt/console/tests/test_kill_ring.py', 'IPython/frontend/qt/kernelmanager.py', 'IPython/frontend/qt/rich_text.py', 'IPython/frontend/qt/svg.py', 'IPython/frontend/qt/util.py', 'IPython/kernel/__init__.py', 'IPython/lib/clipboard.py', 'IPython/lib/display.py', 'IPython/lib/irunner.py', 'IPython/lib/security.py', 'IPython/lib/tests/test_imports.py', 'IPython/lib/tests/test_irunner.py', 'IPython/lib/tests/test_irunner_pylab_magic.py', 'IPython/lib/tests/test_security.py', 'IPython/nbformat/v1/tests/nbexamples.py', 'IPython/nbformat/v1/tests/test_json.py', 'IPython/nbformat/v1/tests/test_nbbase.py', 'IPython/nbformat/v2/tests/nbexamples.py', 'IPython/nbformat/v2/tests/test_json.py', 'IPython/nbformat/v2/tests/test_nbbase.py', 'IPython/nbformat/v2/tests/test_nbpy.py', 'IPython/quarantine/clearcmd.py', 'IPython/quarantine/envpersist.py', 'IPython/quarantine/ext_rescapture.py', 'IPython/quarantine/ipy_app_completers.py', 'IPython/quarantine/ipy_completers.py', 'IPython/quarantine/ipy_editors.py', 'IPython/quarantine/ipy_exportdb.py', 'IPython/quarantine/ipy_extutil.py', 'IPython/quarantine/ipy_fsops.py', 'IPython/quarantine/ipy_gnuglobal.py', 'IPython/quarantine/ipy_jot.py', 'IPython/quarantine/ipy_lookfor.py', 'IPython/quarantine/ipy_profile_doctest.py', 'IPython/quarantine/ipy_pydb.py', 'IPython/quarantine/ipy_rehashdir.py', 'IPython/quarantine/ipy_render.py', 'IPython/quarantine/ipy_server.py', 'IPython/quarantine/ipy_signals.py', 'IPython/quarantine/ipy_synchronize_with.py', 'IPython/quarantine/ipy_system_conf.py', 'IPython/quarantine/ipy_which.py', 'IPython/quarantine/ipy_winpdb.py', 'IPython/quarantine/ipy_workdir.py', 'IPython/quarantine/jobctrl.py', 'IPython/quarantine/ledit.py', 'IPython/quarantine/win32clip.py', 'IPython/testing/mkdoctests.py', 'IPython/testing/plugin/dtexample.py', 'IPython/testing/plugin/ipdoctest.py', 'IPython/testing/plugin/iptest.py', 'IPython/testing/plugin/setup.py', 'IPython/testing/plugin/show_refs.py', 'IPython/testing/plugin/simple.py', 'IPython/testing/plugin/simplevars.py', 'IPython/testing/plugin/test_ipdoctest.py', 'IPython/testing/plugin/test_refs.py', 'IPython/testing/skipdoctest.py', 'IPython/testing/tests/test_decorators.py', 'IPython/utils/autoattr.py', 'IPython/utils/nested_context.py', 'IPython/utils/pickleshare.py', 'IPython/utils/py3compat.py', 'IPython/utils/PyColorize.py', 'IPython/utils/rlineimpl.py', 'IPython/utils/strdispatch.py', 'IPython/utils/tempdir.py', 'IPython/utils/tests/test_imports.py', 'IPython/utils/tests/test_wildcard.py', 'IPython/utils/upgradedir.py', 'IPython/zmq/completer.py', 'IPython/zmq/displayhook.py', 'IPython/zmq/entry_point.py', 'IPython/zmq/frontend.py', 'IPython/zmq/iostream.py', 'IPython/zmq/ipkernel.py', 'IPython/zmq/log.py', 'IPython/zmq/parentpoller.py', 'IPython/zmq/pykernel.py', 'IPython/zmq/pylab/backend_inline.py', 'IPython/zmq/zmqshell.py' ]

File last commit:

r5104:e64adb9b
r5390:c82649ea
Show More
profileapp.py
250 lines | 8.6 KiB | text/x-python | PythonLexer
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 # encoding: utf-8
"""
An application for managing IPython profiles.
To be invoked as the `ipython profile` subcommand.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 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.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import logging
import os
from IPython.config.application import Application, boolean_flag
from IPython.core.application import (
BaseIPythonApplication, base_flags, base_aliases
)
from IPython.core.profiledir import ProfileDir
from IPython.utils.path import get_ipython_dir
from IPython.utils.traitlets import Unicode, Bool, Dict
#-----------------------------------------------------------------------------
# Constants
#-----------------------------------------------------------------------------
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 create_help = """Create an IPython profile by name
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024
Create an ipython profile directory by its name or
profile directory path. Profile directories contain
configuration, log and security related files and are named
using the convention 'profile_<name>'. By default they are
located in your ipython directory. Once created, you will
can edit the configuration files in the profile
directory to configure IPython. Most users will create a
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 profile directory by name,
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 `ipython profile create myprofile`, which will put the directory
in `<ipython_dir>/profile_myprofile`.
"""
list_help = """List available IPython profiles
List all available profiles, by profile location, that can
be found in the current working directly or in the ipython
directory. Profile directories are named using the convention
'profile_<profile>'.
"""
profile_help = """Manage IPython profiles
Profile directories contain
configuration, log and security related files and are named
using the convention 'profile_<name>'. By default they are
located in your ipython directory. You can create profiles
with `ipython profile create <name>`, or see the profiles you
already have with `ipython profile list`
To get started configuring IPython, simply do:
$> ipython profile create
and IPython will create the default profile in <ipython_dir>/profile_default,
where you can edit ipython_config.py to start configuring IPython.
"""
Brian Granger
More work on adding examples to help strings.
r4216 _list_examples = "ipython profile list # list all profiles"
_create_examples = """
Brian E. Granger
Finishing up help string work.
r4218 ipython profile create foo # create profile foo w/ default config files
ipython profile create foo --reset # restage default config files over current
ipython profile create foo --parallel # also stage parallel config files
Brian Granger
More work on adding examples to help strings.
r4216 """
_main_examples = """
ipython profile create -h # show the help string for the create subcommand
ipython profile list -h # show the help string for the list subcommand
"""
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 #-----------------------------------------------------------------------------
# Profile Application Class (for `ipython profile` subcommand)
#-----------------------------------------------------------------------------
class ProfileList(Application):
name = u'ipython-profile'
description = list_help
Brian Granger
More work on adding examples to help strings.
r4216 examples = _list_examples
MinRK
aliases match flag pattern ('-' as wordsep, not '_')...
r4214 aliases = Dict({
'ipython-dir' : 'ProfileList.ipython_dir',
'log-level' : 'Application.log_level',
})
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 flags = Dict(dict(
debug = ({'Application' : {'log_level' : 0}},
MinRK
aliases match flag pattern ('-' as wordsep, not '_')...
r4214 "Set Application.log_level to 0, maximizing log output."
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 )
))
Brian Granger
More work on adding examples to help strings.
r4216
Bernardo B. Marques
remove all trailling spaces
r4872 ipython_dir = Unicode(get_ipython_dir(), config=True,
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 help="""
The name of the IPython directory. This directory is used for logging
configuration (through profiles), history storage, etc. The default
is usually $HOME/.ipython. This options can also be specified through
the environment variable IPYTHON_DIR.
"""
)
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 def list_profile_dirs(self):
# Find the search paths
paths = [os.getcwdu(), self.ipython_dir]
self.log.warn('Searching for IPython profiles in paths: %r' % paths)
for path in paths:
files = os.listdir(path)
for f in files:
full_path = os.path.join(path, f)
if os.path.isdir(full_path) and f.startswith('profile_'):
profile = f.split('_',1)[-1]
start_cmd = 'ipython profile=%s' % profile
print start_cmd + " ==> " + full_path
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 def start(self):
self.list_profile_dirs()
create_flags = {}
create_flags.update(base_flags)
MinRK
command-line pass...
r4247 # don't include '--init' flag, which implies running profile create in other apps
create_flags.pop('init')
create_flags['reset'] = ({'ProfileCreate': {'overwrite' : True}},
"reset config files in this profile to the defaults.")
create_flags['parallel'] = ({'ProfileCreate': {'parallel' : True}},
"Include the config files for parallel "
"computing apps (ipengine, ipcontroller, etc.)")
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024
Brian Granger
Command line examples added for non-parallel apps.
r4215
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 class ProfileCreate(BaseIPythonApplication):
name = u'ipython-profile'
description = create_help
Brian Granger
More work on adding examples to help strings.
r4216 examples = _create_examples
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 auto_create = Bool(True, config=False)
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 def _copy_config_files_default(self):
return True
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 parallel = Bool(False, config=True,
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 help="whether to include parallel computing config files")
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 def _parallel_changed(self, name, old, new):
Bernardo B. Marques
remove all trailling spaces
r4872 parallel_files = [ 'ipcontroller_config.py',
'ipengine_config.py',
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 'ipcluster_config.py'
]
if new:
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 for cf in parallel_files:
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 self.config_files.append(cf)
else:
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 for cf in parallel_files:
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 if cf in self.config_files:
self.config_files.remove(cf)
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 def parse_command_line(self, argv):
super(ProfileCreate, self).parse_command_line(argv)
# accept positional arg as profile name
if self.extra_args:
self.profile = self.extra_args[0]
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 flags = Dict(create_flags)
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 classes = [ProfileDir]
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
default config files are automatically generated...
r4025 def init_config_files(self):
super(ProfileCreate, self).init_config_files()
# use local imports, since these classes may import from here
from IPython.frontend.terminal.ipapp import TerminalIPythonApp
apps = [TerminalIPythonApp]
try:
from IPython.frontend.qt.console.qtconsoleapp import IPythonQtConsoleApp
MinRK
catch *any* exception importing qt in profile...
r4212 except Exception:
# this should be ImportError, but under weird circumstances
# this might be an AttributeError, or possibly others
# in any case, nothing should cause the profile creation to crash.
MinRK
default config files are automatically generated...
r4025 pass
else:
apps.append(IPythonQtConsoleApp)
Brian E. Granger
Updating notebook configuration....
r4519 try:
Brian E. Granger
Misc changes to the notebook....
r5104 from IPython.frontend.html.notebook.notebookapp import NotebookApp
Brian E. Granger
More review changes....
r4609 except ImportError:
Brian E. Granger
Updating notebook configuration....
r4519 pass
Brian E. Granger
More review changes....
r4609 except Exception:
Brian E. Granger
Misc changes to the notebook....
r5104 self.log.debug('Unexpected error when importing NotebookApp',
Brian E. Granger
More review changes....
r4609 exc_info=True
)
Brian E. Granger
Updating notebook configuration....
r4519 else:
Brian E. Granger
Misc changes to the notebook....
r5104 apps.append(NotebookApp)
MinRK
rename '--cluster' flag to '--parallel' in ProfileApp...
r4038 if self.parallel:
MinRK
default config files are automatically generated...
r4025 from IPython.parallel.apps.ipcontrollerapp import IPControllerApp
from IPython.parallel.apps.ipengineapp import IPEngineApp
from IPython.parallel.apps.ipclusterapp import IPClusterStart
from IPython.parallel.apps.iploggerapp import IPLoggerApp
apps.extend([
IPControllerApp,
IPEngineApp,
IPClusterStart,
IPLoggerApp,
])
for App in apps:
app = App()
app.config.update(self.config)
app.log = self.log
app.overwrite = self.overwrite
app.copy_config_files=True
app.profile = self.profile
app.init_profile_dir()
app.init_config_files()
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
default config files are automatically generated...
r4025 def stage_default_config_file(self):
pass
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024
Brian Granger
Command line examples added for non-parallel apps.
r4215
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 class ProfileApp(Application):
name = u'ipython-profile'
description = profile_help
Brian Granger
More work on adding examples to help strings.
r4216 examples = _main_examples
Brian Granger
Command line examples added for non-parallel apps.
r4215
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024 subcommands = Dict(dict(
create = (ProfileCreate, "Create a new profile dir with default config files"),
list = (ProfileList, "List existing profiles")
))
Bernardo B. Marques
remove all trailling spaces
r4872
MinRK
`ipython profile` prints profile help...
r4026 def start(self):
if self.subapp is None:
print "No subcommand specified. Must specify one of: %s"%(self.subcommands.keys())
print
self.print_description()
self.print_subcommands()
self.exit(1)
else:
return self.subapp.start()
MinRK
move ipcluster create|list to `ipython profile create|list`...
r4024