passagemath-environment 10.4.1__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.
Files changed (70) hide show
  1. passagemath_environment-10.4.1.data/scripts/sage +1140 -0
  2. passagemath_environment-10.4.1.data/scripts/sage-env +667 -0
  3. passagemath_environment-10.4.1.data/scripts/sage-num-threads.py +105 -0
  4. passagemath_environment-10.4.1.data/scripts/sage-python +2 -0
  5. passagemath_environment-10.4.1.data/scripts/sage-venv-config +42 -0
  6. passagemath_environment-10.4.1.data/scripts/sage-version.sh +9 -0
  7. passagemath_environment-10.4.1.dist-info/METADATA +76 -0
  8. passagemath_environment-10.4.1.dist-info/RECORD +70 -0
  9. passagemath_environment-10.4.1.dist-info/WHEEL +5 -0
  10. passagemath_environment-10.4.1.dist-info/top_level.txt +1 -0
  11. sage/all__sagemath_environment.py +4 -0
  12. sage/env.py +496 -0
  13. sage/features/__init__.py +981 -0
  14. sage/features/all.py +126 -0
  15. sage/features/bliss.py +85 -0
  16. sage/features/cddlib.py +38 -0
  17. sage/features/coxeter3.py +45 -0
  18. sage/features/csdp.py +83 -0
  19. sage/features/cython.py +38 -0
  20. sage/features/databases.py +302 -0
  21. sage/features/dvipng.py +40 -0
  22. sage/features/ecm.py +42 -0
  23. sage/features/ffmpeg.py +119 -0
  24. sage/features/four_ti_2.py +55 -0
  25. sage/features/fricas.py +66 -0
  26. sage/features/gap.py +86 -0
  27. sage/features/gfan.py +38 -0
  28. sage/features/giac.py +30 -0
  29. sage/features/graph_generators.py +171 -0
  30. sage/features/graphviz.py +117 -0
  31. sage/features/igraph.py +44 -0
  32. sage/features/imagemagick.py +138 -0
  33. sage/features/interfaces.py +256 -0
  34. sage/features/internet.py +65 -0
  35. sage/features/jmol.py +44 -0
  36. sage/features/join_feature.py +146 -0
  37. sage/features/kenzo.py +77 -0
  38. sage/features/latex.py +300 -0
  39. sage/features/latte.py +85 -0
  40. sage/features/lrs.py +164 -0
  41. sage/features/mcqd.py +45 -0
  42. sage/features/meataxe.py +46 -0
  43. sage/features/mip_backends.py +114 -0
  44. sage/features/msolve.py +68 -0
  45. sage/features/nauty.py +70 -0
  46. sage/features/normaliz.py +43 -0
  47. sage/features/palp.py +65 -0
  48. sage/features/pandoc.py +42 -0
  49. sage/features/pdf2svg.py +41 -0
  50. sage/features/phitigra.py +42 -0
  51. sage/features/pkg_systems.py +195 -0
  52. sage/features/polymake.py +43 -0
  53. sage/features/poppler.py +58 -0
  54. sage/features/rubiks.py +180 -0
  55. sage/features/sagemath.py +1205 -0
  56. sage/features/sat.py +103 -0
  57. sage/features/singular.py +48 -0
  58. sage/features/sirocco.py +45 -0
  59. sage/features/sphinx.py +71 -0
  60. sage/features/standard.py +38 -0
  61. sage/features/symengine_py.py +44 -0
  62. sage/features/tdlib.py +38 -0
  63. sage/features/threejs.py +75 -0
  64. sage/features/topcom.py +67 -0
  65. sage/misc/all__sagemath_environment.py +2 -0
  66. sage/misc/package.py +570 -0
  67. sage/misc/package_dir.py +621 -0
  68. sage/misc/temporary_file.py +546 -0
  69. sage/misc/viewer.py +369 -0
  70. sage/version.py +5 -0
