passagemath-repl 10.5.43__py3-none-any.whl → 10.6.1rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_repl-10.6.1rc1.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- {passagemath_repl-10.5.43.dist-info → passagemath_repl-10.6.1rc1.dist-info}/METADATA +5 -6
- {passagemath_repl-10.5.43.dist-info → passagemath_repl-10.6.1rc1.dist-info}/RECORD +53 -52
- sage/all__sagemath_repl.py +0 -6
- sage/doctest/__main__.py +1 -1
- sage/doctest/control.py +30 -28
- sage/doctest/external.py +31 -27
- sage/doctest/fixtures.py +37 -11
- sage/doctest/forker.py +8 -5
- sage/doctest/parsing.py +42 -27
- sage/doctest/sources.py +10 -0
- sage/doctest/test.py +18 -5
- sage/doctest/tests/fail_and_die.rst +4 -1
- sage/doctest/util.py +7 -4
- sage/misc/banner.py +12 -4
- sage/misc/cython.py +8 -5
- sage/misc/dev_tools.py +10 -84
- sage/misc/gperftools.py +13 -14
- sage/repl/configuration.py +4 -4
- sage/repl/ipython_extension.py +12 -8
- sage/repl/ipython_kernel/install.py +1 -1
- sage/repl/ipython_kernel/widgets.py +1 -1
- sage/repl/ipython_tests.py +19 -2
- sage/repl/rich_output/backend_ipython.py +0 -1
- sage/repl/rich_output/display_manager.py +1 -1
- sage/tests/all.py +1 -0
- sage/tests/benchmark.py +6 -2
- sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +1 -1
- sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +1 -1
- sage/tests/cmdline.py +6 -4
- sage/tests/startup.py +1 -1
- passagemath_repl-10.5.43.data/data/share/jupyter/kernels/sagemath/kernel.json +0 -1
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/data/share/jupyter/kernels/sagemath/logo.svg +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.43.dist-info → passagemath_repl-10.6.1rc1.dist-info}/WHEEL +0 -0
- {passagemath_repl-10.5.43.dist-info → passagemath_repl-10.6.1rc1.dist-info}/top_level.txt +0 -0
sage/misc/gperftools.py
CHANGED
@@ -19,7 +19,7 @@ EXAMPLES::
|
|
19
19
|
|
20
20
|
REFERENCE:
|
21
21
|
|
22
|
-
|
22
|
+
This uses the `Google performance analysis tools
|
23
23
|
<https://github.com/gperftools/gperftools>`_. Note that they are not
|
24
24
|
included in Sage, you have to install them yourself on your system.
|
25
25
|
|
@@ -36,13 +36,12 @@ AUTHORS:
|
|
36
36
|
# https://www.gnu.org/licenses/
|
37
37
|
# ****************************************************************************
|
38
38
|
|
39
|
-
import sys
|
40
39
|
import ctypes
|
40
|
+
import sys
|
41
41
|
import time
|
42
|
-
|
42
|
+
|
43
43
|
from sage.misc.cachefunc import cached_method
|
44
|
-
from sage.
|
45
|
-
from sage.cpython.string import bytes_to_str
|
44
|
+
from sage.structure.sage_object import SageObject
|
46
45
|
|
47
46
|
|
48
47
|
libc = None
|
@@ -51,7 +50,7 @@ libprofiler = None
|
|
51
50
|
|
52
51
|
class Profiler(SageObject):
|
53
52
|
|
54
|
-
def __init__(self, filename=None):
|
53
|
+
def __init__(self, filename=None) -> None:
|
55
54
|
"""
|
56
55
|
Interface to the gperftools profiler.
|
57
56
|
|
@@ -72,7 +71,7 @@ class Profiler(SageObject):
|
|
72
71
|
else:
|
73
72
|
self._filename = filename
|
74
73
|
|
75
|
-
def filename(self):
|
74
|
+
def filename(self) -> str:
|
76
75
|
"""
|
77
76
|
Return the file name.
|
78
77
|
|
@@ -87,7 +86,7 @@ class Profiler(SageObject):
|
|
87
86
|
"""
|
88
87
|
return self._filename
|
89
88
|
|
90
|
-
def _repr_(self):
|
89
|
+
def _repr_(self) -> str:
|
91
90
|
"""
|
92
91
|
Return string representation.
|
93
92
|
|
@@ -99,7 +98,7 @@ class Profiler(SageObject):
|
|
99
98
|
sage: Profiler()
|
100
99
|
Profiler logging to .../tmp....perf
|
101
100
|
"""
|
102
|
-
return 'Profiler logging to {
|
101
|
+
return f'Profiler logging to {self.filename()}'
|
103
102
|
|
104
103
|
def _libprofiler(self):
|
105
104
|
"""
|
@@ -168,7 +167,7 @@ class Profiler(SageObject):
|
|
168
167
|
'less than 100ms', RuntimeWarning)
|
169
168
|
|
170
169
|
@cached_method
|
171
|
-
def _pprof(self):
|
170
|
+
def _pprof(self) -> str:
|
172
171
|
"""
|
173
172
|
Return the name of the ``pprof`` binary.
|
174
173
|
|
@@ -191,10 +190,10 @@ class Profiler(SageObject):
|
|
191
190
|
from subprocess import check_output, CalledProcessError, STDOUT
|
192
191
|
for name in potential_names:
|
193
192
|
try:
|
194
|
-
|
193
|
+
bytes_version = check_output([name, '--version'], stderr=STDOUT)
|
195
194
|
except (CalledProcessError, OSError):
|
196
195
|
continue
|
197
|
-
version =
|
196
|
+
version = bytes_version.decode()
|
198
197
|
if 'gperftools' not in version:
|
199
198
|
from warnings import warn
|
200
199
|
warn('the "{0}" utility does not appear to be the gperftools profiler'
|
@@ -203,7 +202,7 @@ class Profiler(SageObject):
|
|
203
202
|
return name
|
204
203
|
raise OSError('unable to run pprof, please install gperftools')
|
205
204
|
|
206
|
-
def _executable(self):
|
205
|
+
def _executable(self) -> str:
|
207
206
|
"""
|
208
207
|
Return the name of the Sage Python interpreter.
|
209
208
|
|
@@ -342,7 +341,7 @@ def crun(s, evaluator):
|
|
342
341
|
prof.top()
|
343
342
|
|
344
343
|
|
345
|
-
def run_100ms():
|
344
|
+
def run_100ms() -> None:
|
346
345
|
"""
|
347
346
|
Used for doctesting.
|
348
347
|
|
sage/repl/configuration.py
CHANGED
@@ -25,13 +25,13 @@ the IPython simple prompt is being used::
|
|
25
25
|
# ****************************************************************************
|
26
26
|
|
27
27
|
|
28
|
-
import sys
|
29
28
|
import copy
|
29
|
+
import sys
|
30
|
+
|
30
31
|
from traitlets.config.loader import Config
|
31
32
|
|
32
33
|
from sage.repl.prompts import SagePrompts
|
33
34
|
|
34
|
-
|
35
35
|
# Name of the Sage IPython extension
|
36
36
|
SAGE_EXTENSION = 'sage'
|
37
37
|
|
@@ -72,7 +72,7 @@ class SageIpythonConfiguration:
|
|
72
72
|
"""
|
73
73
|
Return the IPython color palette.
|
74
74
|
|
75
|
-
This returns ``'
|
75
|
+
This returns ``'nocolor'`` during doctests to avoid ANSI escape
|
76
76
|
sequences.
|
77
77
|
|
78
78
|
EXAMPLES::
|
@@ -82,7 +82,7 @@ class SageIpythonConfiguration:
|
|
82
82
|
True
|
83
83
|
"""
|
84
84
|
if not self._allow_ansi():
|
85
|
-
return '
|
85
|
+
return 'nocolor'
|
86
86
|
from sage.repl.interpreter import SageTerminalInteractiveShell
|
87
87
|
return SageTerminalInteractiveShell.colors.default()
|
88
88
|
|
sage/repl/ipython_extension.py
CHANGED
@@ -64,14 +64,14 @@ In contrast, input to the ``%time`` magic command is preparsed::
|
|
64
64
|
sage: shell.quit()
|
65
65
|
"""
|
66
66
|
|
67
|
-
from IPython.core.magic import Magics, magics_class, line_magic, cell_magic
|
68
67
|
from IPython.core.display import HTML
|
69
68
|
from IPython.core.getipython import get_ipython
|
69
|
+
from IPython.core.magic import Magics, cell_magic, line_magic, magics_class
|
70
70
|
|
71
|
-
from sage.repl.load import load_wrap
|
72
71
|
from sage.env import SAGE_IMPORTALL, SAGE_STARTUP_FILE
|
73
72
|
from sage.misc.lazy_import import LazyImport
|
74
73
|
from sage.misc.misc import run_once
|
74
|
+
from sage.repl.load import load_wrap
|
75
75
|
|
76
76
|
|
77
77
|
def _running_in_notebook():
|
@@ -321,7 +321,7 @@ class SageMagics(Magics):
|
|
321
321
|
if max_width <= 0:
|
322
322
|
raise ValueError(
|
323
323
|
"max width must be a positive integer")
|
324
|
-
|
324
|
+
from sage.typeset import character_art
|
325
325
|
character_art.MAX_WIDTH = max_width
|
326
326
|
dm.preferences.text = arg0
|
327
327
|
# Unset all
|
@@ -478,9 +478,10 @@ class SageMagics(Magics):
|
|
478
478
|
...
|
479
479
|
ValueError: No closing quotation
|
480
480
|
"""
|
481
|
-
from sage.misc.cython import cython_compile
|
482
|
-
import shlex
|
483
481
|
import argparse
|
482
|
+
import shlex
|
483
|
+
|
484
|
+
from sage.misc.cython import cython_compile
|
484
485
|
|
485
486
|
class ExitCatchingArgumentParser(argparse.ArgumentParser):
|
486
487
|
def error(self, message):
|
@@ -654,6 +655,7 @@ class SageCustomizations:
|
|
654
655
|
IPython.core.oinspect.getsource = LazyImport("sage.misc.sagedoc", "my_getsource")
|
655
656
|
IPython.core.oinspect.find_file = LazyImport("sage.misc.sageinspect", "sage_getfile")
|
656
657
|
IPython.core.oinspect.getargspec = LazyImport("sage.misc.sageinspect", "sage_getargspec")
|
658
|
+
IPython.core.oinspect.signature = LazyImport("sage.misc.sageinspect", "sage_signature") # pyright: ignore [reportPrivateImportUsage]
|
657
659
|
|
658
660
|
def init_line_transforms(self):
|
659
661
|
"""
|
@@ -663,12 +665,13 @@ class SageCustomizations:
|
|
663
665
|
|
664
666
|
Check that :issue:`31951` is fixed::
|
665
667
|
|
668
|
+
sage: # indirect doctest
|
666
669
|
sage: from IPython import get_ipython
|
667
670
|
sage: ip = get_ipython()
|
668
|
-
sage: ip.input_transformer_manager.check_complete('''
|
671
|
+
sage: ip.input_transformer_manager.check_complete('''
|
669
672
|
....: for i in [1 .. 2]:
|
670
673
|
....: a = 2''')
|
671
|
-
('incomplete',
|
674
|
+
('incomplete', 4)
|
672
675
|
sage: ip.input_transformer_manager.check_complete('''
|
673
676
|
....: def foo(L)
|
674
677
|
....: K.<a> = L''')
|
@@ -704,7 +707,8 @@ class SageCustomizations:
|
|
704
707
|
('incomplete', 4)
|
705
708
|
"""
|
706
709
|
from IPython.core.inputtransformer2 import TransformerManager
|
707
|
-
|
710
|
+
|
711
|
+
from sage.repl.interpreter import SagePreparseTransformer, SagePromptTransformer
|
708
712
|
|
709
713
|
self.shell.input_transformer_manager.cleanup_transforms.insert(1, SagePromptTransformer)
|
710
714
|
self.shell.input_transformers_post.append(SagePreparseTransformer)
|
@@ -269,7 +269,7 @@ class SageKernelSpec:
|
|
269
269
|
'(see https://docs.jupyter.org/en/latest/use/jupyter-directories.html)')
|
270
270
|
|
271
271
|
|
272
|
-
def have_prerequisites(debug=True):
|
272
|
+
def have_prerequisites(debug=True) -> bool:
|
273
273
|
"""
|
274
274
|
Check that we have all prerequisites to run the Jupyter notebook.
|
275
275
|
|
@@ -21,7 +21,7 @@ We need to setup a proper test environment for widgets::
|
|
21
21
|
# it under the terms of the GNU General Public License as published by
|
22
22
|
# the Free Software Foundation, either version 2 of the License, or
|
23
23
|
# (at your option) any later version.
|
24
|
-
#
|
24
|
+
# https://www.gnu.org/licenses/
|
25
25
|
# ****************************************************************************
|
26
26
|
|
27
27
|
|
sage/repl/ipython_tests.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Tests for the IPython integration
|
4
4
|
|
5
5
|
First, test the pinfo magic for Python code. This is what IPython
|
6
|
-
calls when you ask for the single-questionmark help, like
|
6
|
+
calls when you ask for the single-questionmark help, like ``foo?`` ::
|
7
7
|
|
8
8
|
sage: from sage.repl.interpreter import get_test_shell
|
9
9
|
sage: shell = get_test_shell()
|
@@ -45,6 +45,23 @@ Next, test the pinfo magic for Cython code::
|
|
45
45
|
Type: type
|
46
46
|
...
|
47
47
|
|
48
|
+
Test that the signature is displayed even with ``binding=False``
|
49
|
+
as long as ``embedsignature=True`` is set
|
50
|
+
(unfortunately the type is not displayed, see ``sage_signature``)::
|
51
|
+
|
52
|
+
sage: shell.run_cell(r"""
|
53
|
+
....: %%cython
|
54
|
+
....: # cython: binding=False, embedsignature=True
|
55
|
+
....: cpdef int f(int a):
|
56
|
+
....: return a+1
|
57
|
+
....: """)
|
58
|
+
sage: shell.run_cell(u'print(f.__doc__)')
|
59
|
+
f(int a) -> int
|
60
|
+
File: ....pyx (starting at line 2)
|
61
|
+
sage: shell.run_cell(u'%pinfo f')
|
62
|
+
Signature: f(a)
|
63
|
+
...
|
64
|
+
|
48
65
|
Next, test the ``pinfo`` magic for ``R`` interface code, see :issue:`26906`::
|
49
66
|
|
50
67
|
sage: from sage.repl.interpreter import get_test_shell # optional - rpy2
|
@@ -62,7 +79,7 @@ Next, test the ``pinfo`` magic for ``R`` interface code, see :issue:`26906`::
|
|
62
79
|
...
|
63
80
|
|
64
81
|
Next, test the pinfo2 magic for Python code. This is what IPython
|
65
|
-
calls when you ask for the double-questionmark help, like
|
82
|
+
calls when you ask for the double-questionmark help, like ``foo??`` ::
|
66
83
|
|
67
84
|
sage: from sage.repl.interpreter import get_test_shell
|
68
85
|
sage: shell = get_test_shell()
|
@@ -16,7 +16,6 @@ This module defines the IPython backends for
|
|
16
16
|
# ****************************************************************************
|
17
17
|
|
18
18
|
import os
|
19
|
-
import sys
|
20
19
|
import html
|
21
20
|
from IPython.display import publish_display_data
|
22
21
|
from sage.repl.rich_output.backend_base import BackendBase
|
@@ -40,7 +40,7 @@ from typing import Any
|
|
40
40
|
try:
|
41
41
|
from typing import Self # type: ignore (Python >= 3.11)
|
42
42
|
except ImportError:
|
43
|
-
from typing_extensions import Self # type: ignore (Python 3.
|
43
|
+
from typing_extensions import Self # type: ignore (Python 3.10)
|
44
44
|
|
45
45
|
from sage.repl.rich_output.output_basic import (
|
46
46
|
OutputAsciiArt,
|
sage/tests/all.py
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
sage/tests/benchmark.py
CHANGED
@@ -16,7 +16,11 @@ TESTS::
|
|
16
16
|
|
17
17
|
sage: import sage.tests.benchmark
|
18
18
|
"""
|
19
|
-
|
19
|
+
import sys
|
20
|
+
|
21
|
+
if sys.platform != 'win32':
|
22
|
+
from cysignals.alarm import AlarmInterrupt, alarm, cancel_alarm
|
23
|
+
|
20
24
|
from sage.combinat.combinat import fibonacci
|
21
25
|
from sage.functions.other import factorial
|
22
26
|
from sage.interfaces.gp import gp
|
@@ -34,10 +38,10 @@ from sage.modular.modsym.modsym import ModularSymbols
|
|
34
38
|
from sage.rings.complex_mpfr import ComplexField
|
35
39
|
from sage.rings.finite_rings.finite_field_constructor import GF
|
36
40
|
from sage.rings.finite_rings.integer_mod_ring import Integers
|
37
|
-
from sage.rings.rational_field import QQ
|
38
41
|
from sage.rings.integer import Integer
|
39
42
|
from sage.rings.integer_ring import ZZ
|
40
43
|
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
|
44
|
+
from sage.rings.rational_field import QQ
|
41
45
|
from sage.schemes.elliptic_curves.constructor import EllipticCurve
|
42
46
|
|
43
47
|
lazy_import('sage.interfaces.macaulay2', 'macaulay2')
|
sage/tests/cmdline.py
CHANGED
@@ -110,9 +110,10 @@ def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False
|
|
110
110
|
Run Sage itself with various options::
|
111
111
|
|
112
112
|
sage: # long time
|
113
|
+
sage: from sage.version import banner
|
113
114
|
sage: (out, err, ret) = test_executable([
|
114
115
|
....: "sage"], pydebug_ignore_warnings=True)
|
115
|
-
sage: out.find(
|
116
|
+
sage: out.find(banner) >= 0
|
116
117
|
True
|
117
118
|
sage: err
|
118
119
|
''
|
@@ -122,7 +123,7 @@ def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False
|
|
122
123
|
sage: # long time
|
123
124
|
sage: (out, err, ret) = test_executable([
|
124
125
|
....: "sage"], "3^33\n", pydebug_ignore_warnings=True)
|
125
|
-
sage: out.find(
|
126
|
+
sage: out.find(banner) >= 0
|
126
127
|
True
|
127
128
|
sage: out.find("5559060566555523") >= 0
|
128
129
|
True
|
@@ -134,7 +135,7 @@ def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False
|
|
134
135
|
sage: # long time
|
135
136
|
sage: (out, err, ret) = test_executable([
|
136
137
|
....: "sage", "-q"], "3^33\n", pydebug_ignore_warnings=True)
|
137
|
-
sage: out.find(
|
138
|
+
sage: out.find(banner) >= 0
|
138
139
|
False
|
139
140
|
sage: out.find("5559060566555523") >= 0
|
140
141
|
True
|
@@ -206,7 +207,8 @@ def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False
|
|
206
207
|
Basic information about the Sage installation::
|
207
208
|
|
208
209
|
sage: (out, err, ret) = test_executable(["sage", "-v"])
|
209
|
-
sage:
|
210
|
+
sage: from sage.version import banner
|
211
|
+
sage: out.find(banner) >= 0
|
210
212
|
True
|
211
213
|
sage: err
|
212
214
|
''
|
sage/tests/startup.py
CHANGED
@@ -9,7 +9,7 @@ not work. Instead, we test this by starting a new Python process::
|
|
9
9
|
sage: from sage.tests.cmdline import test_executable
|
10
10
|
sage: environment = "sage.all"
|
11
11
|
sage: cmd = f"from {environment} import *\nprint('IPython' in sys.modules)\n"
|
12
|
-
sage: print(test_executable(["
|
12
|
+
sage: print(test_executable(["python3"], cmd)[0]) # long time
|
13
13
|
False
|
14
14
|
|
15
15
|
Check that numpy (:issue:`11714`) and pyparsing are not imported on startup
|
@@ -1 +0,0 @@
|
|
1
|
-
{"argv": ["python3", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"], "display_name": "passagemath 10.5.43", "language": "sage"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-inline-fortran
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{passagemath_repl-10.5.43.data → passagemath_repl-10.6.1rc1.data}/scripts/sage-startuptime.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|