##// END OF EJS Templates
More work on adding examples to help strings.
Brian Granger -
Show More
@@ -74,6 +74,18 b' where you can edit ipython_config.py to start configuring IPython.'
74
74
75 """
75 """
76
76
77 _list_examples = "ipython profile list # list all profiles"
78
79 _create_examples = """
80 ipython profile create foo # create profile foo
81 ipython profile create foo --init # create with default config files
82 """
83
84 _main_examples = """
85 ipython profile create -h # show the help string for the create subcommand
86 ipython profile list -h # show the help string for the list subcommand
87 """
88
77 #-----------------------------------------------------------------------------
89 #-----------------------------------------------------------------------------
78 # Profile Application Class (for `ipython profile` subcommand)
90 # Profile Application Class (for `ipython profile` subcommand)
79 #-----------------------------------------------------------------------------
91 #-----------------------------------------------------------------------------
@@ -82,6 +94,7 b' where you can edit ipython_config.py to start configuring IPython.'
82 class ProfileList(Application):
94 class ProfileList(Application):
83 name = u'ipython-profile'
95 name = u'ipython-profile'
84 description = list_help
96 description = list_help
97 examples = _list_examples
85
98
86 aliases = Dict({
99 aliases = Dict({
87 'ipython-dir' : 'ProfileList.ipython_dir',
100 'ipython-dir' : 'ProfileList.ipython_dir',
@@ -92,6 +105,7 b' class ProfileList(Application):'
92 "Set Application.log_level to 0, maximizing log output."
105 "Set Application.log_level to 0, maximizing log output."
93 )
106 )
94 ))
107 ))
108
95 ipython_dir = Unicode(get_ipython_dir(), config=True,
109 ipython_dir = Unicode(get_ipython_dir(), config=True,
96 help="""
110 help="""
97 The name of the IPython directory. This directory is used for logging
111 The name of the IPython directory. This directory is used for logging
@@ -127,15 +141,11 b" create_flags.update(boolean_flag('parallel', 'ProfileCreate.parallel',"
127 "Include parallel computing config files",
141 "Include parallel computing config files",
128 "Don't include parallel computing config files"))
142 "Don't include parallel computing config files"))
129
143
130 create_examples = """
131 ipython profile create foo # create profile foo
132 ipython profile create foo --init # create with default config files
133 """
134
144
135 class ProfileCreate(BaseIPythonApplication):
145 class ProfileCreate(BaseIPythonApplication):
136 name = u'ipython-profile'
146 name = u'ipython-profile'
137 description = create_help
147 description = create_help
138 examples = create_examples
148 examples = _create_examples
139 auto_create = Bool(True, config=False)
149 auto_create = Bool(True, config=False)
140
150
141 def _copy_config_files_default(self):
151 def _copy_config_files_default(self):
@@ -204,15 +214,11 b' class ProfileCreate(BaseIPythonApplication):'
204 def stage_default_config_file(self):
214 def stage_default_config_file(self):
205 pass
215 pass
206
216
207 main_examples = """
208 ipython profile create -h # show the help string for the create subcommand
209 ipython profile list -h # show the help string for the list subcommand
210 """
211
217
212 class ProfileApp(Application):
218 class ProfileApp(Application):
213 name = u'ipython-profile'
219 name = u'ipython-profile'
214 description = profile_help
220 description = profile_help
215 examples = main_examples
221 examples = _main_examples
216
222
217 subcommands = Dict(dict(
223 subcommands = Dict(dict(
218 create = (ProfileCreate, "Create a new profile dir with default config files"),
224 create = (ProfileCreate, "Create a new profile dir with default config files"),
@@ -53,6 +53,15 b' from IPython.zmq.zmqshell import ZMQInteractiveShell'
53 from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS
53 from IPython.utils.localinterfaces import LOCALHOST, LOCAL_IPS
54
54
55 #-----------------------------------------------------------------------------
55 #-----------------------------------------------------------------------------
56 # Globals
57 #-----------------------------------------------------------------------------
58
59 _examples = """
60 ipython qtconsole # start the qtconsole
61 ipython qtconsole --pylab=inline # start with pylab in inline plotting mode
62 """
63
64 #-----------------------------------------------------------------------------
56 # Classes
65 # Classes
57 #-----------------------------------------------------------------------------
66 #-----------------------------------------------------------------------------
58
67
@@ -219,10 +228,6 b' aliases.update(dict('
219 # IPythonQtConsole
228 # IPythonQtConsole
220 #-----------------------------------------------------------------------------
229 #-----------------------------------------------------------------------------
221
230
222 qt_examples = """
223 ipython qtconsole # start the qtconsole
224 ipython qtconsole --pylab=inline # start with pylab in inline plotting mode
225 """
226
231
227 class IPythonQtConsoleApp(BaseIPythonApplication):
232 class IPythonQtConsoleApp(BaseIPythonApplication):
228 name = 'ipython-qtconsole'
233 name = 'ipython-qtconsole'
@@ -237,7 +242,7 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
237 The QtConsole supports various extra features beyond the
242 The QtConsole supports various extra features beyond the
238
243
239 """
244 """
240 examples = qt_examples
245 examples = _examples
241
246
242 classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir, Session]
247 classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir, Session]
243 flags = Dict(flags)
248 flags = Dict(flags)
@@ -58,6 +58,15 b' from IPython.utils.traitlets import ('
58 #: The default config file name for this application.
58 #: The default config file name for this application.
59 default_config_file_name = u'ipython_config.py'
59 default_config_file_name = u'ipython_config.py'
60
60
61 _examples = """
62 ipython --pylab # start in pylab mode
63 ipython --pylab=qt # start in pylab mode with the qt4 backend
64 ipython --log_level=DEBUG # set logging to DEBUG
65 ipython --profile=foo # start with profile foo
66 ipython qtconsole # start the qtconsole GUI application
67 ipython profile -h # show the help string for the profile subcmd
68 ipython qtconsole -h # show the help string for the qtconsole subcmd
69 """
61
70
62 #-----------------------------------------------------------------------------
71 #-----------------------------------------------------------------------------
63 # Crash handler for this application
72 # Crash handler for this application
@@ -168,22 +177,13 b' aliases.update(dict('
168 # Main classes and functions
177 # Main classes and functions
169 #-----------------------------------------------------------------------------
178 #-----------------------------------------------------------------------------
170
179
171 examples = """
172 ipython --pylab # start in pylab mode
173 ipython --pylab=qt # start in pylab mode with the qt4 backend
174 ipython --log_level=DEBUG # set logging to DEBUG
175 ipython --profile=foo # start with profile foo
176 ipython qtconsole # start the qtconsole GUI application
177 ipython profile -h # show the help string for the profile subcmd
178 ipython qtconsole -h # show the help string for the qtconsole subcmd
179 """
180
180
181 class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
181 class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
182 name = u'ipython'
182 name = u'ipython'
183 description = usage.cl_usage
183 description = usage.cl_usage
184 default_config_file_name = default_config_file_name
184 default_config_file_name = default_config_file_name
185 crash_handler_class = IPAppCrashHandler
185 crash_handler_class = IPAppCrashHandler
186 examples = examples
186 examples = _examples
187
187
188 flags = Dict(flags)
188 flags = Dict(flags)
189 aliases = Dict(aliases)
189 aliases = Dict(aliases)
@@ -61,9 +61,28 b' An IPython cluster consists of 1 controller and 1 or more engines.'
61 This command automates the startup of these processes using a wide
61 This command automates the startup of these processes using a wide
62 range of startup methods (SSH, local processes, PBS, mpiexec,
62 range of startup methods (SSH, local processes, PBS, mpiexec,
63 Windows HPC Server 2008). To start a cluster with 4 engines on your
63 Windows HPC Server 2008). To start a cluster with 4 engines on your
64 local host simply do 'ipcluster start n=4'. For more complex usage
64 local host simply do 'ipcluster start --n=4'. For more complex usage
65 you will typically do 'ipcluster create profile=mycluster', then edit
65 you will typically do 'ipython create mycluster --parallel', then edit
66 configuration files, followed by 'ipcluster start profile=mycluster n=4'.
66 configuration files, followed by 'ipcluster start --profile=mycluster --n=4'.
67 """
68
69 _main_examples = """
70 ipcluster start -h # show the help string for the start subcmd
71 ipcluster stop -h # show the help string for the stop subcmd
72 ipcluster engines -h # show the help string for the engines subcmd
73 """
74
75 _start_examples = """
76 ipython profile create mycluster --parallel # create mycluster profile
77 ipcluster start --profile=mycluster --n=4 # start mycluster with 4 nodes
78 """
79
80 _stop_examples = """
81 ipcluster stop --profile=mycluster # stop a running cluster by profile name
82 """
83
84 _engines_examples = """
85 ipcluster engines --profile=mycluster --n=4 # start 4 engines only
67 """
86 """
68
87
69
88
@@ -126,6 +145,7 b' stop_aliases.update(base_aliases)'
126 class IPClusterStop(BaseParallelApplication):
145 class IPClusterStop(BaseParallelApplication):
127 name = u'ipcluster'
146 name = u'ipcluster'
128 description = stop_help
147 description = stop_help
148 examples = _stop_examples
129 config_file_name = Unicode(default_config_file_name)
149 config_file_name = Unicode(default_config_file_name)
130
150
131 signal = Int(signal.SIGINT, config=True,
151 signal = Int(signal.SIGINT, config=True,
@@ -195,6 +215,7 b' class IPClusterEngines(BaseParallelApplication):'
195
215
196 name = u'ipcluster'
216 name = u'ipcluster'
197 description = engines_help
217 description = engines_help
218 examples = _engines_examples
198 usage = None
219 usage = None
199 config_file_name = Unicode(default_config_file_name)
220 config_file_name = Unicode(default_config_file_name)
200 default_log_level = logging.INFO
221 default_log_level = logging.INFO
@@ -329,6 +350,7 b' class IPClusterStart(IPClusterEngines):'
329
350
330 name = u'ipcluster'
351 name = u'ipcluster'
331 description = start_help
352 description = start_help
353 examples = _start_examples
332 default_log_level = logging.INFO
354 default_log_level = logging.INFO
333 auto_create = Bool(True, config=True,
355 auto_create = Bool(True, config=True,
334 help="whether to create the profile_dir if it doesn't exist")
356 help="whether to create the profile_dir if it doesn't exist")
@@ -426,6 +448,7 b" base='IPython.parallel.apps.ipclusterapp.IPCluster'"
426 class IPClusterApp(Application):
448 class IPClusterApp(Application):
427 name = u'ipcluster'
449 name = u'ipcluster'
428 description = _description
450 description = _description
451 examples = _main_examples
429
452
430 subcommands = {
453 subcommands = {
431 'start' : (base+'Start', start_help),
454 'start' : (base+'Start', start_help),
@@ -85,7 +85,10 b' your ipython directory and named as "profile_name". See the `profile`'
85 and `profile_dir` options for details.
85 and `profile_dir` options for details.
86 """
86 """
87
87
88
88 _examples = """
89 ipcontroller --ip=192.168.0.1 --port=1000 # listen on ip, port for engines
90 ipcontroller --scheme=pure # use the pure zeromq scheduler
91 """
89
92
90
93
91 #-----------------------------------------------------------------------------
94 #-----------------------------------------------------------------------------
@@ -131,10 +134,12 b' aliases = dict('
131 )
134 )
132 aliases.update(base_aliases)
135 aliases.update(base_aliases)
133
136
137
134 class IPControllerApp(BaseParallelApplication):
138 class IPControllerApp(BaseParallelApplication):
135
139
136 name = u'ipcontroller'
140 name = u'ipcontroller'
137 description = _description
141 description = _description
142 examples = _examples
138 config_file_name = Unicode(default_config_file_name)
143 config_file_name = Unicode(default_config_file_name)
139 classes = [ProfileDir, Session, HubFactory, TaskScheduler, HeartMonitor, SQLiteDB] + maybe_mongo
144 classes = [ProfileDir, Session, HubFactory, TaskScheduler, HeartMonitor, SQLiteDB] + maybe_mongo
140
145
@@ -64,6 +64,10 b' usually located in your ipython directory and named as "profile_name".'
64 See the `profile` and `profile_dir` options for details.
64 See the `profile` and `profile_dir` options for details.
65 """
65 """
66
66
67 _examples = """
68 ipengine --ip=192.168.0.1 --port=1000 # connect to hub at ip and port
69 ipengine --log_to_file --log_level=DEBUG # log to a file with DEBUG verbosity
70 """
67
71
68 #-----------------------------------------------------------------------------
72 #-----------------------------------------------------------------------------
69 # MPI configuration
73 # MPI configuration
@@ -126,10 +130,12 b' aliases = dict('
126 )
130 )
127 aliases.update(base_aliases)
131 aliases.update(base_aliases)
128
132
133
129 class IPEngineApp(BaseParallelApplication):
134 class IPEngineApp(BaseParallelApplication):
130
135
131 name = Unicode(u'ipengine')
136 name = Unicode(u'ipengine')
132 description = Unicode(_description)
137 description = Unicode(_description)
138 examples = _examples
133 config_file_name = Unicode(default_config_file_name)
139 config_file_name = Unicode(default_config_file_name)
134 classes = List([ProfileDir, Session, EngineFactory, Kernel, MPI])
140 classes = List([ProfileDir, Session, EngineFactory, Kernel, MPI])
135
141
General Comments 0
You need to be logged in to leave comments. Login now