sage/features/all.py ADDED
@@ -0,0 +1,126 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Enumeration of all defined features
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2021-2023 Matthias Koeppe
8
+ #
9
+ # Distributed under the terms of the GNU General Public License (GPL)
10
+ # as published by the Free Software Foundation; either version 2 of
11
+ # the License, or (at your option) any later version.
12
+ # https://www.gnu.org/licenses/
13
+ # *****************************************************************************
14
+
15
+ import itertools
16
+
17
+
18
+ def all_features():
19
+ r"""
20
+ Return an iterable of all features.
21
+
22
+ EXAMPLES::
23
+
24
+ sage: from sage.features.all import all_features
25
+ sage: sorted(all_features(), key=lambda f: f.name) # random
26
+ [...Feature('sage.combinat')...]
27
+ """
28
+ import pkgutil
29
+ import importlib
30
+ import sage.features
31
+ # Following https://packaging.python.org/guides/creating-and-discovering-plugins/#using-namespace-packages
32
+ for finder, name, ispkg in pkgutil.iter_modules(sage.features.__path__, sage.features.__name__ + "."):
33
+ module = importlib.import_module(name)
34
+ try:
35
+ af = module.all_features
36
+ except AttributeError:
37
+ pass
38
+ else:
39
+ if af != all_features:
40
+ yield from af()
41
+
42
+
43
+ def module_feature(module_name):
44
+ r"""
45
+ Find a top-level :class:`Feature` that provides the Python module of the given ``module_name``.
46
+
47
+ Only features known to :func:`all_features` are considered.
48
+
49
+ INPUT:
50
+
51
+ - ``module_name`` -- string
52
+
53
+ OUTPUT: a :class:`Feature` or ``None``
54
+
55
+ EXAMPLES::
56
+
57
+ sage: from sage.features.all import module_feature
58
+ sage: module_feature('sage.combinat.tableau') # needs sage.combinat
59
+ Feature('sage.combinat')
60
+ sage: module_feature('sage.combinat.posets.poset') # needs sage.graphs
61
+ Feature('sage.graphs')
62
+ sage: module_feature('sage.schemes.toric.variety') # needs sage.geometry.polyhedron
63
+ Feature('sage.geometry.polyhedron')
64
+ sage: module_feature('scipy') # needs scipy
65
+ Feature('scipy')
66
+ sage: print(module_feature('sage.structure.element'))
67
+ None
68
+ sage: print(module_feature('sage.does_not_exist'))
69
+ None
70
+ """
71
+ longest_prefix = ''
72
+ longest_prefix_feature = None
73
+ for feature in all_features():
74
+ for joined in itertools.chain([feature], feature.joined_features()):
75
+ if joined.name == module_name:
76
+ return feature
77
+ if (joined.name + '.').startswith(longest_prefix):
78
+ if (module_name + '.').startswith(joined.name + '.'):
79
+ longest_prefix = feature.name + '.'
80
+ longest_prefix_feature = feature
81
+ return longest_prefix_feature
82
+
83
+
84
+ def name_feature(name, toplevel=None):
85
+ r"""
86
+ Find a top-level :class:`Feature` that provides the top-level ``name``.
87
+
88
+ Only features known to :func:`all_features` are considered.
89
+
90
+ INPUT:
91
+
92
+ - ``name`` -- string
93
+
94
+ - ``toplevel`` -- a module or other namespace
95
+
96
+ OUTPUT: a :class:`Feature` or ``None``
97
+
98
+ EXAMPLES::
99
+
100
+ sage: from sage.features.all import name_feature
101
+ sage: name_feature('QuadraticField') # needs sage.rings.number_field
102
+ Feature('sage.rings.number_field')
103
+ sage: name_feature('line') # needs sage.plot
104
+ Feature('sage.plot')
105
+ sage: print(name_feature('ZZ'))
106
+ None
107
+ sage: print(name_feature('does_not_exist'))
108
+ None
109
+ """
110
+ if toplevel is None:
111
+ try:
112
+ import sage.all as toplevel
113
+ except ImportError:
114
+ return None
115
+ try:
116
+ obj = getattr(toplevel, name)
117
+ except AttributeError:
118
+ return None
119
+
120
+ from sage.misc.dev_tools import find_object_modules
121
+
122
+ for module, names in find_object_modules(obj).items():
123
+ if name in names and (feature := module_feature(module)):
124
+ return feature
125
+
126
+ return None
sage/features/bliss.py ADDED
@@ -0,0 +1,85 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Features for testing the presence of ``bliss``
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2016 Julian Rüth
8
+ # 2018 Jeroen Demeyer
9
+ # 2021 Matthias Koeppe
10
+ #
11
+ # Distributed under the terms of the GNU General Public License (GPL)
12
+ # as published by the Free Software Foundation; either version 2 of
13
+ # the License, or (at your option) any later version.
14
+ # https://www.gnu.org/licenses/
15
+ # *****************************************************************************
16
+
17
+ from . import CythonFeature, PythonModule
18
+ from .join_feature import JoinFeature
19
+
20
+
21
+ TEST_CODE = """
22
+ # distutils: language=c++
23
+ # distutils: libraries=bliss
24
+
25
+ cdef extern from "bliss/graph.hh" namespace "bliss":
26
+ cdef cppclass Graph:
27
+ Graph(const unsigned int)
28
+
29
+ from cysignals.signals cimport sig_on, sig_off
30
+
31
+ sig_on()
32
+ Graph(1)
33
+ sig_off()
34
+ """
35
+
36
+
37
+ class BlissLibrary(CythonFeature):
38
+ r"""
39
+ A :class:`~sage.features.Feature` which describes whether the :ref:`Bliss library <spkg_bliss>` is
40
+ present and functional.
41
+
42
+ EXAMPLES::
43
+
44
+ sage: from sage.features.bliss import BlissLibrary
45
+ sage: BlissLibrary().require() # optional - libbliss
46
+ """
47
+
48
+ def __init__(self):
49
+ r"""
50
+ TESTS::
51
+
52
+ sage: from sage.features.bliss import BlissLibrary
53
+ sage: BlissLibrary()
54
+ Feature('libbliss')
55
+ """
56
+ CythonFeature.__init__(self, "libbliss", test_code=TEST_CODE,
57
+ spkg='bliss',
58
+ url='http://www.tcs.hut.fi/Software/bliss/')
59
+
60
+
61
+ class Bliss(JoinFeature):
62
+ r"""
63
+ A :class:`~sage.features.Feature` which describes whether the :mod:`sage.graphs.bliss`
64
+ module is available in this installation of Sage.
65
+
66
+ EXAMPLES::
67
+
68
+ sage: from sage.features.bliss import Bliss
69
+ sage: Bliss().require() # optional - bliss
70
+ """
71
+ def __init__(self):
72
+ r"""
73
+ TESTS::
74
+
75
+ sage: from sage.features.bliss import Bliss
76
+ sage: Bliss()
77
+ Feature('bliss')
78
+ """
79
+ JoinFeature.__init__(self, "bliss",
80
+ [PythonModule("sage.graphs.bliss", spkg='sagemath_bliss',
81
+ url='http://www.tcs.hut.fi/Software/bliss/')])
82
+
83
+
84
+ def all_features():
85
+ return [Bliss()]
@@ -0,0 +1,38 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Feature for testing the presence of ``cddlib``
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2022 Matthias Koeppe
8
+ #
9
+ # Distributed under the terms of the GNU General Public License (GPL)
10
+ # as published by the Free Software Foundation; either version 2 of
11
+ # the License, or (at your option) any later version.
12
+ # https://www.gnu.org/licenses/
13
+ # *****************************************************************************
14
+
15
+ from . import Executable
16
+
17
+
18
+ class CddExecutable(Executable):
19
+ r"""
20
+ A :class:`~sage.features.Feature` describing the presence of an executable
21
+ which comes as a part of :ref:`cddlib <spkg_cddlib>`.
22
+
23
+ EXAMPLES::
24
+
25
+ sage: from sage.features.cddlib import CddExecutable
26
+ sage: CddExecutable().is_present()
27
+ FeatureTestResult('cddexec_gmp', True)
28
+ """
29
+ def __init__(self, name='cddexec_gmp'):
30
+ r"""
31
+ TESTS::
32
+
33
+ sage: from sage.features.cddlib import CddExecutable
34
+ sage: isinstance(CddExecutable(), CddExecutable)
35
+ True
36
+ """
37
+ Executable.__init__(self, name=name, executable=name, spkg='cddlib',
38
+ url='https://github.com/cddlib/cddlib', type='standard')
@@ -0,0 +1,45 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Features for testing the presence of ``coxeter3``
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2016 Julian Rüth
8
+ # 2018 Jeroen Demeyer
9
+ # 2021-2024 Matthias Koeppe
10
+ #
11
+ # Distributed under the terms of the GNU General Public License (GPL)
12
+ # as published by the Free Software Foundation; either version 2 of
13
+ # the License, or (at your option) any later version.
14
+ # https://www.gnu.org/licenses/
15
+ # *****************************************************************************
16
+
17
+ from . import PythonModule
18
+ from .join_feature import JoinFeature
19
+
20
+
21
+ class Coxeter3(JoinFeature):
22
+ r"""
23
+ A :class:`~sage.features.Feature` which describes whether the :mod:`sage.libs.coxeter3`
24
+ module is available in this installation of Sage.
25
+
26
+ EXAMPLES::
27
+
28
+ sage: from sage.features.coxeter3 import Coxeter3
29
+ sage: Coxeter3().require() # optional - coxeter3
30
+ """
31
+ def __init__(self):
32
+ r"""
33
+ TESTS::
34
+
35
+ sage: from sage.features.coxeter3 import Coxeter3
36
+ sage: Coxeter3()
37
+ Feature('coxeter3')
38
+ """
39
+ JoinFeature.__init__(self, "coxeter3",
40
+ [PythonModule("sage.libs.coxeter3.coxeter",
41
+ spkg='sagemath_coxeter3')])
42
+
43
+
44
+ def all_features():
45
+ return [Coxeter3()]
sage/features/csdp.py ADDED
@@ -0,0 +1,83 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Feature for testing the presence of ``csdp``
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2016 Julian Rüth
8
+ # 2018 Jeroen Demeyer
9
+ # 2019 David Coudert
10
+ # 2021 Matthias Koeppe
11
+ #
12
+ # Distributed under the terms of the GNU General Public License (GPL)
13
+ # as published by the Free Software Foundation; either version 2 of
14
+ # the License, or (at your option) any later version.
15
+ # https://www.gnu.org/licenses/
16
+ # *****************************************************************************
17
+
18
+ import os
19
+ import re
20
+ import subprocess
21
+
22
+ from . import Executable, FeatureTestResult
23
+
24
+
25
+ class CSDP(Executable):
26
+ r"""
27
+ A :class:`~sage.features.Feature` which checks for the ``theta`` binary
28
+ of :ref:`CSDP <spkg_csdp>`.
29
+
30
+ EXAMPLES::
31
+
32
+ sage: from sage.features.csdp import CSDP
33
+ sage: CSDP().is_present() # optional - csdp
34
+ FeatureTestResult('csdp', True)
35
+ """
36
+ def __init__(self):
37
+ r"""
38
+ TESTS::
39
+
40
+ sage: from sage.features.csdp import CSDP
41
+ sage: isinstance(CSDP(), CSDP)
42
+ True
43
+ """
44
+ Executable.__init__(self, name='csdp', spkg='csdp', executable='theta',
45
+ url='https://github.com/dimpase/csdp')
46
+
47
+ def is_functional(self):
48
+ r"""
49
+ Check whether ``theta`` works on a trivial example.
50
+
51
+ EXAMPLES::
52
+
53
+ sage: from sage.features.csdp import CSDP
54
+ sage: CSDP().is_functional() # optional - csdp
55
+ FeatureTestResult('csdp', True)
56
+ """
57
+ from sage.misc.temporary_file import tmp_filename
58
+ from sage.cpython.string import bytes_to_str
59
+
60
+ tf_name = tmp_filename()
61
+ with open(tf_name, 'wb') as tf:
62
+ tf.write(b"2\n1\n1 1")
63
+ with open(os.devnull, 'wb') as devnull:
64
+ command = ['theta', tf_name]
65
+ try:
66
+ lines = subprocess.check_output(command, stderr=devnull)
67
+ except subprocess.CalledProcessError as e:
68
+ return FeatureTestResult(self, False,
69
+ reason="Call to `{command}` failed with exit code {e.returncode}."
70
+ .format(command=" ".join(command), e=e))
71
+
72
+ result = bytes_to_str(lines).strip().split('\n')[-1]
73
+ match = re.match("^The Lovasz Theta Number is (.*)$", result)
74
+ if match is None:
75
+ return FeatureTestResult(self, False,
76
+ reason="Last line of the output of `{command}` did not have the expected format."
77
+ .format(command=" ".join(command)))
78
+
79
+ return FeatureTestResult(self, True)
80
+
81
+
82
+ def all_features():
83
+ return [CSDP()]
@@ -0,0 +1,38 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Features for testing the presence of ``cython``
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2021 Matthias Koeppe
8
+ #
9
+ # Distributed under the terms of the GNU General Public License (GPL)
10
+ # as published by the Free Software Foundation; either version 2 of
11
+ # the License, or (at your option) any later version.
12
+ # https://www.gnu.org/licenses/
13
+ # *****************************************************************************
14
+
15
+ from . import CythonFeature
16
+
17
+
18
+ class sage__misc__cython(CythonFeature):
19
+ r"""
20
+ A :class:`~sage.features.Feature` which describes whether :mod:`sage.misc.cython`
21
+ is available and functional.
22
+ """
23
+ def __init__(self):
24
+ r"""
25
+ TESTS::
26
+
27
+ sage: from sage.features import CythonFeature
28
+ sage: from sage.features.cython import sage__misc__cython
29
+ sage: isinstance(sage__misc__cython(), CythonFeature)
30
+ True
31
+ """
32
+ # It suffices to use a trivial CythonFeature because CythonFeature
33
+ # is implemented via sage.misc.cython.
34
+ CythonFeature.__init__(self, "sage.misc.cython", test_code="")
35
+
36
+
37
+ def all_features():
38
+ return [sage__misc__cython()]