##// 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 90 # Profile Application Class (for `ipython profile` subcommand)
79 91 #-----------------------------------------------------------------------------
@@ -82,7 +94,8 b' where you can edit ipython_config.py to start configuring IPython.'
82 94 class ProfileList(Application):
83 95 name = u'ipython-profile'
84 96 description = list_help
85
97 examples = _list_examples
98
86 99 aliases = Dict({
87 100 'ipython-dir' : 'ProfileList.ipython_dir',
88 101 'log-level' : 'Application.log_level',
@@ -92,6 +105,7 b' class ProfileList(Application):'
92 105 "Set Application.log_level to 0, maximizing log output."
93 106 )
94 107 ))
108
95 109 ipython_dir = Unicode(get_ipython_dir(), config=True,
96 110 help="""
97 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 141 "Include parallel computing config files",
128 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 145 class ProfileCreate(BaseIPythonApplication):
136 146 name = u'ipython-profile'
137 147 description = create_help
138 examples = create_examples
148 examples = _create_examples
139 149 auto_create = Bool(True, config=False)
140 150
141 151 def _copy_config_files_default(self):
@@ -204,15 +214,11 b' class ProfileCreate(BaseIPythonApplication):'
204 214 def stage_default_config_file(self):
205 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 218 class ProfileApp(Application):
213 219 name = u'ipython-profile'
214 220 description = profile_help
215 examples = main_examples
221 examples = _main_examples
216 222
217 223 subcommands = Dict(dict(
218 224 create = (ProfileCreate, "Create a new profile dir with default config files"),
@@ -53,6 +53,15 b' from IPython.zmq.zmqshell import ZMQInteractiveShell'
53 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 65 # Classes
57 66 #-----------------------------------------------------------------------------
58 67
@@ -219,10 +228,6 b' aliases.update(dict('
219 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 232 class IPythonQtConsoleApp(BaseIPythonApplication):
228 233 name = 'ipython-qtconsole'
@@ -237,7 +242,7 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
237 242 The QtConsole supports various extra features beyond the
238 243
239 244 """
240 examples = qt_examples
245 examples = _examples
241 246
242 247 classes = [IPKernelApp, IPythonWidget, ZMQInteractiveShell, ProfileDir, Session]
243 248 flags = Dict(flags)
@@ -58,6 +58,15 b' from IPython.utils.traitlets import ('
58 58 #: The default config file name for this application.
59 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 72 # Crash handler for this application
@@ -168,22 +177,13 b' aliases.update(dict('
168 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 181 class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):
182 182 name = u'ipython'
183 183 description = usage.cl_usage
184 184 default_config_file_name = default_config_file_name
185 185 crash_handler_class = IPAppCrashHandler
186 examples = examples
186 examples = _examples
187 187
188 188 flags = Dict(flags)
189 189 aliases = Dict(aliases)
@@ -61,9 +61,28 b' An IPython cluster consists of 1 controller and 1 or more engines.'
61 61 This command automates the startup of these processes using a wide
62 62 range of startup methods (SSH, local processes, PBS, mpiexec,
63 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
65 you will typically do 'ipcluster create profile=mycluster', then edit
66 configuration files, followed by 'ipcluster start profile=mycluster n=4'.
64 local host simply do 'ipcluster start --n=4'. For more complex usage
65 you will typically do 'ipython create mycluster --parallel', then edit
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 145 class IPClusterStop(BaseParallelApplication):
127 146 name = u'ipcluster'
128 147 description = stop_help
148 examples = _stop_examples
129 149 config_file_name = Unicode(default_config_file_name)
130 150
131 151 signal = Int(signal.SIGINT, config=True,
@@ -195,6 +215,7 b' class IPClusterEngines(BaseParallelApplication):'
195 215
196 216 name = u'ipcluster'
197 217 description = engines_help
218 examples = _engines_examples
198 219 usage = None
199 220 config_file_name = Unicode(default_config_file_name)
200 221 default_log_level = logging.INFO
@@ -329,6 +350,7 b' class IPClusterStart(IPClusterEngines):'
329 350
330 351 name = u'ipcluster'
331 352 description = start_help
353 examples = _start_examples
332 354 default_log_level = logging.INFO
333 355 auto_create = Bool(True, config=True,
334 356 help="whether to create the profile_dir if it doesn't exist")
@@ -426,7 +448,8 b" base='IPython.parallel.apps.ipclusterapp.IPCluster'"
426 448 class IPClusterApp(Application):
427 449 name = u'ipcluster'
428 450 description = _description
429
451 examples = _main_examples
452
430 453 subcommands = {
431 454 'start' : (base+'Start', start_help),
432 455 'stop' : (base+'Stop', stop_help),
@@ -85,7 +85,10 b' your ipython directory and named as "profile_name". See the `profile`'
85 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 135 aliases.update(base_aliases)
133 136
137
134 138 class IPControllerApp(BaseParallelApplication):
135 139
136 140 name = u'ipcontroller'
137 141 description = _description
142 examples = _examples
138 143 config_file_name = Unicode(default_config_file_name)
139 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 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 73 # MPI configuration
@@ -126,10 +130,12 b' aliases = dict('
126 130 )
127 131 aliases.update(base_aliases)
128 132
133
129 134 class IPEngineApp(BaseParallelApplication):
130 135
131 136 name = Unicode(u'ipengine')
132 137 description = Unicode(_description)
138 examples = _examples
133 139 config_file_name = Unicode(default_config_file_name)
134 140 classes = List([ProfileDir, Session, EngineFactory, Kernel, MPI])
135 141
General Comments 0
You need to be logged in to leave comments. Login now