Show More
@@ -1,236 +1,248 | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """sys.excepthook for IPython itself, leaves a detailed report on disk. |
|
3 | 3 | |
|
4 | 4 | Authors: |
|
5 | 5 | |
|
6 | 6 | * Fernando Perez |
|
7 | 7 | * Brian E. Granger |
|
8 | 8 | """ |
|
9 | 9 | |
|
10 | 10 | #----------------------------------------------------------------------------- |
|
11 | 11 | # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu> |
|
12 | 12 | # Copyright (C) 2008-2011 The IPython Development Team |
|
13 | 13 | # |
|
14 | 14 | # Distributed under the terms of the BSD License. The full license is in |
|
15 | 15 | # the file COPYING, distributed as part of this software. |
|
16 | 16 | #----------------------------------------------------------------------------- |
|
17 | 17 | |
|
18 | 18 | #----------------------------------------------------------------------------- |
|
19 | 19 | # Imports |
|
20 | 20 | #----------------------------------------------------------------------------- |
|
21 | 21 | |
|
22 | 22 | import sys |
|
23 | 23 | import traceback |
|
24 | 24 | from pprint import pformat |
|
25 | 25 | from pathlib import Path |
|
26 | 26 | |
|
27 | import builtins as builtin_mod | |
|
28 | ||
|
27 | 29 | from IPython.core import ultratb |
|
30 | from IPython.core.application import Application | |
|
28 | 31 | from IPython.core.release import author_email |
|
29 | 32 | from IPython.utils.sysinfo import sys_info |
|
30 | from IPython.utils.py3compat import input | |
|
31 | 33 | |
|
32 | 34 | from IPython.core.release import __version__ as version |
|
33 | 35 | |
|
34 | from typing import Optional | |
|
36 | from typing import Optional, Dict | |
|
37 | import types | |
|
35 | 38 | |
|
36 | 39 | #----------------------------------------------------------------------------- |
|
37 | 40 | # Code |
|
38 | 41 | #----------------------------------------------------------------------------- |
|
39 | 42 | |
|
40 | 43 | # Template for the user message. |
|
41 | 44 | _default_message_template = """\ |
|
42 | 45 | Oops, {app_name} crashed. We do our best to make it stable, but... |
|
43 | 46 | |
|
44 | 47 | A crash report was automatically generated with the following information: |
|
45 | 48 | - A verbatim copy of the crash traceback. |
|
46 | 49 | - A copy of your input history during this session. |
|
47 | 50 | - Data on your current {app_name} configuration. |
|
48 | 51 | |
|
49 | 52 | It was left in the file named: |
|
50 | 53 | \t'{crash_report_fname}' |
|
51 | 54 | If you can email this file to the developers, the information in it will help |
|
52 | 55 | them in understanding and correcting the problem. |
|
53 | 56 | |
|
54 | 57 | You can mail it to: {contact_name} at {contact_email} |
|
55 | 58 | with the subject '{app_name} Crash Report'. |
|
56 | 59 | |
|
57 | 60 | If you want to do it now, the following command will work (under Unix): |
|
58 | 61 | mail -s '{app_name} Crash Report' {contact_email} < {crash_report_fname} |
|
59 | 62 | |
|
60 | 63 | In your email, please also include information about: |
|
61 | 64 | - The operating system under which the crash happened: Linux, macOS, Windows, |
|
62 | 65 | other, and which exact version (for example: Ubuntu 16.04.3, macOS 10.13.2, |
|
63 | 66 | Windows 10 Pro), and whether it is 32-bit or 64-bit; |
|
64 | 67 | - How {app_name} was installed: using pip or conda, from GitHub, as part of |
|
65 | 68 | a Docker container, or other, providing more detail if possible; |
|
66 | 69 | - How to reproduce the crash: what exact sequence of instructions can one |
|
67 | 70 | input to get the same crash? Ideally, find a minimal yet complete sequence |
|
68 | 71 | of instructions that yields the crash. |
|
69 | 72 | |
|
70 | 73 | To ensure accurate tracking of this issue, please file a report about it at: |
|
71 | 74 | {bug_tracker} |
|
72 | 75 | """ |
|
73 | 76 | |
|
74 | 77 | _lite_message_template = """ |
|
75 | 78 | If you suspect this is an IPython {version} bug, please report it at: |
|
76 | 79 | https://github.com/ipython/ipython/issues |
|
77 | 80 | or send an email to the mailing list at {email} |
|
78 | 81 | |
|
79 | 82 | You can print a more detailed traceback right now with "%tb", or use "%debug" |
|
80 | 83 | to interactively debug it. |
|
81 | 84 | |
|
82 | 85 | Extra-detailed tracebacks for bug-reporting purposes can be enabled via: |
|
83 | 86 | {config}Application.verbose_crash=True |
|
84 | 87 | """ |
|
85 | 88 | |
|
86 | 89 | |
|
87 |
class CrashHandler |
|
|
90 | class CrashHandler: | |
|
88 | 91 | """Customizable crash handlers for IPython applications. |
|
89 | 92 | |
|
90 | 93 | Instances of this class provide a :meth:`__call__` method which can be |
|
91 | 94 | used as a ``sys.excepthook``. The :meth:`__call__` signature is:: |
|
92 | 95 | |
|
93 | 96 | def __call__(self, etype, evalue, etb) |
|
94 | 97 | """ |
|
95 | 98 | |
|
96 | 99 | message_template = _default_message_template |
|
97 | 100 | section_sep = '\n\n'+'*'*75+'\n\n' |
|
101 | info: Dict[str, Optional[str]] | |
|
98 | 102 | |
|
99 | 103 | def __init__( |
|
100 | 104 | self, |
|
101 | app, | |
|
105 | app: Application, | |
|
102 | 106 | contact_name: Optional[str] = None, |
|
103 | 107 | contact_email: Optional[str] = None, |
|
104 | 108 | bug_tracker: Optional[str] = None, |
|
105 | 109 | show_crash_traceback: bool = True, |
|
106 | 110 | call_pdb: bool = False, |
|
107 | 111 | ): |
|
108 | 112 | """Create a new crash handler |
|
109 | 113 | |
|
110 | 114 | Parameters |
|
111 | 115 | ---------- |
|
112 | 116 | app : Application |
|
113 | 117 | A running :class:`Application` instance, which will be queried at |
|
114 | 118 | crash time for internal information. |
|
115 | 119 | contact_name : str |
|
116 | 120 | A string with the name of the person to contact. |
|
117 | 121 | contact_email : str |
|
118 | 122 | A string with the email address of the contact. |
|
119 | 123 | bug_tracker : str |
|
120 | 124 | A string with the URL for your project's bug tracker. |
|
121 | 125 | show_crash_traceback : bool |
|
122 | 126 | If false, don't print the crash traceback on stderr, only generate |
|
123 | 127 | the on-disk report |
|
124 | 128 | call_pdb |
|
125 | 129 | Whether to call pdb on crash |
|
126 | 130 | |
|
127 | 131 | Attributes |
|
128 | 132 | ---------- |
|
129 | 133 | These instances contain some non-argument attributes which allow for |
|
130 | 134 | further customization of the crash handler's behavior. Please see the |
|
131 | 135 | source for further details. |
|
132 | 136 | |
|
133 | 137 | """ |
|
134 | 138 | self.crash_report_fname = "Crash_report_%s.txt" % app.name |
|
135 | 139 | self.app = app |
|
136 | 140 | self.call_pdb = call_pdb |
|
137 | 141 | #self.call_pdb = True # dbg |
|
138 | 142 | self.show_crash_traceback = show_crash_traceback |
|
139 | 143 | self.info = dict(app_name = app.name, |
|
140 | 144 | contact_name = contact_name, |
|
141 | 145 | contact_email = contact_email, |
|
142 | 146 | bug_tracker = bug_tracker, |
|
143 | 147 | crash_report_fname = self.crash_report_fname) |
|
144 | 148 | |
|
145 | ||
|
146 | def __call__(self, etype, evalue, etb): | |
|
149 | def __call__( | |
|
150 | self, | |
|
151 | etype: type[BaseException], | |
|
152 | evalue: BaseException, | |
|
153 | etb: types.TracebackType, | |
|
154 | ) -> None: | |
|
147 | 155 | """Handle an exception, call for compatible with sys.excepthook""" |
|
148 | ||
|
156 | ||
|
149 | 157 | # do not allow the crash handler to be called twice without reinstalling it |
|
150 | 158 | # this prevents unlikely errors in the crash handling from entering an |
|
151 | 159 | # infinite loop. |
|
152 | 160 | sys.excepthook = sys.__excepthook__ |
|
153 | 161 | |
|
154 | 162 | # Report tracebacks shouldn't use color in general (safer for users) |
|
155 | 163 | color_scheme = 'NoColor' |
|
156 | 164 | |
|
157 | 165 | # Use this ONLY for developer debugging (keep commented out for release) |
|
158 | #color_scheme = 'Linux' # dbg | |
|
159 | try: | |
|
160 | rptdir = Path(self.app.ipython_dir) | |
|
161 | except: | |
|
166 | # color_scheme = 'Linux' # dbg | |
|
167 | ipython_dir = getattr(self.app, "ipython_dir") | |
|
168 | if ipython_dir is not None: | |
|
169 | assert isinstance(ipython_dir, str) | |
|
170 | rptdir = Path(ipython_dir) | |
|
171 | else: | |
|
162 | 172 | rptdir = Path.cwd() |
|
163 | 173 | if not rptdir.is_dir(): |
|
164 | 174 | rptdir = Path.cwd() |
|
165 | 175 | report_name = rptdir / self.crash_report_fname |
|
166 | 176 | # write the report filename into the instance dict so it can get |
|
167 | 177 | # properly expanded out in the user message template |
|
168 | self.crash_report_fname = report_name | |
|
169 |
self.info[ |
|
|
178 | self.crash_report_fname = str(report_name) | |
|
179 | self.info["crash_report_fname"] = str(report_name) | |
|
170 | 180 | TBhandler = ultratb.VerboseTB( |
|
171 | 181 | color_scheme=color_scheme, |
|
172 |
long_header= |
|
|
182 | long_header=True, | |
|
173 | 183 | call_pdb=self.call_pdb, |
|
174 | 184 | ) |
|
175 | 185 | if self.call_pdb: |
|
176 | 186 | TBhandler(etype,evalue,etb) |
|
177 | 187 | return |
|
178 | 188 | else: |
|
179 | 189 | traceback = TBhandler.text(etype,evalue,etb,context=31) |
|
180 | 190 | |
|
181 | 191 | # print traceback to screen |
|
182 | 192 | if self.show_crash_traceback: |
|
183 | 193 | print(traceback, file=sys.stderr) |
|
184 | 194 | |
|
185 | 195 | # and generate a complete report on disk |
|
186 | 196 | try: |
|
187 | 197 | report = open(report_name, "w", encoding="utf-8") |
|
188 | 198 | except: |
|
189 | 199 | print('Could not create crash report on disk.', file=sys.stderr) |
|
190 | 200 | return |
|
191 | 201 | |
|
192 | 202 | with report: |
|
193 | 203 | # Inform user on stderr of what happened |
|
194 | 204 | print('\n'+'*'*70+'\n', file=sys.stderr) |
|
195 | 205 | print(self.message_template.format(**self.info), file=sys.stderr) |
|
196 | 206 | |
|
197 | 207 | # Construct report on disk |
|
198 | report.write(self.make_report(traceback)) | |
|
208 | report.write(self.make_report(str(traceback))) | |
|
199 | 209 | |
|
200 | input("Hit <Enter> to quit (your terminal may close):") | |
|
210 | builtin_mod.input("Hit <Enter> to quit (your terminal may close):") | |
|
201 | 211 | |
|
202 | def make_report(self,traceback): | |
|
212 | def make_report(self, traceback: str) -> str: | |
|
203 | 213 | """Return a string containing a crash report.""" |
|
204 | 214 | |
|
205 | 215 | sec_sep = self.section_sep |
|
206 | 216 | |
|
207 | 217 | report = ['*'*75+'\n\n'+'IPython post-mortem report\n\n'] |
|
208 | 218 | rpt_add = report.append |
|
209 | 219 | rpt_add(sys_info()) |
|
210 | 220 | |
|
211 | 221 | try: |
|
212 | 222 | config = pformat(self.app.config) |
|
213 | 223 | rpt_add(sec_sep) |
|
214 |
rpt_add( |
|
|
215 |
rpt_add( |
|
|
224 | rpt_add("Application name: %s\n\n" % self.app.name) | |
|
225 | rpt_add("Current user configuration structure:\n\n") | |
|
216 | 226 | rpt_add(config) |
|
217 | 227 | except: |
|
218 | 228 | pass |
|
219 | 229 | rpt_add(sec_sep+'Crash traceback:\n\n' + traceback) |
|
220 | 230 | |
|
221 | 231 | return ''.join(report) |
|
222 | 232 | |
|
223 | 233 | |
|
224 |
def crash_handler_lite( |
|
|
234 | def crash_handler_lite( | |
|
235 | etype: type[BaseException], evalue: BaseException, tb: types.TracebackType | |
|
236 | ) -> None: | |
|
225 | 237 | """a light excepthook, adding a small message to the usual traceback""" |
|
226 | 238 | traceback.print_exception(etype, evalue, tb) |
|
227 | 239 | |
|
228 | 240 | from IPython.core.interactiveshell import InteractiveShell |
|
229 | 241 | if InteractiveShell.initialized(): |
|
230 | 242 | # we are in a Shell environment, give %magic example |
|
231 | 243 | config = "%config " |
|
232 | 244 | else: |
|
233 | 245 | # we are not in a shell, show generic config |
|
234 | 246 | config = "c." |
|
235 | 247 | print(_lite_message_template.format(email=author_email, config=config, version=version), file=sys.stderr) |
|
236 | 248 |
@@ -1,143 +1,143 | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """ |
|
3 | 3 | Utilities for getting information about IPython and the system it's running in. |
|
4 | 4 | """ |
|
5 | 5 | |
|
6 | 6 | #----------------------------------------------------------------------------- |
|
7 | 7 | # Copyright (C) 2008-2011 The IPython Development Team |
|
8 | 8 | # |
|
9 | 9 | # Distributed under the terms of the BSD License. The full license is in |
|
10 | 10 | # the file COPYING, distributed as part of this software. |
|
11 | 11 | #----------------------------------------------------------------------------- |
|
12 | 12 | |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 | 14 | # Imports |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | import os |
|
18 | 18 | import platform |
|
19 | 19 | import pprint |
|
20 | 20 | import sys |
|
21 | 21 | import subprocess |
|
22 | 22 | |
|
23 | 23 | from pathlib import Path |
|
24 | 24 | |
|
25 | 25 | from IPython.core import release |
|
26 | 26 | from IPython.utils import _sysinfo, encoding |
|
27 | 27 | |
|
28 | 28 | #----------------------------------------------------------------------------- |
|
29 | 29 | # Code |
|
30 | 30 | #----------------------------------------------------------------------------- |
|
31 | 31 | |
|
32 | 32 | def pkg_commit_hash(pkg_path: str) -> tuple[str, str]: |
|
33 | 33 | """Get short form of commit hash given directory `pkg_path` |
|
34 | 34 | |
|
35 | 35 | We get the commit hash from (in order of preference): |
|
36 | 36 | |
|
37 | 37 | * IPython.utils._sysinfo.commit |
|
38 | 38 | * git output, if we are in a git repository |
|
39 | 39 | |
|
40 | 40 | If these fail, we return a not-found placeholder tuple |
|
41 | 41 | |
|
42 | 42 | Parameters |
|
43 | 43 | ---------- |
|
44 | 44 | pkg_path : str |
|
45 | 45 | directory containing package |
|
46 | 46 | only used for getting commit from active repo |
|
47 | 47 | |
|
48 | 48 | Returns |
|
49 | 49 | ------- |
|
50 | 50 | hash_from : str |
|
51 | 51 | Where we got the hash from - description |
|
52 | 52 | hash_str : str |
|
53 | 53 | short form of hash |
|
54 | 54 | """ |
|
55 | 55 | # Try and get commit from written commit text file |
|
56 | 56 | if _sysinfo.commit: |
|
57 | 57 | return "installation", _sysinfo.commit |
|
58 | 58 | |
|
59 | 59 | # maybe we are in a repository |
|
60 | 60 | proc = subprocess.Popen('git rev-parse --short HEAD'.split(' '), |
|
61 | 61 | stdout=subprocess.PIPE, |
|
62 | 62 | stderr=subprocess.PIPE, |
|
63 | 63 | cwd=pkg_path) |
|
64 | 64 | repo_commit, _ = proc.communicate() |
|
65 | 65 | if repo_commit: |
|
66 | 66 | return 'repository', repo_commit.strip().decode('ascii') |
|
67 | 67 | return '(none found)', '<not found>' |
|
68 | 68 | |
|
69 | 69 | |
|
70 | 70 | def pkg_info(pkg_path: str) -> dict: |
|
71 | 71 | """Return dict describing the context of this package |
|
72 | 72 | |
|
73 | 73 | Parameters |
|
74 | 74 | ---------- |
|
75 | 75 | pkg_path : str |
|
76 | 76 | path containing __init__.py for package |
|
77 | 77 | |
|
78 | 78 | Returns |
|
79 | 79 | ------- |
|
80 | 80 | context : dict |
|
81 | 81 | with named parameters of interest |
|
82 | 82 | """ |
|
83 | 83 | src, hsh = pkg_commit_hash(pkg_path) |
|
84 | 84 | return dict( |
|
85 | 85 | ipython_version=release.version, |
|
86 | 86 | ipython_path=pkg_path, |
|
87 | 87 | commit_source=src, |
|
88 | 88 | commit_hash=hsh, |
|
89 | 89 | sys_version=sys.version, |
|
90 | 90 | sys_executable=sys.executable, |
|
91 | 91 | sys_platform=sys.platform, |
|
92 | 92 | platform=platform.platform(), |
|
93 | 93 | os_name=os.name, |
|
94 | 94 | default_encoding=encoding.DEFAULT_ENCODING, |
|
95 | 95 | ) |
|
96 | 96 | |
|
97 | 97 | def get_sys_info() -> dict: |
|
98 | 98 | """Return useful information about IPython and the system, as a dict.""" |
|
99 | 99 | path = Path(__file__, "..").resolve().parent |
|
100 | 100 | return pkg_info(str(path)) |
|
101 | 101 | |
|
102 | def sys_info(): | |
|
102 | def sys_info() -> str: | |
|
103 | 103 | """Return useful information about IPython and the system, as a string. |
|
104 | 104 | |
|
105 | 105 | Examples |
|
106 | 106 | -------- |
|
107 | 107 | :: |
|
108 | 108 | |
|
109 | 109 | In [2]: print(sys_info()) |
|
110 | 110 | {'commit_hash': '144fdae', # random |
|
111 | 111 | 'commit_source': 'repository', |
|
112 | 112 | 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython', |
|
113 | 113 | 'ipython_version': '0.11.dev', |
|
114 | 114 | 'os_name': 'posix', |
|
115 | 115 | 'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick', |
|
116 | 116 | 'sys_executable': '/usr/bin/python', |
|
117 | 117 | 'sys_platform': 'linux2', |
|
118 | 118 | 'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \\n[GCC 4.4.5]'} |
|
119 | 119 | """ |
|
120 | 120 | return pprint.pformat(get_sys_info()) |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | def num_cpus(): |
|
124 | 124 | """DEPRECATED |
|
125 | 125 | |
|
126 | 126 | Return the effective number of CPUs in the system as an integer. |
|
127 | 127 | |
|
128 | 128 | This cross-platform function makes an attempt at finding the total number of |
|
129 | 129 | available CPUs in the system, as returned by various underlying system and |
|
130 | 130 | python calls. |
|
131 | 131 | |
|
132 | 132 | If it can't find a sensible answer, it returns 1 (though an error *may* make |
|
133 | 133 | it return a large positive number that's actually incorrect). |
|
134 | 134 | """ |
|
135 | 135 | import warnings |
|
136 | 136 | |
|
137 | 137 | warnings.warn( |
|
138 | 138 | "`num_cpus` is deprecated since IPython 8.0. Use `os.cpu_count` instead.", |
|
139 | 139 | DeprecationWarning, |
|
140 | 140 | stacklevel=2, |
|
141 | 141 | ) |
|
142 | 142 | |
|
143 | 143 | return os.cpu_count() or 1 |
@@ -1,385 +1,397 | |||
|
1 | 1 | [build-system] |
|
2 | 2 | requires = ["setuptools>=61.2"] |
|
3 | 3 | # We need access to the 'setupbase' module at build time. |
|
4 | 4 | # Hence we declare a custom build backend. |
|
5 | 5 | build-backend = "_build_meta" # just re-exports setuptools.build_meta definitions |
|
6 | 6 | backend-path = ["."] |
|
7 | 7 | |
|
8 | 8 | [project] |
|
9 | 9 | name = "ipython" |
|
10 | 10 | description = "IPython: Productive Interactive Computing" |
|
11 | 11 | keywords = ["Interactive", "Interpreter", "Shell", "Embedding"] |
|
12 | 12 | classifiers = [ |
|
13 | 13 | "Framework :: IPython", |
|
14 | 14 | "Framework :: Jupyter", |
|
15 | 15 | "Intended Audience :: Developers", |
|
16 | 16 | "Intended Audience :: Science/Research", |
|
17 | 17 | "License :: OSI Approved :: BSD License", |
|
18 | 18 | "Programming Language :: Python", |
|
19 | 19 | "Programming Language :: Python :: 3", |
|
20 | 20 | "Programming Language :: Python :: 3 :: Only", |
|
21 | 21 | "Topic :: System :: Shells", |
|
22 | 22 | ] |
|
23 | 23 | requires-python = ">=3.10" |
|
24 | 24 | dependencies = [ |
|
25 | 25 | 'colorama; sys_platform == "win32"', |
|
26 | 26 | "decorator", |
|
27 | 27 | "exceptiongroup; python_version<'3.11'", |
|
28 | 28 | "jedi>=0.16", |
|
29 | 29 | "matplotlib-inline", |
|
30 | 30 | 'pexpect>4.3; sys_platform != "win32" and sys_platform != "emscripten"', |
|
31 | 31 | "prompt_toolkit>=3.0.41,<3.1.0", |
|
32 | 32 | "pygments>=2.4.0", |
|
33 | 33 | "stack_data", |
|
34 | 34 | "traitlets>=5.13.0", |
|
35 | 35 | "typing_extensions>=4.6; python_version<'3.12'", |
|
36 | 36 | ] |
|
37 | 37 | dynamic = ["authors", "license", "version"] |
|
38 | 38 | |
|
39 | 39 | [project.entry-points."pygments.lexers"] |
|
40 | 40 | ipythonconsole = "IPython.lib.lexers:IPythonConsoleLexer" |
|
41 | 41 | ipython = "IPython.lib.lexers:IPythonLexer" |
|
42 | 42 | ipython3 = "IPython.lib.lexers:IPython3Lexer" |
|
43 | 43 | |
|
44 | 44 | [project.scripts] |
|
45 | 45 | ipython = "IPython:start_ipython" |
|
46 | 46 | ipython3 = "IPython:start_ipython" |
|
47 | 47 | |
|
48 | 48 | [project.readme] |
|
49 | 49 | file = "long_description.rst" |
|
50 | 50 | content-type = "text/x-rst" |
|
51 | 51 | |
|
52 | 52 | [project.urls] |
|
53 | 53 | Homepage = "https://ipython.org" |
|
54 | 54 | Documentation = "https://ipython.readthedocs.io/" |
|
55 | 55 | Funding = "https://numfocus.org/" |
|
56 | 56 | Source = "https://github.com/ipython/ipython" |
|
57 | 57 | Tracker = "https://github.com/ipython/ipython/issues" |
|
58 | 58 | |
|
59 | 59 | [project.optional-dependencies] |
|
60 | 60 | black = [ |
|
61 | 61 | "black", |
|
62 | 62 | ] |
|
63 | 63 | doc = [ |
|
64 | 64 | "docrepr", |
|
65 | 65 | "exceptiongroup", |
|
66 | 66 | "intersphinx_registry", |
|
67 | 67 | "ipykernel", |
|
68 | 68 | "ipython[test]", |
|
69 | 69 | "matplotlib", |
|
70 | 70 | "setuptools>=18.5", |
|
71 | 71 | "sphinx-rtd-theme", |
|
72 | 72 | "sphinx>=1.3", |
|
73 | 73 | "sphinxcontrib-jquery", |
|
74 | 74 | "tomli ; python_version<'3.11'", |
|
75 | 75 | "typing_extensions", |
|
76 | 76 | ] |
|
77 | 77 | kernel = [ |
|
78 | 78 | "ipykernel", |
|
79 | 79 | ] |
|
80 | 80 | nbconvert = [ |
|
81 | 81 | "nbconvert", |
|
82 | 82 | ] |
|
83 | 83 | nbformat = [ |
|
84 | 84 | "nbformat", |
|
85 | 85 | ] |
|
86 | 86 | notebook = [ |
|
87 | 87 | "ipywidgets", |
|
88 | 88 | "notebook", |
|
89 | 89 | ] |
|
90 | 90 | parallel = [ |
|
91 | 91 | "ipyparallel", |
|
92 | 92 | ] |
|
93 | 93 | qtconsole = [ |
|
94 | 94 | "qtconsole", |
|
95 | 95 | ] |
|
96 | 96 | terminal = [] |
|
97 | 97 | test = [ |
|
98 | 98 | "pytest", |
|
99 | 99 | "pytest-asyncio<0.22", |
|
100 | 100 | "testpath", |
|
101 | 101 | "pickleshare", |
|
102 | 102 | "packaging", |
|
103 | 103 | ] |
|
104 | 104 | test_extra = [ |
|
105 | 105 | "ipython[test]", |
|
106 | 106 | "curio", |
|
107 | 107 | "matplotlib!=3.2.0", |
|
108 | 108 | "nbformat", |
|
109 | 109 | "numpy>=1.23", |
|
110 | 110 | "pandas", |
|
111 | 111 | "trio", |
|
112 | 112 | ] |
|
113 | 113 | matplotlib = [ |
|
114 | 114 | "matplotlib" |
|
115 | 115 | ] |
|
116 | 116 | all = [ |
|
117 | 117 | "ipython[black,doc,kernel,nbconvert,nbformat,notebook,parallel,qtconsole,matplotlib]", |
|
118 | 118 | "ipython[test,test_extra]", |
|
119 | 119 | ] |
|
120 | 120 | |
|
121 | 121 | [tool.mypy] |
|
122 | 122 | python_version = "3.10" |
|
123 | 123 | ignore_missing_imports = true |
|
124 | 124 | follow_imports = 'silent' |
|
125 | 125 | exclude = [ |
|
126 | 126 | 'test_\.+\.py', |
|
127 | 127 | 'IPython.utils.tests.test_wildcard', |
|
128 | 128 | 'testing', |
|
129 | 129 | 'tests', |
|
130 | 130 | 'PyColorize.py', |
|
131 | 131 | '_process_win32_controller.py', |
|
132 | 132 | 'IPython/core/application.py', |
|
133 | 133 | 'IPython/core/profileapp.py', |
|
134 | 134 | 'IPython/lib/deepreload.py', |
|
135 | 135 | 'IPython/sphinxext/ipython_directive.py', |
|
136 | 136 | 'IPython/terminal/ipapp.py', |
|
137 | 137 | 'IPython/utils/_process_win32.py', |
|
138 | 138 | 'IPython/utils/path.py', |
|
139 | 139 | ] |
|
140 |
|
|
|
140 | # check_untyped_defs = true | |
|
141 | # disallow_untyped_calls = true | |
|
142 | # disallow_untyped_decorators = true | |
|
141 | 143 | # ignore_errors = false |
|
142 | 144 | # ignore_missing_imports = false |
|
143 | # disallow_untyped_calls = true | |
|
144 | 145 | disallow_incomplete_defs = true |
|
145 |
|
|
|
146 | # disallow_untyped_decorators = true | |
|
146 | disallow_untyped_defs = true | |
|
147 | 147 | warn_redundant_casts = true |
|
148 | 148 | |
|
149 | 149 | [[tool.mypy.overrides]] |
|
150 | 150 | module = [ |
|
151 | "IPython.core.crashhandler", | |
|
152 | ] | |
|
153 | check_untyped_defs = true | |
|
154 | disallow_incomplete_defs = true | |
|
155 | disallow_untyped_calls = true | |
|
156 | disallow_untyped_decorators = true | |
|
157 | disallow_untyped_defs = true | |
|
158 | ignore_errors = false | |
|
159 | ignore_missing_imports = false | |
|
160 | ||
|
161 | [[tool.mypy.overrides]] | |
|
162 | module = [ | |
|
151 | 163 | "IPython.utils.text", |
|
152 | 164 | ] |
|
153 | 165 | disallow_untyped_defs = true |
|
154 | 166 | check_untyped_defs = false |
|
155 | 167 | disallow_untyped_decorators = true |
|
156 | 168 | |
|
157 | 169 | [[tool.mypy.overrides]] |
|
158 | 170 | module = [ |
|
159 | 171 | ] |
|
160 | 172 | disallow_untyped_defs = false |
|
161 | 173 | ignore_errors = true |
|
162 | 174 | ignore_missing_imports = true |
|
163 | 175 | disallow_untyped_calls = false |
|
164 | 176 | disallow_incomplete_defs = false |
|
165 | 177 | check_untyped_defs = false |
|
166 | 178 | disallow_untyped_decorators = false |
|
167 | 179 | |
|
180 | ||
|
168 | 181 | # gloabl ignore error |
|
169 | 182 | [[tool.mypy.overrides]] |
|
170 | 183 | module = [ |
|
171 | 184 | "IPython", |
|
172 | 185 | "IPython.conftest", |
|
173 | 186 | "IPython.core.alias", |
|
174 | 187 | "IPython.core.async_helpers", |
|
175 | 188 | "IPython.core.autocall", |
|
176 | 189 | "IPython.core.builtin_trap", |
|
177 | 190 | "IPython.core.compilerop", |
|
178 | 191 | "IPython.core.completer", |
|
179 | 192 | "IPython.core.completerlib", |
|
180 | "IPython.core.crashhandler", | |
|
181 | 193 | "IPython.core.debugger", |
|
182 | 194 | "IPython.core.display", |
|
183 | 195 | "IPython.core.display_functions", |
|
184 | 196 | "IPython.core.display_trap", |
|
185 | 197 | "IPython.core.displayhook", |
|
186 | 198 | "IPython.core.displaypub", |
|
187 | 199 | "IPython.core.events", |
|
188 | 200 | "IPython.core.excolors", |
|
189 | 201 | "IPython.core.extensions", |
|
190 | 202 | "IPython.core.formatters", |
|
191 | 203 | "IPython.core.getipython", |
|
192 | 204 | "IPython.core.guarded_eval", |
|
193 | 205 | "IPython.core.history", |
|
194 | 206 | "IPython.core.historyapp", |
|
195 | 207 | "IPython.core.hooks", |
|
196 | 208 | "IPython.core.inputsplitter", |
|
197 | 209 | "IPython.core.inputtransformer", |
|
198 | 210 | "IPython.core.inputtransformer2", |
|
199 | 211 | "IPython.core.interactiveshell", |
|
200 | 212 | "IPython.core.logger", |
|
201 | 213 | "IPython.core.macro", |
|
202 | 214 | "IPython.core.magic", |
|
203 | 215 | "IPython.core.magic_arguments", |
|
204 | 216 | "IPython.core.magics.ast_mod", |
|
205 | 217 | "IPython.core.magics.auto", |
|
206 | 218 | "IPython.core.magics.basic", |
|
207 | 219 | "IPython.core.magics.code", |
|
208 | 220 | "IPython.core.magics.config", |
|
209 | 221 | "IPython.core.magics.display", |
|
210 | 222 | "IPython.core.magics.execution", |
|
211 | 223 | "IPython.core.magics.extension", |
|
212 | 224 | "IPython.core.magics.history", |
|
213 | 225 | "IPython.core.magics.logging", |
|
214 | 226 | "IPython.core.magics.namespace", |
|
215 | 227 | "IPython.core.magics.osm", |
|
216 | 228 | "IPython.core.magics.packaging", |
|
217 | 229 | "IPython.core.magics.pylab", |
|
218 | 230 | "IPython.core.magics.script", |
|
219 | 231 | "IPython.core.oinspect", |
|
220 | 232 | "IPython.core.page", |
|
221 | 233 | "IPython.core.payload", |
|
222 | 234 | "IPython.core.payloadpage", |
|
223 | 235 | "IPython.core.prefilter", |
|
224 | 236 | "IPython.core.profiledir", |
|
225 | 237 | "IPython.core.prompts", |
|
226 | 238 | "IPython.core.pylabtools", |
|
227 | 239 | "IPython.core.shellapp", |
|
228 | 240 | "IPython.core.splitinput", |
|
229 | 241 | "IPython.core.ultratb", |
|
230 | 242 | "IPython.extensions.autoreload", |
|
231 | 243 | "IPython.extensions.storemagic", |
|
232 | 244 | "IPython.external.qt_for_kernel", |
|
233 | 245 | "IPython.external.qt_loaders", |
|
234 | 246 | "IPython.lib.backgroundjobs", |
|
235 | 247 | "IPython.lib.clipboard", |
|
236 | 248 | "IPython.lib.demo", |
|
237 | 249 | "IPython.lib.display", |
|
238 | 250 | "IPython.lib.editorhooks", |
|
239 | 251 | "IPython.lib.guisupport", |
|
240 | 252 | "IPython.lib.latextools", |
|
241 | 253 | "IPython.lib.lexers", |
|
242 | 254 | "IPython.lib.pretty", |
|
243 | 255 | "IPython.paths", |
|
244 | 256 | "IPython.sphinxext.ipython_console_highlighting", |
|
245 | 257 | "IPython.terminal.debugger", |
|
246 | 258 | "IPython.terminal.embed", |
|
247 | 259 | "IPython.terminal.interactiveshell", |
|
248 | 260 | "IPython.terminal.magics", |
|
249 | 261 | "IPython.terminal.prompts", |
|
250 | 262 | "IPython.terminal.pt_inputhooks", |
|
251 | 263 | "IPython.terminal.pt_inputhooks.asyncio", |
|
252 | 264 | "IPython.terminal.pt_inputhooks.glut", |
|
253 | 265 | "IPython.terminal.pt_inputhooks.gtk", |
|
254 | 266 | "IPython.terminal.pt_inputhooks.gtk3", |
|
255 | 267 | "IPython.terminal.pt_inputhooks.gtk4", |
|
256 | 268 | "IPython.terminal.pt_inputhooks.osx", |
|
257 | 269 | "IPython.terminal.pt_inputhooks.pyglet", |
|
258 | 270 | "IPython.terminal.pt_inputhooks.qt", |
|
259 | 271 | "IPython.terminal.pt_inputhooks.tk", |
|
260 | 272 | "IPython.terminal.pt_inputhooks.wx", |
|
261 | 273 | "IPython.terminal.ptutils", |
|
262 | 274 | "IPython.terminal.shortcuts", |
|
263 | 275 | "IPython.terminal.shortcuts.auto_match", |
|
264 | 276 | "IPython.terminal.shortcuts.auto_suggest", |
|
265 | 277 | "IPython.terminal.shortcuts.filters", |
|
266 | 278 | "IPython.utils._process_cli", |
|
267 | 279 | "IPython.utils._process_common", |
|
268 | 280 | "IPython.utils._process_emscripten", |
|
269 | 281 | "IPython.utils._process_posix", |
|
270 | 282 | "IPython.utils.capture", |
|
271 | 283 | "IPython.utils.coloransi", |
|
272 | 284 | "IPython.utils.contexts", |
|
273 | 285 | "IPython.utils.data", |
|
274 | 286 | "IPython.utils.decorators", |
|
275 | 287 | "IPython.utils.dir2", |
|
276 | 288 | "IPython.utils.encoding", |
|
277 | 289 | "IPython.utils.frame", |
|
278 | 290 | "IPython.utils.generics", |
|
279 | 291 | "IPython.utils.importstring", |
|
280 | 292 | "IPython.utils.io", |
|
281 | 293 | "IPython.utils.ipstruct", |
|
282 | 294 | "IPython.utils.module_paths", |
|
283 | 295 | "IPython.utils.openpy", |
|
284 | 296 | "IPython.utils.process", |
|
285 | 297 | "IPython.utils.py3compat", |
|
286 | 298 | "IPython.utils.sentinel", |
|
287 | 299 | "IPython.utils.shimmodule", |
|
288 | 300 | "IPython.utils.strdispatch", |
|
289 | 301 | "IPython.utils.sysinfo", |
|
290 | 302 | "IPython.utils.syspathcontext", |
|
291 | 303 | "IPython.utils.tempdir", |
|
292 | 304 | "IPython.utils.terminal", |
|
293 | 305 | "IPython.utils.timing", |
|
294 | 306 | "IPython.utils.tokenutil", |
|
295 | 307 | "IPython.utils.tz", |
|
296 | 308 | "IPython.utils.ulinecache", |
|
297 | 309 | "IPython.utils.version", |
|
298 | 310 | "IPython.utils.wildcard", |
|
299 | 311 | |
|
300 | 312 | ] |
|
301 | 313 | disallow_untyped_defs = false |
|
302 | 314 | ignore_errors = true |
|
303 | 315 | ignore_missing_imports = true |
|
304 | 316 | disallow_untyped_calls = false |
|
305 | 317 | disallow_incomplete_defs = false |
|
306 | 318 | check_untyped_defs = false |
|
307 | 319 | disallow_untyped_decorators = false |
|
308 | 320 | |
|
309 | 321 | [tool.pytest.ini_options] |
|
310 | 322 | addopts = [ |
|
311 | 323 | "--durations=10", |
|
312 | 324 | "-pIPython.testing.plugin.pytest_ipdoctest", |
|
313 | 325 | "--ipdoctest-modules", |
|
314 | 326 | "--ignore=docs", |
|
315 | 327 | "--ignore=examples", |
|
316 | 328 | "--ignore=htmlcov", |
|
317 | 329 | "--ignore=ipython_kernel", |
|
318 | 330 | "--ignore=ipython_parallel", |
|
319 | 331 | "--ignore=results", |
|
320 | 332 | "--ignore=tmp", |
|
321 | 333 | "--ignore=tools", |
|
322 | 334 | "--ignore=traitlets", |
|
323 | 335 | "--ignore=IPython/core/tests/daft_extension", |
|
324 | 336 | "--ignore=IPython/sphinxext", |
|
325 | 337 | "--ignore=IPython/terminal/pt_inputhooks", |
|
326 | 338 | "--ignore=IPython/__main__.py", |
|
327 | 339 | "--ignore=IPython/external/qt_for_kernel.py", |
|
328 | 340 | "--ignore=IPython/html/widgets/widget_link.py", |
|
329 | 341 | "--ignore=IPython/html/widgets/widget_output.py", |
|
330 | 342 | "--ignore=IPython/terminal/console.py", |
|
331 | 343 | "--ignore=IPython/utils/_process_cli.py", |
|
332 | 344 | "--ignore=IPython/utils/_process_posix.py", |
|
333 | 345 | "--ignore=IPython/utils/_process_win32.py", |
|
334 | 346 | "--ignore=IPython/utils/_process_win32_controller.py", |
|
335 | 347 | "--ignore=IPython/utils/daemonize.py", |
|
336 | 348 | "--ignore=IPython/utils/eventful.py", |
|
337 | 349 | "--ignore=IPython/kernel", |
|
338 | 350 | "--ignore=IPython/consoleapp.py", |
|
339 | 351 | "--ignore=IPython/core/inputsplitter.py", |
|
340 | 352 | "--ignore=IPython/lib/kernel.py", |
|
341 | 353 | "--ignore=IPython/utils/jsonutil.py", |
|
342 | 354 | "--ignore=IPython/utils/localinterfaces.py", |
|
343 | 355 | "--ignore=IPython/utils/log.py", |
|
344 | 356 | "--ignore=IPython/utils/signatures.py", |
|
345 | 357 | "--ignore=IPython/utils/traitlets.py", |
|
346 | 358 | "--ignore=IPython/utils/version.py" |
|
347 | 359 | ] |
|
348 | 360 | doctest_optionflags = [ |
|
349 | 361 | "NORMALIZE_WHITESPACE", |
|
350 | 362 | "ELLIPSIS" |
|
351 | 363 | ] |
|
352 | 364 | ipdoctest_optionflags = [ |
|
353 | 365 | "NORMALIZE_WHITESPACE", |
|
354 | 366 | "ELLIPSIS" |
|
355 | 367 | ] |
|
356 | 368 | asyncio_mode = "strict" |
|
357 | 369 | |
|
358 | 370 | [tool.pyright] |
|
359 | 371 | pythonPlatform="All" |
|
360 | 372 | |
|
361 | 373 | [tool.setuptools] |
|
362 | 374 | zip-safe = false |
|
363 | 375 | platforms = ["Linux", "Mac OSX", "Windows"] |
|
364 | 376 | license-files = ["LICENSE"] |
|
365 | 377 | include-package-data = false |
|
366 | 378 | |
|
367 | 379 | [tool.setuptools.packages.find] |
|
368 | 380 | exclude = ["setupext"] |
|
369 | 381 | namespaces = false |
|
370 | 382 | |
|
371 | 383 | [tool.setuptools.package-data] |
|
372 | 384 | "IPython" = ["py.typed"] |
|
373 | 385 | "IPython.core" = ["profile/README*"] |
|
374 | 386 | "IPython.core.tests" = ["*.png", "*.jpg", "daft_extension/*.py"] |
|
375 | 387 | "IPython.lib.tests" = ["*.wav"] |
|
376 | 388 | "IPython.testing.plugin" = ["*.txt"] |
|
377 | 389 | |
|
378 | 390 | [tool.setuptools.dynamic] |
|
379 | 391 | version = {attr = "IPython.core.release.__version__"} |
|
380 | 392 | |
|
381 | 393 | [tool.coverage.run] |
|
382 | 394 | omit = [ |
|
383 | 395 | # omit everything in /tmp as we run tempfile |
|
384 | 396 | "/tmp/*", |
|
385 | 397 | ] |
General Comments 0
You need to be logged in to leave comments.
Login now