##// END OF EJS Templates
Merge pull request #9907 from Carreau/docs-py-2...
Min RK -
r22861:f9c232f9 merge
parent child Browse files
Show More
@@ -1,284 +1,298 b''
1 1 # -*- coding: utf-8 -*-
2 2 #
3 3 # IPython documentation build configuration file.
4 4
5 5 # NOTE: This file has been edited manually from the auto-generated one from
6 6 # sphinx. Do NOT delete and re-generate. If any changes from sphinx are
7 7 # needed, generate a scratch one and merge by hand any new fields needed.
8 8
9 9 #
10 10 # This file is execfile()d with the current directory set to its containing dir.
11 11 #
12 12 # The contents of this file are pickled, so don't put values in the namespace
13 13 # that aren't pickleable (module imports are okay, they're removed automatically).
14 14 #
15 15 # All configuration values have a default value; values that are commented out
16 16 # serve to show the default value.
17 17
18 18 import sys, os
19 19
20 20 ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'
21 21
22 22 if ON_RTD:
23 23 # Mock the presence of matplotlib, which we don't have on RTD
24 24 # see
25 25 # http://read-the-docs.readthedocs.io/en/latest/faq.html
26 26 tags.add('rtd')
27 27
28 28 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
29 29 for name in ('config', 'api', 'magics', 'shortcuts'):
30 30 fname = 'autogen_{}.py'.format(name)
31 31 fpath = os.path.abspath(os.path.join('..', fname))
32 32 with open(fpath) as f:
33 33 exec(compile(f.read(), fname, 'exec'), {
34 34 '__file__': fpath,
35 35 '__name__': '__main__',
36 36 })
37 37 else:
38 38 import sphinx_rtd_theme
39 39 html_theme = "sphinx_rtd_theme"
40 40 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
41 41
42 42 # If your extensions are in another directory, add it here. If the directory
43 43 # is relative to the documentation root, use os.path.abspath to make it
44 44 # absolute, like shown here.
45 45 sys.path.insert(0, os.path.abspath('../sphinxext'))
46 46
47 47 # We load the ipython release info into a dict by explicit execution
48 48 iprelease = {}
49 49 exec(compile(open('../../IPython/core/release.py').read(), '../../IPython/core/release.py', 'exec'),iprelease)
50 50
51 51 # General configuration
52 52 # ---------------------
53 53
54 54 # Add any Sphinx extension module names here, as strings. They can be extensions
55 55 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
56 56 extensions = [
57 57 'matplotlib.sphinxext.mathmpl',
58 58 'matplotlib.sphinxext.only_directives',
59 59 'matplotlib.sphinxext.plot_directive',
60 60 'sphinx.ext.autodoc',
61 61 'sphinx.ext.autosummary',
62 62 'sphinx.ext.doctest',
63 63 'sphinx.ext.inheritance_diagram',
64 64 'sphinx.ext.intersphinx',
65 65 'IPython.sphinxext.ipython_console_highlighting',
66 66 'IPython.sphinxext.ipython_directive',
67 67 'sphinx.ext.napoleon', # to preprocess docstrings
68 68 'github', # for easy GitHub links
69 69 'magics',
70 70 ]
71 71
72 72 if ON_RTD:
73 73 # Remove extensions not currently supported on RTD
74 74 extensions.remove('matplotlib.sphinxext.only_directives')
75 75 extensions.remove('matplotlib.sphinxext.mathmpl')
76 76 extensions.remove('matplotlib.sphinxext.plot_directive')
77 77 extensions.remove('IPython.sphinxext.ipython_directive')
78 78 extensions.remove('IPython.sphinxext.ipython_console_highlighting')
79 79
80 80 # Add any paths that contain templates here, relative to this directory.
81 81 templates_path = ['_templates']
82 82
83 83 # The suffix of source filenames.
84 84 source_suffix = '.rst'
85 85
86 rst_prolog = ''
87
86 88 def is_stable(extra):
87 89 for ext in {'dev', 'b', 'rc'}:
88 90 if ext in extra:
89 91 return False
90 92 return True
91 93
92 94 if is_stable(iprelease['_version_extra']):
93 95 tags.add('ipystable')
94 96 else:
95 97 tags.add('ipydev')
96 rst_prolog = """
97 .. warning::
98 rst_prolog += """
99 .. warning::
100
101 This documentation covers a development version of IPython. The development
102 version may differ significantly from the latest stable release.
103 """
104
105 rst_prolog += """
106 .. important::
107
108 This documentation covers IPython versions 6.0 and higher. Beginning with
109 version 6.0, IPython stopped supporting compatibility with Python versions
110 lower than 3.3 including all versions of Python 2.7.
98 111
99 This documentation is for a development version of IPython. There may be
100 significant differences from the latest stable release.
112 If you are looking for an IPython version compatible with Python 2.7,
113 please use the IPython 5.x LTS release and refer to its documentation (LTS
114 is the long term support release).
101 115
102 """
116 """
103 117
104 118 # The master toctree document.
105 119 master_doc = 'index'
106 120
107 121 # General substitutions.
108 122 project = 'IPython'
109 123 copyright = 'The IPython Development Team'
110 124
111 125 # ghissue config
112 126 github_project_url = "https://github.com/ipython/ipython"
113 127
114 128 # numpydoc config
115 129 numpydoc_show_class_members = False # Otherwise Sphinx emits thousands of warnings
116 130 numpydoc_class_members_toctree = False
117 131
118 132 # The default replacements for |version| and |release|, also used in various
119 133 # other places throughout the built documents.
120 134 #
121 135 # The full version, including alpha/beta/rc tags.
122 136 release = "%s" % iprelease['version']
123 137 # Just the X.Y.Z part, no '-dev'
124 138 version = iprelease['version'].split('-', 1)[0]
125 139
126 140
127 141 # There are two options for replacing |today|: either, you set today to some
128 142 # non-false value, then it is used:
129 143 #today = ''
130 144 # Else, today_fmt is used as the format for a strftime call.
131 145 today_fmt = '%B %d, %Y'
132 146
133 147 # List of documents that shouldn't be included in the build.
134 148 #unused_docs = []
135 149
136 150 # Exclude these glob-style patterns when looking for source files. They are
137 151 # relative to the source/ directory.
138 152 exclude_patterns = ['whatsnew/pr']
139 153
140 154
141 155 # If true, '()' will be appended to :func: etc. cross-reference text.
142 156 #add_function_parentheses = True
143 157
144 158 # If true, the current module name will be prepended to all description
145 159 # unit titles (such as .. function::).
146 160 #add_module_names = True
147 161
148 162 # If true, sectionauthor and moduleauthor directives will be shown in the
149 163 # output. They are ignored by default.
150 164 #show_authors = False
151 165
152 166 # The name of the Pygments (syntax highlighting) style to use.
153 167 pygments_style = 'sphinx'
154 168
155 169 # Set the default role so we can use `foo` instead of ``foo``
156 170 default_role = 'literal'
157 171
158 172 # Options for HTML output
159 173 # -----------------------
160 174
161 175 # The style sheet to use for HTML and HTML Help pages. A file of that name
162 176 # must exist either in Sphinx' static/ path, or in one of the custom paths
163 177 # given in html_static_path.
164 178 # html_style = 'default.css'
165 179
166 180
167 181 # The name for this set of Sphinx documents. If None, it defaults to
168 182 # "<project> v<release> documentation".
169 183 #html_title = None
170 184
171 185 # The name of an image file (within the static path) to place at the top of
172 186 # the sidebar.
173 187 #html_logo = None
174 188
175 189 # Add any paths that contain custom static files (such as style sheets) here,
176 190 # relative to this directory. They are copied after the builtin static files,
177 191 # so a file named "default.css" will overwrite the builtin "default.css".
178 192 html_static_path = ['_static']
179 193
180 194 # Favicon needs the directory name
181 195 html_favicon = '_static/favicon.ico'
182 196 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
183 197 # using the given strftime format.
184 198 html_last_updated_fmt = '%b %d, %Y'
185 199
186 200 # If true, SmartyPants will be used to convert quotes and dashes to
187 201 # typographically correct entities.
188 202 #html_use_smartypants = True
189 203
190 204 # Custom sidebar templates, maps document names to template names.
191 205 #html_sidebars = {}
192 206
193 207 # Additional templates that should be rendered to pages, maps page names to
194 208 # template names.
195 209 html_additional_pages = {
196 210 'interactive/htmlnotebook': 'notebook_redirect.html',
197 211 'interactive/notebook': 'notebook_redirect.html',
198 212 'interactive/nbconvert': 'notebook_redirect.html',
199 213 'interactive/public_server': 'notebook_redirect.html',
200 214 }
201 215
202 216 # If false, no module index is generated.
203 217 #html_use_modindex = True
204 218
205 219 # If true, the reST sources are included in the HTML build as _sources/<name>.
206 220 #html_copy_source = True
207 221
208 222 # If true, an OpenSearch description file will be output, and all pages will
209 223 # contain a <link> tag referring to it. The value of this option must be the
210 224 # base URL from which the finished HTML is served.
211 225 #html_use_opensearch = ''
212 226
213 227 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
214 228 #html_file_suffix = ''
215 229
216 230 # Output file base name for HTML help builder.
217 231 htmlhelp_basename = 'ipythondoc'
218 232
219 233 intersphinx_mapping = {'python': ('https://docs.python.org/3/', None),
220 234 'rpy2': ('https://rpy2.readthedocs.io/en/version_2.8.x/', None),
221 235 'traitlets': ('https://traitlets.readthedocs.io/en/latest/', None),
222 236 'jupyterclient': ('https://jupyter-client.readthedocs.io/en/latest/', None),
223 237 'ipyparallel': ('https://ipyparallel.readthedocs.io/en/latest/', None),
224 238 'jupyter': ('https://jupyter.readthedocs.io/en/latest/', None),
225 239 }
226 240
227 241 # Options for LaTeX output
228 242 # ------------------------
229 243
230 244 # The paper size ('letter' or 'a4').
231 245 latex_paper_size = 'letter'
232 246
233 247 # The font size ('10pt', '11pt' or '12pt').
234 248 latex_font_size = '11pt'
235 249
236 250 # Grouping the document tree into LaTeX files. List of tuples
237 251 # (source start file, target name, title, author, document class [howto/manual]).
238 252
239 253 latex_documents = [
240 254 ('index', 'ipython.tex', 'IPython Documentation',
241 255 u"""The IPython Development Team""", 'manual', True),
242 256 ('parallel/winhpc_index', 'winhpc_whitepaper.tex',
243 257 'Using IPython on Windows HPC Server 2008',
244 258 u"Brian E. Granger", 'manual', True)
245 259 ]
246 260
247 261 # The name of an image file (relative to this directory) to place at the top of
248 262 # the title page.
249 263 #latex_logo = None
250 264
251 265 # For "manual" documents, if this is true, then toplevel headings are parts,
252 266 # not chapters.
253 267 #latex_use_parts = False
254 268
255 269 # Additional stuff for the LaTeX preamble.
256 270 #latex_preamble = ''
257 271
258 272 # Documents to append as an appendix to all manuals.
259 273 #latex_appendices = []
260 274
261 275 # If false, no module index is generated.
262 276 latex_use_modindex = True
263 277
264 278
265 279 # Options for texinfo output
266 280 # --------------------------
267 281
268 282 texinfo_documents = [
269 283 (master_doc, 'ipython', 'IPython Documentation',
270 284 'The IPython Development Team',
271 285 'IPython',
272 286 'IPython Documentation',
273 287 'Programming',
274 288 1),
275 289 ]
276 290
277 291 modindex_common_prefix = ['IPython.']
278 292
279 293
280 294 # Cleanup
281 295 # -------
282 296 # delete release info to avoid pickling errors from sphinx
283 297
284 298 del iprelease
@@ -1,246 +1,252 b''
1 1 .. _release_process:
2 2
3 3 =======================
4 4 IPython release process
5 5 =======================
6 6
7 7 This document contains the process that is used to create an IPython release.
8 8
9 9 Conveniently, the ``release`` script in the ``tools`` directory of the ``IPython``
10 10 repository automates most of the release process. This document serves as a
11 11 handy reminder and checklist for the release manager.
12 12
13 13 During the release process, you might need the extra following dependencies:
14 14
15 15 - ``keyring`` to access your GitHub authentication tokens
16 16 - ``graphviz`` to generate some graphs in the documentation
17 17
18 18 Make sure you have all the required dependencies to run the tests as well.
19 19
20 20
21 21 1. Set Environment variables
22 22 ----------------------------
23 23
24 24 Set environment variables to document previous release tag, current
25 25 release milestone, current release version, and git tag.
26 26
27 27 These variables may be used later to copy/paste as answers to the script
28 28 questions instead of typing the appropriate command when the time comes. These
29 29 variables are not used by the scripts directly; therefore, there is no need to
30 30 ``export`` them. The format for bash is as follows, but note that these values
31 31 are just an example valid only for the 5.0 release; you'll need to update them
32 32 for the release you are actually making::
33 33
34 34 PREV_RELEASE=4.2.1
35 35 MILESTONE=5.0
36 36 VERSION=5.0.0
37 37 BRANCH=master
38 38
39 39
40 40 2. Create GitHub stats and finish release note
41 41 ----------------------------------------------
42 42
43 43 .. note::
44 44
45 45 This step is optional if making a Beta or RC release.
46 46
47 47 .. note::
48 48
49 49 Before generating the GitHub stats, verify that all closed issues and pull
50 50 requests have `appropriate milestones
51 51 <https://github.com/ipython/ipython/wiki/Dev%3A-GitHub-workflow#milestones>`_.
52 52 `This search
53 53 <https://github.com/ipython/ipython/issues?q=is%3Aclosed+no%3Amilestone+is%3Aissue>`_
54 54 should return no results before creating the GitHub stats.
55 55
56 56 If a major release:
57 57
58 58 - merge any pull request notes into what's new::
59 59
60 60 python tools/update_whatsnew.py
61 61
62 62 - update ``docs/source/whatsnew/development.rst``, to ensure it covers
63 63 the major release features
64 64
65 65 - move the contents of ``development.rst`` to ``versionX.rst`` where ``X`` is
66 66 the numerical release version
67 67
68 68 - generate summary of GitHub contributions, which can be done with::
69 69
70 70 python tools/github_stats.py --milestone $MILESTONE > stats.rst
71 71
72 72 which may need some manual cleanup of ``stats.rst``. Add the cleaned
73 73 ``stats.rst`` results to ``docs/source/whatsnew/github-stats-X.rst``
74 74 where ``X`` is the numerical release version (don't forget to add it to
75 75 the git repo as well). If creating a major release, make a new
76 76 ``github-stats-X.rst`` file; if creating a minor release, the content
77 77 from ``stats.rst`` may simply be added to the top of an existing
78 78 ``github-stats-X.rst`` file. Finally, edit
79 79 ``docs/source/whatsnew/index.rst`` to list the new ``github-stats-X``
80 80 file you just created and remove temporarily the first entry called
81 81 ``development`` (you'll need to add it back after release).
82 82
83 83 Make sure that the stats file has a header or it won't be rendered in
84 84 the final documentation.
85 85
86 86 To find duplicates and update `.mailmap`, use::
87 87
88 88 git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f
89 89
90 90 3. Make sure the repository is clean
91 91 ------------------------------------
92 92
93 93 of any file that could be problematic.
94 94 Remove all non-tracked files with:
95 95
96 96 .. code::
97 97
98 98 git clean -xfdi
99 99
100 100 This will ask for confirmation before removing all untracked files. Make
101 101 sure the ``dist/`` folder is clean to avoid any stale builds from
102 102 previous build attempts.
103 103
104 104
105 105 4. Update the release version number
106 106 ------------------------------------
107 107
108 108 Edit ``IPython/core/release.py`` to have the current version.
109 109
110 110 in particular, update version number and ``_version_extra`` content in
111 111 ``IPython/core/release.py``.
112 112
113 113 Step 5 will validate your changes automatically, but you might still want to
114 114 make sure the version number matches pep440.
115 115
116 116 In particular, ``rc`` and ``beta`` are not separated by ``.`` or the ``sdist``
117 117 and ``bdist`` will appear as different releases. For example, a valid version
118 118 number for a release candidate (rc) release is: ``1.3rc1``. Notice that there
119 119 is no separator between the '3' and the 'r'. Check the environment variable
120 120 ``$VERSION`` as well.
121 121
122 122 You will likely just have to modify/comment/uncomment one of the lines setting
123 123 ``_version_extra``
124 124
125 125
126 126 5. Run the `tools/build_release` script
127 127 ---------------------------------------
128 128
129 129 Running ``tools/build_release`` does all the file checking and building that
130 130 the real release script will do. This makes test installations, checks that
131 131 the build procedure runs OK, and tests other steps in the release process.
132 132
133 133 The ``build_release`` script will in particular verify that the version number
134 134 match PEP 440, in order to avoid surprise at the time of build upload.
135 135
136 136 We encourage creating a test build of the docs as well.
137 137
138 138 6. Create and push the new tag
139 139 ------------------------------
140 140
141 141 Commit the changes to release.py::
142 142
143 143 git commit -am "release $VERSION"
144 144 git push origin $BRANCH
145 145
146 146 Create and push the tag::
147 147
148 148 git tag -am "release $VERSION" "$VERSION"
149 149 git push origin --tags
150 150
151 151 Update release.py back to ``x.y-dev`` or ``x.y-maint``, and re-add the
152 152 ``development`` entry in ``docs/source/whatsnew/index.rst`` and push::
153 153
154 154 git commit -am "back to development"
155 155 git push origin $BRANCH
156 156
157 157 7. Get a fresh clone
158 158 --------------------
159 159
160 160 Get a fresh clone of the tag for building the release::
161 161
162 162 cd /tmp
163 163 git clone --depth 1 https://github.com/ipython/ipython.git -b "$VERSION"
164 164 cd ipython
165 165
166 166 .. note::
167 167
168 168 You can aslo cleanup the current working repository with ``git clean -xfdi``
169 169
170 170 8. Run the release script
171 171 -------------------------
172 172
173 .. important::
174
175 These steps cover instructions for creating releases of IPython 5.x LTS and
176 IPython 6.x. Ignore release steps for Python 2 when releasing IPython 6.x
177 which no longer supports Python 2.
178
173 179 Run the ``release`` script, this step requires having a current wheel, Python
174 180 >=3.4 and Python 2.7.::
175 181
176 182 ./tools/release
177 183
178 184 This makes the tarballs and wheels, and puts them under the ``dist/``
179 185 folder. Be sure to test the ``wheels`` and the ``sdist`` locally before
180 186 uploading them to PyPI. We do not use an universal wheel as each wheel
181 187 installs an ``ipython2`` or ``ipython3`` script, depending on the version of
182 188 Python it is built for. Using an universal wheel would prevent this.
183 189
184 190 Use the following to actually upload the result of the build::
185 191
186 192 ./tools/release upload
187 193
188 194 It should posts them to ``archive.ipython.org``.
189 195
190 196 You will need to use `twine <https://github.com/pypa/twine>`_ ) manually to
191 197 actually upload on PyPI. Unlike setuptools, twine is able to upload packages
192 over SSL.
198 over SSL::
193 199
194 200 twine upload dist/*
195 201
196 202
197 203 PyPI/Warehouse will automatically hide previous releases. If you are uploading
198 204 a non-stable version, make sure to log-in to PyPI and un-hide previous version.
199 205
200 206
201 207 9. Draft a short release announcement
202 208 -------------------------------------
203 209
204 210 The announcement should include:
205 211
206 212 - release highlights
207 213 - a link to the html version of the *What's new* section of the documentation
208 214 - a link to upgrade or installation tips (if necessary)
209 215
210 216 Post the announcement to the mailing list and or blog, and link from Twitter.
211 217
212 218 .. note::
213 219
214 220 If you are doing a RC or Beta, you can likely skip the next steps.
215 221
216 222 10. Update milestones on GitHub
217 223 -------------------------------
218 224
219 225 These steps will bring milestones up to date:
220 226
221 227 - close the just released milestone
222 228 - open a new milestone for the next release (x, y+1), if the milestone doesn't
223 229 exist already
224 230
225 231 11. Update the IPython website
226 232 ------------------------------
227 233
228 234 The IPython website should document the new release:
229 235
230 236 - add release announcement (news, announcements)
231 237 - update current version and download links
232 238 - update links on the documentation page (especially if a major release)
233 239
234 240 12. Update readthedocs
235 241 ----------------------
236 242
237 243 Make sure to update readthedocs and set the latest tag as stable, as well as
238 244 checking that previous release is still building under its own tag.
239 245
240 246
241 247 13. Celebrate!
242 248 --------------
243 249
244 250 Celebrate the release and please thank the contributors for their work. Great
245 251 job!
246 252
@@ -1,255 +1,256 b''
1 1 .. _overview:
2 2
3 3 ========
4 4 Overview
5 5 ========
6 6
7 7 One of Python's most useful features is its interactive interpreter.
8 8 It allows for very fast testing of ideas without the overhead of
9 9 creating test files as is typical in most programming languages.
10 10 However, the interpreter supplied with the standard Python distribution
11 11 is somewhat limited for extended interactive use.
12 12
13 13 The goal of IPython is to create a comprehensive environment for
14 14 interactive and exploratory computing. To support this goal, IPython
15 15 has three main components:
16 16
17 17 * An enhanced interactive Python shell.
18 18
19 19 * A decoupled :ref:`two-process communication model <ipythonzmq>`, which
20 20 allows for multiple clients to connect to a computation kernel, most notably
21 21 the web-based notebook provided with `Jupyter <https://jupyter.org>`_.
22 22
23 23 * An architecture for interactive parallel computing now part of the
24 24 `ipyparallel` package.
25 25
26 26 All of IPython is open source (released under the revised BSD license).
27 27
28 28 Enhanced interactive Python shell
29 29 =================================
30 30
31 31 IPython's interactive shell (:command:`ipython`), has the following goals,
32 32 amongst others:
33 33
34 34 1. Provide an interactive shell superior to Python's default. IPython
35 35 has many features for tab-completion, object introspection, system shell
36 36 access, command history retrieval across sessions, and its own special
37 37 command system for adding functionality when working interactively. It
38 38 tries to be a very efficient environment both for Python code development
39 39 and for exploration of problems using Python objects (in situations like
40 40 data analysis).
41 41
42 42 2. Serve as an embeddable, ready to use interpreter for your own
43 43 programs. An interactive IPython shell can be started with a single call
44 44 from inside another program, providing access to the current namespace.
45 45 This can be very useful both for debugging purposes and for situations
46 46 where a blend of batch-processing and interactive exploration are needed.
47 47
48 48 3. Offer a flexible framework which can be used as the base
49 49 environment for working with other systems, with Python as the underlying
50 50 bridge language. Specifically scientific environments like Mathematica,
51 51 IDL and Matlab inspired its design, but similar ideas can be
52 52 useful in many fields.
53 53
54 54 4. Allow interactive testing of threaded graphical toolkits. IPython
55 55 has support for interactive, non-blocking control of GTK, Qt, WX, GLUT, and
56 56 OS X applications via special threading flags. The normal Python
57 57 shell can only do this for Tkinter applications.
58 58
59 59 Main features of the interactive shell
60 60 --------------------------------------
61 61
62 62 * Dynamic object introspection. One can access docstrings, function
63 63 definition prototypes, source code, source files and other details
64 64 of any object accessible to the interpreter with a single
65 65 keystroke (:samp:`?`, and using :samp:`??` provides additional detail).
66 66
67 67 * Searching through modules and namespaces with :samp:`*` wildcards, both
68 68 when using the :samp:`?` system and via the :samp:`%psearch` command.
69 69
70 70 * Completion in the local namespace, by typing :kbd:`TAB` at the prompt.
71 71 This works for keywords, modules, methods, variables and files in the
72 72 current directory. This is supported via the ``prompt_toolkit`` library.
73 73 Custom completers can be implemented easily for different purposes
74 74 (system commands, magic arguments etc.)
75 75
76 76 * Numbered input/output prompts with command history (persistent
77 77 across sessions and tied to each profile), full searching in this
78 78 history and caching of all input and output.
79 79
80 80 * User-extensible 'magic' commands. A set of commands prefixed with
81 81 :samp:`%` or :samp:`%%` is available for controlling IPython itself and provides
82 82 directory control, namespace information and many aliases to
83 83 common system shell commands.
84 84
85 85 * Alias facility for defining your own system aliases.
86 86
87 87 * Complete system shell access. Lines starting with :samp:`!` are passed
88 88 directly to the system shell, and using :samp:`!!` or :samp:`var = !cmd`
89 89 captures shell output into python variables for further use.
90 90
91 91 * The ability to expand python variables when calling the system shell. In a
92 92 shell command, any python variable prefixed with :samp:`$` is expanded. A
93 93 double :samp:`$$` allows passing a literal :samp:`$` to the shell (for access
94 94 to shell and environment variables like :envvar:`PATH`).
95 95
96 96 * Filesystem navigation, via a magic :samp:`%cd` command, along with a
97 97 persistent bookmark system (using :samp:`%bookmark`) for fast access to
98 98 frequently visited directories.
99 99
100 100 * A lightweight persistence framework via the :samp:`%store` command, which
101 101 allows you to save arbitrary Python variables. These get restored
102 102 when you run the :samp:`%store -r` command.
103 103
104 104 * Automatic indentation and highlighting of code as you type (through the
105 105 `prompt_toolkit` library).
106 106
107 107 * Macro system for quickly re-executing multiple lines of previous
108 108 input with a single name via the :samp:`%macro` command. Macros can be
109 109 stored persistently via :samp:`%store` and edited via :samp:`%edit`.
110 110
111 111 * Session logging (you can then later use these logs as code in your
112 112 programs). Logs can optionally timestamp all input, and also store
113 113 session output (marked as comments, so the log remains valid
114 114 Python source code).
115 115
116 116 * Session restoring: logs can be replayed to restore a previous
117 117 session to the state where you left it.
118 118
119 119 * Verbose and colored exception traceback printouts. Easier to parse
120 120 visually, and in verbose mode they produce a lot of useful
121 121 debugging information (basically a terminal version of the cgitb
122 122 module).
123 123
124 124 * Auto-parentheses via the :samp:`%autocall` command: callable objects can be
125 125 executed without parentheses: :samp:`sin 3` is automatically converted to
126 126 :samp:`sin(3)`
127 127
128 128 * Auto-quoting: using :samp:`,`, or :samp:`;` as the first character forces
129 129 auto-quoting of the rest of the line: :samp:`,my_function a b` becomes
130 130 automatically :samp:`my_function("a","b")`, while :samp:`;my_function a b`
131 131 becomes :samp:`my_function("a b")`.
132 132
133 133 * Extensible input syntax. You can define filters that pre-process
134 134 user input to simplify input in special situations. This allows
135 135 for example pasting multi-line code fragments which start with
136 136 :samp:`>>>` or :samp:`...` such as those from other python sessions or the
137 137 standard Python documentation.
138 138
139 139 * Flexible :ref:`configuration system <config_overview>`. It uses a
140 140 configuration file which allows permanent setting of all command-line
141 141 options, module loading, code and file execution. The system allows
142 142 recursive file inclusion, so you can have a base file with defaults and
143 143 layers which load other customizations for particular projects.
144 144
145 145 * Embeddable. You can call IPython as a python shell inside your own
146 146 python programs. This can be used both for debugging code or for
147 147 providing interactive abilities to your programs with knowledge
148 148 about the local namespaces (very useful in debugging and data
149 149 analysis situations).
150 150
151 151 * Easy debugger access. You can set IPython to call up an enhanced version of
152 152 the Python debugger (pdb) every time there is an uncaught exception. This
153 153 drops you inside the code which triggered the exception with all the data
154 154 live and it is possible to navigate the stack to rapidly isolate the source
155 155 of a bug. The :samp:`%run` magic command (with the :samp:`-d` option) can run
156 156 any script under pdb's control, automatically setting initial breakpoints for
157 157 you. This version of pdb has IPython-specific improvements, including
158 158 tab-completion and traceback coloring support. For even easier debugger
159 159 access, try :samp:`%debug` after seeing an exception.
160 160
161 161 * Profiler support. You can run single statements (similar to
162 162 :samp:`profile.run()`) or complete programs under the profiler's control.
163 163 While this is possible with standard cProfile or profile modules,
164 164 IPython wraps this functionality with magic commands (see :samp:`%prun`
165 165 and :samp:`%run -p`) convenient for rapid interactive work.
166 166
167 167 * Simple timing information. You can use the :samp:`%timeit` command to get
168 168 the execution time of a Python statement or expression. This machinery is
169 169 intelligent enough to do more repetitions for commands that finish very
170 170 quickly in order to get a better estimate of their running time.
171 171
172 172 .. sourcecode:: ipython
173 173
174 174 In [1]: %timeit 1+1
175 175 10000000 loops, best of 3: 25.5 ns per loop
176 176
177 177 In [2]: %timeit [math.sin(x) for x in range(5000)]
178 178 1000 loops, best of 3: 719 Β΅s per loop
179 179
180 180 ..
181 181
182 182 To get the timing information for more than one expression, use the
183 183 :samp:`%%timeit` cell magic command.
184 184
185 185
186 186 * Doctest support. The special :samp:`%doctest_mode` command toggles a mode
187 187 to use doctest-compatible prompts, so you can use IPython sessions as
188 188 doctest code. By default, IPython also allows you to paste existing
189 189 doctests, and strips out the leading :samp:`>>>` and :samp:`...` prompts in
190 190 them.
191 191
192 192 .. _ipythonzmq:
193 193
194 194 Decoupled two-process model
195 195 ==============================
196 196
197 197 IPython has abstracted and extended the notion of a traditional
198 198 *Read-Evaluate-Print Loop* (REPL) environment by decoupling the *evaluation*
199 199 into its own process. We call this process a **kernel**: it receives execution
200 200 instructions from clients and communicates the results back to them.
201 201
202 202 This decoupling allows us to have several clients connected to the same
203 203 kernel, and even allows clients and kernels to live on different machines.
204 204 With the exclusion of the traditional single process terminal-based IPython
205 205 (what you start if you run ``ipython`` without any subcommands), all
206 206 other IPython machinery uses this two-process model. Most of this is now part
207 207 of the `Jupyter` project, whis includes ``jupyter console``, ``jupyter
208 208 qtconsole``, and ``jupyter notebook``.
209 209
210 210 As an example, this means that when you start ``jupyter qtconsole``, you're
211 211 really starting two processes, a kernel and a Qt-based client can send
212 212 commands to and receive results from that kernel. If there is already a kernel
213 213 running that you want to connect to, you can pass the ``--existing`` flag
214 214 which will skip initiating a new kernel and connect to the most recent kernel,
215 215 instead. To connect to a specific kernel once you have several kernels
216 216 running, use the ``%connect_info`` magic to get the unique connection file,
217 217 which will be something like ``--existing kernel-19732.json`` but with
218 218 different numbers which correspond to the Process ID of the kernel.
219 219
220 220 You can read more about using `jupyter qtconsole
221 221 <http://jupyter.org/qtconsole/>`_, and
222 222 `jupyter notebook <http://jupyter-notebook.readthedocs.io/en/latest/>`_. There
223 223 is also a :ref:`message spec <messaging>` which documents the protocol for
224 224 communication between kernels
225 225 and clients.
226 226
227 227 .. seealso::
228 228
229 229 `Frontend/Kernel Model`_ example notebook
230 230
231 231
232 232 Interactive parallel computing
233 233 ==============================
234 234
235 235
236 236 This functionality is optional and now part of the `ipyparallel
237 237 <http://ipyparallel.readthedocs.io/>`_ project.
238 238
239 239 Portability and Python requirements
240 240 -----------------------------------
241 241
242 As of the 2.0 release, IPython works with Python 2.7 and 3.3 or above.
242 Version 6.0+ supports compatibility with Python 3.3 and higher.
243 Versions 2.0 to 5.x work with Python 2.7.x releases and Python 3.3 and higher.
243 244 Version 1.0 additionally worked with Python 2.6 and 3.2.
244 245 Version 0.12 was the first version to fully support Python 3.
245 246
246 247 IPython is known to work on the following operating systems:
247 248
248 249 * Linux
249 250 * Most other Unix-like OSs (AIX, Solaris, BSD, etc.)
250 251 * Mac OS X
251 252 * Windows (CygWin, XP, Vista, etc.)
252 253
253 254 See :ref:`here <install_index>` for instructions on how to install IPython.
254 255
255 256 .. include:: links.txt
General Comments 0
You need to be logged in to leave comments. Login now