Show More
@@ -0,0 +1,155 b'' | |||||
|
1 | """Define text roles for GitHub | |||
|
2 | ||||
|
3 | * ghissue - Issue | |||
|
4 | * ghpull - Pull Request | |||
|
5 | * ghuser - User | |||
|
6 | ||||
|
7 | Adapted from bitbucket example here: | |||
|
8 | https://bitbucket.org/birkenfeld/sphinx-contrib/src/tip/bitbucket/sphinxcontrib/bitbucket.py | |||
|
9 | ||||
|
10 | Authors | |||
|
11 | ------- | |||
|
12 | ||||
|
13 | * Doug Hellmann | |||
|
14 | * Min RK | |||
|
15 | """ | |||
|
16 | # | |||
|
17 | # Original Copyright (c) 2010 Doug Hellmann. All rights reserved. | |||
|
18 | # | |||
|
19 | ||||
|
20 | from docutils import nodes, utils | |||
|
21 | from docutils.parsers.rst.roles import set_classes | |||
|
22 | ||||
|
23 | def make_link_node(rawtext, app, type, slug, options): | |||
|
24 | """Create a link to a github resource. | |||
|
25 | ||||
|
26 | :param rawtext: Text being replaced with link node. | |||
|
27 | :param app: Sphinx application context | |||
|
28 | :param type: Link type (issue, changeset, etc.) | |||
|
29 | :param slug: ID of the thing to link to | |||
|
30 | :param options: Options dictionary passed to role func. | |||
|
31 | """ | |||
|
32 | ||||
|
33 | try: | |||
|
34 | base = app.config.github_project_url | |||
|
35 | if not base: | |||
|
36 | raise AttributeError | |||
|
37 | if not base.endswith('/'): | |||
|
38 | base += '/' | |||
|
39 | except AttributeError, err: | |||
|
40 | raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) | |||
|
41 | ||||
|
42 | ref = base + type + '/' + slug + '/' | |||
|
43 | set_classes(options) | |||
|
44 | prefix = "#" | |||
|
45 | if type == 'pull': | |||
|
46 | prefix = "PR " + prefix | |||
|
47 | node = nodes.reference(rawtext, prefix + utils.unescape(slug), refuri=ref, | |||
|
48 | **options) | |||
|
49 | return node | |||
|
50 | ||||
|
51 | def ghissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]): | |||
|
52 | """Link to a GitHub issue. | |||
|
53 | ||||
|
54 | Returns 2 part tuple containing list of nodes to insert into the | |||
|
55 | document and a list of system messages. Both are allowed to be | |||
|
56 | empty. | |||
|
57 | ||||
|
58 | :param name: The role name used in the document. | |||
|
59 | :param rawtext: The entire markup snippet, with role. | |||
|
60 | :param text: The text marked with the role. | |||
|
61 | :param lineno: The line number where rawtext appears in the input. | |||
|
62 | :param inliner: The inliner instance that called us. | |||
|
63 | :param options: Directive options for customization. | |||
|
64 | :param content: The directive content for customization. | |||
|
65 | """ | |||
|
66 | ||||
|
67 | try: | |||
|
68 | issue_num = int(text) | |||
|
69 | if issue_num <= 0: | |||
|
70 | raise ValueError | |||
|
71 | except ValueError: | |||
|
72 | msg = inliner.reporter.error( | |||
|
73 | 'GitHub issue number must be a number greater than or equal to 1; ' | |||
|
74 | '"%s" is invalid.' % text, line=lineno) | |||
|
75 | prb = inliner.problematic(rawtext, rawtext, msg) | |||
|
76 | return [prb], [msg] | |||
|
77 | app = inliner.document.settings.env.app | |||
|
78 | #app.info('issue %r' % text) | |||
|
79 | if 'pull' in name.lower(): | |||
|
80 | category = 'pull' | |||
|
81 | elif 'issue' in name.lower(): | |||
|
82 | category = 'issue' | |||
|
83 | else: | |||
|
84 | msg = inliner.reporter.error( | |||
|
85 | 'GitHub roles include "ghpull" and "ghissue", ' | |||
|
86 | '"%s" is invalid.' % name, line=lineno) | |||
|
87 | prb = inliner.problematic(rawtext, rawtext, msg) | |||
|
88 | return [prb], [msg] | |||
|
89 | node = make_link_node(rawtext, app, category, str(issue_num), options) | |||
|
90 | return [node], [] | |||
|
91 | ||||
|
92 | def ghuser_role(name, rawtext, text, lineno, inliner, options={}, content=[]): | |||
|
93 | """Link to a GitHub user. | |||
|
94 | ||||
|
95 | Returns 2 part tuple containing list of nodes to insert into the | |||
|
96 | document and a list of system messages. Both are allowed to be | |||
|
97 | empty. | |||
|
98 | ||||
|
99 | :param name: The role name used in the document. | |||
|
100 | :param rawtext: The entire markup snippet, with role. | |||
|
101 | :param text: The text marked with the role. | |||
|
102 | :param lineno: The line number where rawtext appears in the input. | |||
|
103 | :param inliner: The inliner instance that called us. | |||
|
104 | :param options: Directive options for customization. | |||
|
105 | :param content: The directive content for customization. | |||
|
106 | """ | |||
|
107 | app = inliner.document.settings.env.app | |||
|
108 | #app.info('user link %r' % text) | |||
|
109 | ref = 'https://www.github.com/' + text | |||
|
110 | node = nodes.reference(rawtext, text, refuri=ref, **options) | |||
|
111 | return [node], [] | |||
|
112 | ||||
|
113 | def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]): | |||
|
114 | """Link to a GitHub commit. | |||
|
115 | ||||
|
116 | Returns 2 part tuple containing list of nodes to insert into the | |||
|
117 | document and a list of system messages. Both are allowed to be | |||
|
118 | empty. | |||
|
119 | ||||
|
120 | :param name: The role name used in the document. | |||
|
121 | :param rawtext: The entire markup snippet, with role. | |||
|
122 | :param text: The text marked with the role. | |||
|
123 | :param lineno: The line number where rawtext appears in the input. | |||
|
124 | :param inliner: The inliner instance that called us. | |||
|
125 | :param options: Directive options for customization. | |||
|
126 | :param content: The directive content for customization. | |||
|
127 | """ | |||
|
128 | app = inliner.document.settings.env.app | |||
|
129 | #app.info('user link %r' % text) | |||
|
130 | try: | |||
|
131 | base = app.config.github_project_url | |||
|
132 | if not base: | |||
|
133 | raise AttributeError | |||
|
134 | if not base.endswith('/'): | |||
|
135 | base += '/' | |||
|
136 | except AttributeError, err: | |||
|
137 | raise ValueError('github_project_url configuration value is not set (%s)' % str(err)) | |||
|
138 | ||||
|
139 | ref = base + text | |||
|
140 | node = nodes.reference(rawtext, text[:6], refuri=ref, **options) | |||
|
141 | return [node], [] | |||
|
142 | ||||
|
143 | ||||
|
144 | def setup(app): | |||
|
145 | """Install the plugin. | |||
|
146 | ||||
|
147 | :param app: Sphinx application context. | |||
|
148 | """ | |||
|
149 | app.info('Initializing GitHub plugin') | |||
|
150 | app.add_role('ghissue', ghissue_role) | |||
|
151 | app.add_role('ghpull', ghissue_role) | |||
|
152 | app.add_role('ghuser', ghuser_role) | |||
|
153 | app.add_role('ghcommit', ghcommit_role) | |||
|
154 | app.add_config_value('github_project_url', None, 'env') | |||
|
155 | return |
@@ -44,6 +44,7 b' extensions = [' | |||||
44 | 'inheritance_diagram', |
|
44 | 'inheritance_diagram', | |
45 | 'ipython_console_highlighting', |
|
45 | 'ipython_console_highlighting', | |
46 | 'numpydoc', # to preprocess docstrings |
|
46 | 'numpydoc', # to preprocess docstrings | |
|
47 | 'github', # for easy GitHub links | |||
47 | ] |
|
48 | ] | |
48 |
|
49 | |||
49 | # Add any paths that contain templates here, relative to this directory. |
|
50 | # Add any paths that contain templates here, relative to this directory. | |
@@ -59,6 +60,9 b" master_doc = 'index'" | |||||
59 | project = 'IPython' |
|
60 | project = 'IPython' | |
60 | copyright = '2008, The IPython Development Team' |
|
61 | copyright = '2008, The IPython Development Team' | |
61 |
|
62 | |||
|
63 | # ghissue config | |||
|
64 | github_project_url = "https://github.com/ipython/ipython" | |||
|
65 | ||||
62 | # The default replacements for |version| and |release|, also used in various |
|
66 | # The default replacements for |version| and |release|, also used in various | |
63 | # other places throughout the built documents. |
|
67 | # other places throughout the built documents. | |
64 | # |
|
68 | # |
@@ -20,14 +20,109 b' New features' | |||||
20 |
|
20 | |||
21 | * **Python 3 compatibility**: IPython can now be installed from a single |
|
21 | * **Python 3 compatibility**: IPython can now be installed from a single | |
22 | codebase on Python 2 and Python 3. The installation process for Python 3 |
|
22 | codebase on Python 2 and Python 3. The installation process for Python 3 | |
23 | automatically runs 2to3. |
|
23 | automatically runs 2to3. Python 3 no longer loads a separate 'python3' | |
|
24 | profile by default. It uses the same 'default' profile as in Python 2. | |||
24 |
|
25 | |||
25 | * **PyPy support**: The terminal interface to IPython now runs under |
|
26 | * **PyPy support**: The terminal interface to IPython now runs under | |
26 | `PyPy <http://pypy.org/>`_. |
|
27 | `PyPy <http://pypy.org/>`_. | |
27 |
|
28 | |||
|
29 | * **Tabbed QtConsole**: The QtConsole now supports starting multiple kernels in | |||
|
30 | tabs, and has a menubar, so it looks and behaves more like a real application. | |||
|
31 | Keyboard enthusiasts can disable the menubar with ctrl-shift-M (:ghpull:`887`). | |||
|
32 | ||||
|
33 | * **SSH Tunnels**: In 0.11, the :mod:`IPython.parallel` Client could tunnel its | |||
|
34 | connections to the Controller via ssh. Now, the QtConsole :ref:`supports | |||
|
35 | <ssh_tunnels>` ssh tunneling, as do parallel engines. | |||
|
36 | ||||
|
37 | * **relaxed command-line parsing**: 0.11 was released with overly-strict | |||
|
38 | command-line parsing, preventing the ability to specify arguments with spaces, | |||
|
39 | e.g. ``ipython --pylab qt`` or ``ipython -c "print 'hi'"``. This has | |||
|
40 | been fixed, by using argparse. The new parsing is a strict superset of 0.11, so | |||
|
41 | any commands in 0.11 should still work in 0.12. | |||
|
42 | ||||
|
43 | * **HistoryAccessor**: The :class:`~IPython.core.history.HistoryManager` class for | |||
|
44 | interacting with your IPython SQLite history database has been split, adding | |||
|
45 | a parent :class:`~IPython.core.history.HistoryAccessor` class, so that users can | |||
|
46 | write code to access and search their IPython history without being in an IPython | |||
|
47 | session (:ghpull:`824`). | |||
|
48 | ||||
|
49 | * **kernel %gui and %pylab**: The ``%gui`` and ``%pylab`` magics have been restored | |||
|
50 | to the IPython kernel (e.g. in the qtconsole or notebook). This allows activation | |||
|
51 | of pylab-mode, or eventloop integration after starting the kernel, which was | |||
|
52 | unavailable in 0.11. Unlike in the terminal, this can be set only once, and | |||
|
53 | cannot be changed. | |||
|
54 | ||||
|
55 | * **%config**: A new ``%config`` magic has been added, giving easy access to the | |||
|
56 | IPython configuration system at runtime (:ghpull:`923`). | |||
|
57 | ||||
|
58 | * **Standalone Kernel**: ``ipython kernel`` subcommand has been added, to allow | |||
|
59 | starting a standalone kernel, that can be used with various frontends. | |||
|
60 | ||||
|
61 | * **Multiline History**: Multiline readline history has been restored to the | |||
|
62 | Terminal frontend by default (:ghpull:`838`). | |||
|
63 | ||||
|
64 | ||||
|
65 | ||||
|
66 | Major Bugs fixed | |||
|
67 | ---------------- | |||
|
68 | ||||
|
69 | * Simple configuration errors should no longer crash IPython. In 0.11, errors in | |||
|
70 | config files, as well as invalid trait values, could crash IPython. Now, such | |||
|
71 | errors are reported, and help is displayed. | |||
|
72 | ||||
|
73 | * Certain SyntaxErrors no longer crash IPython (e.g. just typing keywords, such as | |||
|
74 | ``return``, ``break``, etc.). See :ghissue:`704`. | |||
|
75 | ||||
|
76 | * IPython path utils, such as :func:`~IPython.utils.path.get_ipython_dir` now check | |||
|
77 | for write permissions, so IPython should function on systems where the default | |||
|
78 | path resolution might point to a read-only location, such as ``HOMESHARE`` on | |||
|
79 | Windows (:ghissue:`669`). | |||
|
80 | ||||
|
81 | * :func:`raw_input` now works in the kernel when multiple frontends are in use. The | |||
|
82 | request will be sent to the frontend that made the request, and an exception is | |||
|
83 | raised if that frontend does not support stdin requests (e.g. the notebook) | |||
|
84 | (:ghissue:`673`). | |||
|
85 | ||||
|
86 | * :mod:`zmq` version detection no longer uses simple lexicographical comparison to | |||
|
87 | check minimum version, which prevents 0.11 from working with pyzmq-2.1.10 | |||
|
88 | (:ghpull:`758`). | |||
|
89 | ||||
|
90 | * A bug in PySide < 1.0.7 caused crashes on OSX when tooltips were shown | |||
|
91 | (:ghissue:`711`). these tooltips are now disabled on old PySide (:ghpull:`963`). | |||
|
92 | ||||
28 | .. * use bullet list |
|
93 | .. * use bullet list | |
29 |
|
94 | |||
30 | Backwards incompatible changes |
|
95 | Backwards incompatible changes | |
31 | ------------------------------ |
|
96 | ------------------------------ | |
32 |
|
97 | |||
|
98 | * IPython connection information is no longer specified via ip/port directly, | |||
|
99 | rather via json connection files. These files are stored in the security | |||
|
100 | directory, and enable us to turn on HMAC message authentication by default, | |||
|
101 | significantly improving the security of kernels. Various utility functions | |||
|
102 | have been added to :mod:`IPython.lib.kernel`, for easier connecting to existing | |||
|
103 | kernels. | |||
|
104 | ||||
|
105 | * :class:`~IPython.zmq.kernelmanager.KernelManager` now has one ip, and several port | |||
|
106 | traits, rather than several ip/port pair ``_addr`` traits. This better matches the | |||
|
107 | rest of the code, where the ip cannot not be set separately for each channel. | |||
|
108 | ||||
|
109 | * The class inheritance of the Launchers in :mod:`IPython.parallel.apps.launcher` | |||
|
110 | used by ipcluster has changed, so that trait names are more consistent across | |||
|
111 | batch systems. This may require a few renames in your config files, if you | |||
|
112 | customized the command-line args for launching controllers and engines. The | |||
|
113 | configurable names have also been changed to be clearer that they point to class | |||
|
114 | names, and can now be specified by name only, rather than requiring the full | |||
|
115 | import path of each class, e.g.:: | |||
|
116 | ||||
|
117 | IPClusterEngines.engine_launcher = 'IPython.parallel.apps.launcher.MPIExecEngineSetLauncher' | |||
|
118 | IPClusterStart.controller_launcher = 'IPython.parallel.apps.launcher.SSHControllerLauncher' | |||
|
119 | ||||
|
120 | would now be specified as:: | |||
|
121 | ||||
|
122 | IPClusterEngines.engine_launcher_class = 'MPIExec' | |||
|
123 | IPClusterStart.controller_launcher_class = 'SSH' | |||
|
124 | ||||
|
125 | The full path will still work, and is necessary for using custom launchers not in | |||
|
126 | IPython's launcher module. | |||
|
127 | ||||
33 | .. * use bullet list |
|
128 | .. * use bullet list |
General Comments 0
You need to be logged in to leave comments.
Login now