##// END OF EJS Templates
Merge branch 'main' into greedy-completions
Michał Krassowski -
r27919:5c16bcd7 merge
parent child Browse files
Show More
@@ -116,6 +116,21 b' class CachingCompiler(codeop.Compile):'
116 116 """
117 117 return code_name(transformed_code, number)
118 118
119 def format_code_name(self, name):
120 """Return a user-friendly label and name for a code block.
121
122 Parameters
123 ----------
124 name : str
125 The name for the code block returned from get_code_name
126
127 Returns
128 -------
129 A (label, name) pair that can be used in tracebacks, or None if the default formatting should be used.
130 """
131 if name in self._filename_map:
132 return "Cell", "In[%s]" % self._filename_map[name]
133
119 134 def cache(self, transformed_code, number=0, raw_code=None):
120 135 """Make a name for a block of code, and cache the code.
121 136
@@ -16,7 +16,7 b''
16 16 # release. 'dev' as a _version_extra string means this is a development
17 17 # version
18 18 _version_major = 8
19 _version_minor = 7
19 _version_minor = 8
20 20 _version_patch = 0
21 21 _version_extra = ".dev"
22 22 # _version_extra = "rc1"
@@ -173,7 +173,7 b' def _format_traceback_lines(lines, Colors, has_colors: bool, lvals):'
173 173
174 174 def _format_filename(file, ColorFilename, ColorNormal, *, lineno=None):
175 175 """
176 Format filename lines with `In [n]` if it's the nth code cell or `File *.py` if it's a module.
176 Format filename lines with custom formatting from caching compiler or `File *.py` by default
177 177
178 178 Parameters
179 179 ----------
@@ -184,23 +184,29 b' def _format_filename(file, ColorFilename, ColorNormal, *, lineno=None):'
184 184 ColorScheme's normal coloring to be used.
185 185 """
186 186 ipinst = get_ipython()
187
188 if ipinst is not None and file in ipinst.compile._filename_map:
189 file = "[%s]" % ipinst.compile._filename_map[file]
187 if (
188 ipinst is not None
189 and (data := ipinst.compile.format_code_name(file)) is not None
190 ):
191 label, name = data
190 192 if lineno is None:
191 tpl_link = f"Cell {ColorFilename}In {{file}}{ColorNormal}"
193 tpl_link = f"{{label}} {ColorFilename}{{name}}{ColorNormal}"
192 194 else:
193 tpl_link = f"Cell {ColorFilename}In {{file}}, line {{lineno}}{ColorNormal}"
195 tpl_link = (
196 f"{{label}} {ColorFilename}{{name}}, line {{lineno}}{ColorNormal}"
197 )
194 198 else:
195 file = util_path.compress_user(
199 label = "File"
200 name = util_path.compress_user(
196 201 py3compat.cast_unicode(file, util_path.fs_encoding)
197 202 )
198 203 if lineno is None:
199 tpl_link = f"File {ColorFilename}{{file}}{ColorNormal}"
204 tpl_link = f"{{label}} {ColorFilename}{{name}}{ColorNormal}"
200 205 else:
201 tpl_link = f"File {ColorFilename}{{file}}:{{lineno}}{ColorNormal}"
206 # can we make this the more friendly ", line {{lineno}}", or do we need to preserve the formatting with the colon?
207 tpl_link = f"{{label}} {ColorFilename}{{name}}:{{lineno}}{ColorNormal}"
202 208
203 return tpl_link.format(file=file, lineno=lineno)
209 return tpl_link.format(label=label, name=name, lineno=lineno)
204 210
205 211 #---------------------------------------------------------------------------
206 212 # Module classes
@@ -2,6 +2,32 b''
2 2 8.x Series
3 3 ============
4 4
5
6 .. _version 8.7.0:
7
8 IPython 8.7.0
9 -------------
10
11
12 Small release of IPython with a couple of bug fixes and new features for this
13 month. Next month is end of year, it is unclear if there will be a release close
14 the new year's eve, or if the next release will be at end of January.
15
16 Here are a few of the relevant fixes,
17 as usual you can find the full list of PRs on GitHub under `the 8.7 milestone
18 <https://github.com/ipython/ipython/pulls?q=milestone%3A8.7>`__.
19
20
21 - :ghpull:`13834` bump the minimum prompt toolkit to 3.0.11.
22 - IPython shipped with the ``py.typed`` marker now, and we are progressively
23 adding more types. :ghpull:`13831`
24 - :ghpull:`13817` add configuration of code blacks formatting.
25
26
27 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
28 work on IPython and related libraries.
29
30
5 31 .. _version 8.6.0:
6 32
7 33 IPython 8.6.0
@@ -40,7 +66,7 b' As we follow NEP 29, we removed support for numpy 1.19 :ghpull:`13760`.'
40 66
41 67 The ``open()`` function present in the user namespace by default will now refuse
42 68 to open the file descriptors 0,1,2 (stdin, out, err), to avoid crashing IPython.
43 This mostly occurs in teaching context when incorrect values get passed around.
69 This mostly occurs in teaching context when incorrect values get passed around.
44 70
45 71
46 72 The ``?``, ``??``, and corresponding ``pinfo``, ``pinfo2`` magics can now find
@@ -37,7 +37,7 b' install_requires ='
37 37 matplotlib-inline
38 38 pexpect>4.3; sys_platform != "win32"
39 39 pickleshare
40 prompt_toolkit>3.0.1,<3.1.0
40 prompt_toolkit>=3.0.11,<3.1.0
41 41 pygments>=2.4.0
42 42 stack_data
43 43 traitlets>=5
@@ -106,9 +106,6 b' IPython.lib.tests = *.wav'
106 106 IPython.testing.plugin = *.txt
107 107
108 108 [options.entry_points]
109 console_scripts =
110 ipython = IPython:start_ipython
111 ipython3 = IPython:start_ipython
112 109 pygments.lexers =
113 110 ipythonconsole = IPython.lib.lexers:IPythonConsoleLexer
114 111 ipython = IPython.lib.lexers:IPythonLexer
@@ -66,7 +66,7 b' from setuptools import setup'
66 66 # Our own imports
67 67 sys.path.insert(0, ".")
68 68
69 from setupbase import target_update
69 from setupbase import target_update, find_entry_points
70 70
71 71 from setupbase import (
72 72 setup_args,
@@ -139,6 +139,7 b" setup_args['cmdclass'] = {"
139 139 'install_scripts_sym': install_scripts_for_symlink,
140 140 'unsymlink': unsymlink,
141 141 }
142 setup_args["entry_points"] = {"console_scripts": find_entry_points()}
142 143
143 144 #---------------------------------------------------------------------------
144 145 # Do the actual setup now
General Comments 0
You need to be logged in to leave comments. Login now