Skip to content

Commit 882cd19

Browse files
author
Release Manager
committedJun 17, 2023
gh-35728: New feature annotations `# optional - sage.schemes sage.modular sage.libs.flint` etc. <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> - Part of: #29705 - Cherry-picked from: #35095 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35728 Reported by: Matthias Köppe Reviewer(s): David Coudert, Matthias Köppe
2 parents c4a70ab + 4f968a8 commit 882cd19

37 files changed

+1901
-1648
lines changed
 

‎src/sage/arith/functions.pyx

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@ def lcm(a, b=None):
7272
7373
Make sure we try `\QQ` and not merely `\ZZ` (:trac:`13014`)::
7474
75-
sage: bool(lcm(2/5, 3/7) == lcm(SR(2/5), SR(3/7)))
75+
sage: bool(lcm(2/5, 3/7) == lcm(SR(2/5), SR(3/7))) # optional - sage.symbolic
7676
True
7777
7878
Make sure that the lcm of Expressions stays symbolic::
7979
8080
sage: parent(lcm(2, 4))
8181
Integer Ring
82-
sage: parent(lcm(SR(2), 4))
82+
sage: parent(lcm(SR(2), 4)) # optional - sage.symbolic
8383
Symbolic Ring
84-
sage: parent(lcm(2, SR(4)))
84+
sage: parent(lcm(2, SR(4))) # optional - sage.symbolic
8585
Symbolic Ring
86-
sage: parent(lcm(SR(2), SR(4)))
86+
sage: parent(lcm(SR(2), SR(4))) # optional - sage.symbolic
8787
Symbolic Ring
8888
8989
Verify that objects without lcm methods but which can't be
9090
coerced to `\ZZ` or `\QQ` raise an error::
9191
92-
sage: F.<x,y> = FreeMonoid(2)
93-
sage: lcm(x,y)
92+
sage: F.<x,y> = FreeMonoid(2) # optional - sage.groups
93+
sage: lcm(x,y) # optional - sage.groups
9494
Traceback (most recent call last):
9595
...
9696
TypeError: unable to find lcm of x and y

‎src/sage/arith/misc.py

+645-636
Large diffs are not rendered by default.

‎src/sage/arith/multi_modular.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# sage.doctest: optional - primecountpy
12
"""
23
Utility classes for multi-modular algorithms
34
"""

‎src/sage/categories/action.pyx

+16-16
Original file line numberDiff line numberDiff line change
@@ -432,16 +432,16 @@ cdef class PrecomposedAction(Action):
432432
We demonstrate that an example discussed on :trac:`14711` did not become a
433433
problem::
434434
435-
sage: E = ModularSymbols(11).2
436-
sage: s = E.modular_symbol_rep()
437-
sage: del E,s
438-
sage: import gc
439-
sage: _ = gc.collect()
440-
sage: E = ModularSymbols(11).2
441-
sage: v = E.manin_symbol_rep()
442-
sage: c,x = v[0]
443-
sage: y = x.modular_symbol_rep()
444-
sage: coercion_model.get_action(QQ, parent(y), op=operator.mul)
435+
sage: E = ModularSymbols(11).2 # optional - sage.modular
436+
sage: s = E.modular_symbol_rep() # optional - sage.modular
437+
sage: del E,s # optional - sage.modular
438+
sage: import gc # optional - sage.modular
439+
sage: _ = gc.collect() # optional - sage.modular
440+
sage: E = ModularSymbols(11).2 # optional - sage.modular
441+
sage: v = E.manin_symbol_rep() # optional - sage.modular
442+
sage: c,x = v[0] # optional - sage.modular
443+
sage: y = x.modular_symbol_rep() # optional - sage.modular
444+
sage: coercion_model.get_action(QQ, parent(y), op=operator.mul) # optional - sage.modular
445445
Left scalar multiplication by Rational Field
446446
on Abelian Group of all Formal Finite Sums over Rational Field
447447
with precomposition on right by Coercion map:
@@ -483,12 +483,12 @@ cdef class PrecomposedAction(Action):
483483
484484
Check that this action can be pickled (:trac:`29031`)::
485485
486-
sage: E = ModularSymbols(11).2
487-
sage: v = E.manin_symbol_rep()
488-
sage: c,x = v[0]
489-
sage: y = x.modular_symbol_rep()
490-
sage: act = coercion_model.get_action(QQ, parent(y), op=operator.mul)
491-
sage: loads(dumps(act)) is not None
486+
sage: E = ModularSymbols(11).2 # optional - sage.modular
487+
sage: v = E.manin_symbol_rep() # optional - sage.modular
488+
sage: c,x = v[0] # optional - sage.modular
489+
sage: y = x.modular_symbol_rep() # optional - sage.modular
490+
sage: act = coercion_model.get_action(QQ, parent(y), op=operator.mul) # optional - sage.modular
491+
sage: loads(dumps(act)) is not None # optional - sage.modular
492492
True
493493
"""
494494
return (type(self), (self._action, self.G_precomposition, self.S_precomposition))

‎src/sage/categories/hecke_modules.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ParentMethods:
103103

104104
def _Hom_(self, Y, category):
105105
r"""
106-
Returns the homset from ``self`` to ``Y`` in the category ``category``
106+
Return the homset from ``self`` to ``Y`` in the category ``category``
107107
108108
INPUT:
109109
@@ -121,15 +121,15 @@ def _Hom_(self, Y, category):
121121
122122
EXAMPLES::
123123
124-
sage: M = ModularForms(Gamma0(7), 4)
125-
sage: H = M._Hom_(M, category = HeckeModules(QQ)); H
124+
sage: M = ModularForms(Gamma0(7), 4) # optional - sage.modular
125+
sage: H = M._Hom_(M, category=HeckeModules(QQ)); H # optional - sage.modular
126126
Set of Morphisms
127127
from Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) of weight 4 over Rational Field
128128
to Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) of weight 4 over Rational Field
129129
in Category of Hecke modules over Rational Field
130-
sage: H.__class__
130+
sage: H.__class__ # optional - sage.modular
131131
<class 'sage.modular.hecke.homspace.HeckeModuleHomspace_with_category'>
132-
sage: TestSuite(H).run(skip=["_test_elements", "_test_an_element", "_test_elements_eq",
132+
sage: TestSuite(H).run(skip=["_test_elements", "_test_an_element", "_test_elements_eq", # optional - sage.modular
133133
....: "_test_elements_eq_reflexive", "_test_elements_eq_transitive",
134134
....: "_test_elements_eq_symmetric", "_test_elements_neq", "_test_some_elements",
135135
....: "_test_zero", "_test_additive_associativity",
@@ -142,7 +142,7 @@ def _Hom_(self, Y, category):
142142
143143
TESTS::
144144
145-
sage: H = M._Hom_(M, category = HeckeModules(GF(5))); H
145+
sage: H = M._Hom_(M, category=HeckeModules(GF(5))); H # optional - sage.modular sage.rings.finite_rings
146146
Traceback (most recent call last):
147147
...
148148
TypeError: Category of Hecke modules over Finite Field of size 5

‎src/sage/categories/homset.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -592,15 +592,15 @@ class Homset(Set_generic):
592592
593593
Conversely, homsets of non-unique parents are non-unique::
594594
595-
sage: P11 = ProductProjectiveSpaces(QQ, [1, 1])
596-
sage: H = End(P11)
597-
sage: loads(dumps(P11)) is ProductProjectiveSpaces(QQ, [1, 1])
595+
sage: P11 = ProductProjectiveSpaces(QQ, [1, 1]) # optional - sage.schemes
596+
sage: H = End(P11) # optional - sage.schemes
597+
sage: loads(dumps(P11)) is ProductProjectiveSpaces(QQ, [1, 1]) # optional - sage.schemes
598598
False
599-
sage: loads(dumps(P11)) == ProductProjectiveSpaces(QQ, [1, 1])
599+
sage: loads(dumps(P11)) == ProductProjectiveSpaces(QQ, [1, 1]) # optional - sage.schemes
600600
True
601-
sage: loads(dumps(H)) is H
601+
sage: loads(dumps(H)) is H # optional - sage.schemes
602602
False
603-
sage: loads(dumps(H)) == H
603+
sage: loads(dumps(H)) == H # optional - sage.schemes
604604
True
605605
"""
606606
def __init__(self, X, Y, category=None, base=None, check=True):

‎src/sage/categories/modules_with_basis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def _call_(self, x):
165165
If ``x`` itself is not a module with basis, but there is a
166166
canonical one associated to it, the latter is returned::
167167
168-
sage: CQ(AbelianVariety(Gamma0(37))) # indirect doctest # optional - sage.modules
168+
sage: CQ(AbelianVariety(Gamma0(37))) # indirect doctest # optional - sage.modular sage.modules
169169
Vector space of dimension 4 over Rational Field
170170
"""
171171
try:

‎src/sage/features/sagemath.py

+138-7
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ def __init__(self):
6363
"""
6464
# sage.combinat will be a namespace package.
6565
# Testing whether sage.combinat itself can be imported is meaningless.
66+
# Some modules providing basic combinatorics are already included in sagemath-categories.
6667
# Hence, we test a Python module within the package.
6768
JoinFeature.__init__(self, 'sage.combinat',
68-
[PythonModule('sage.combinat.combination')])
69+
[PythonModule('sage.combinat.tableau')],
70+
spkg='sagemath_combinat')
6971

7072

7173
class sage__geometry__polyhedron(PythonModule):
@@ -87,7 +89,8 @@ def __init__(self):
8789
sage: isinstance(sage__geometry__polyhedron(), sage__geometry__polyhedron)
8890
True
8991
"""
90-
PythonModule.__init__(self, 'sage.geometry.polyhedron')
92+
PythonModule.__init__(self, 'sage.geometry.polyhedron',
93+
spkg='sagemath_polyhedra')
9194

9295

9396
class sage__graphs(JoinFeature):
@@ -109,7 +112,31 @@ def __init__(self):
109112
True
110113
"""
111114
JoinFeature.__init__(self, 'sage.graphs',
112-
[PythonModule('sage.graphs.graph')])
115+
[PythonModule('sage.graphs.graph')],
116+
spkg='sagemath_graphs')
117+
118+
119+
class sage__modular(JoinFeature):
120+
r"""
121+
A :class:`~sage.features.Feature` describing the presence of :mod:`sage.modular`.
122+
123+
EXAMPLES::
124+
125+
sage: from sage.features.sagemath import sage__modular
126+
sage: sage__modular().is_present() # optional - sage.modular
127+
FeatureTestResult('sage.modular', True)
128+
"""
129+
def __init__(self):
130+
r"""
131+
TESTS::
132+
133+
sage: from sage.features.sagemath import sage__modular
134+
sage: isinstance(sage__modular(), sage__modular)
135+
True
136+
"""
137+
JoinFeature.__init__(self, 'sage.modular',
138+
[PythonModule('sage.modular.modform.eisenstein_submodule')],
139+
spkg='sagemath_schemes')
113140

114141

115142
class sage__groups(JoinFeature):
@@ -134,6 +161,55 @@ def __init__(self):
134161
[PythonModule('sage.groups.perm_gps.permgroup')])
135162

136163

164+
class sage__libs__flint(JoinFeature):
165+
r"""
166+
A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.flint`
167+
and other modules depending on FLINT and arb.
168+
169+
EXAMPLES::
170+
171+
sage: from sage.features.sagemath import sage__libs__flint
172+
sage: sage__libs__flint().is_present() # optional - sage.libs.flint
173+
FeatureTestResult('sage.libs.flint', True)
174+
"""
175+
def __init__(self):
176+
r"""
177+
TESTS::
178+
179+
sage: from sage.features.sagemath import sage__libs__flint
180+
sage: isinstance(sage__libs__flint(), sage__libs__flint)
181+
True
182+
"""
183+
JoinFeature.__init__(self, 'sage.libs.flint',
184+
[PythonModule('sage.libs.flint.flint'),
185+
PythonModule('sage.libs.arb.arith')],
186+
spkg='sagemath_flint')
187+
188+
189+
class sage__libs__ntl(JoinFeature):
190+
r"""
191+
A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.ntl`
192+
and other modules depending on NTL and arb.
193+
194+
EXAMPLES::
195+
196+
sage: from sage.features.sagemath import sage__libs__ntl
197+
sage: sage__libs__ntl().is_present() # optional - sage.libs.ntl
198+
FeatureTestResult('sage.libs.ntl', True)
199+
"""
200+
def __init__(self):
201+
r"""
202+
TESTS::
203+
204+
sage: from sage.features.sagemath import sage__libs__ntl
205+
sage: isinstance(sage__libs__ntl(), sage__libs__ntl)
206+
True
207+
"""
208+
JoinFeature.__init__(self, 'sage.libs.ntl',
209+
[PythonModule('sage.libs.ntl.convert')],
210+
spkg='sagemath_ntl')
211+
212+
137213
class sage__libs__pari(JoinFeature):
138214
r"""
139215
A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.pari`.
@@ -153,7 +229,8 @@ def __init__(self):
153229
True
154230
"""
155231
JoinFeature.__init__(self, 'sage.libs.pari',
156-
[PythonModule('sage.libs.pari.convert_sage')])
232+
[PythonModule('sage.libs.pari.convert_sage')],
233+
spkg='sagemath_pari')
157234

158235

159236
class sage__modules(JoinFeature):
@@ -175,7 +252,8 @@ def __init__(self):
175252
True
176253
"""
177254
JoinFeature.__init__(self, 'sage.modules',
178-
[PythonModule('sage.modules.free_module')])
255+
[PythonModule('sage.modules.free_module')],
256+
spkg='sagemath_modules')
179257

180258

181259
class sage__plot(JoinFeature):
@@ -197,7 +275,8 @@ def __init__(self):
197275
True
198276
"""
199277
JoinFeature.__init__(self, 'sage.plot',
200-
[PythonModule('sage.plot.plot')])
278+
[PythonModule('sage.plot.plot')],
279+
spkg='sagemath_symbolics')
201280

202281

203282
class sage__rings__finite_rings(JoinFeature):
@@ -290,6 +369,29 @@ def __init__(self):
290369
[PythonModule('sage.rings.padics.factory')])
291370

292371

372+
class sage__rings__polynomial__pbori(JoinFeature):
373+
r"""
374+
A :class:`sage.features.Feature` describing the presence of :mod:`sage.rings.polynomial.pbori`.
375+
376+
EXAMPLES::
377+
378+
sage: from sage.features.sagemath import sage__rings__polynomial__pbori
379+
sage: sage__rings__polynomial__pbori().is_present() # optional - sage.rings.polynomial.pbori
380+
FeatureTestResult('sage.rings.polynomial.pbori', True)
381+
"""
382+
def __init__(self):
383+
r"""
384+
TESTS::
385+
386+
sage: from sage.features.sagemath import sage__rings__polynomial__pbori
387+
sage: isinstance(sage__rings__polynomial__pbori(), sage__rings__polynomial__pbori)
388+
True
389+
"""
390+
JoinFeature.__init__(self, 'sage.rings.polynomial.pbori',
391+
[PythonModule('sage.rings.polynomial.pbori.pbori')],
392+
spkg='sagemath_brial')
393+
394+
293395
class sage__rings__real_double(PythonModule):
294396
r"""
295397
A :class:`~sage.features.Feature` describing the presence of :mod:`sage.rings.real_double`.
@@ -329,7 +431,31 @@ def __init__(self):
329431
sage: isinstance(sage__rings__real_mpfr(), sage__rings__real_mpfr)
330432
True
331433
"""
332-
PythonModule.__init__(self, 'sage.rings.real_mpfr')
434+
PythonModule.__init__(self, 'sage.rings.real_mpfr',
435+
spkg='sagemath_modules')
436+
437+
438+
class sage__schemes(JoinFeature):
439+
r"""
440+
A :class:`~sage.features.Feature` describing the presence of :mod:`sage.schemes`.
441+
442+
EXAMPLES::
443+
444+
sage: from sage.features.sagemath import sage__schemes
445+
sage: sage__schemes().is_present() # optional - sage.schemes
446+
FeatureTestResult('sage.schemes', True)
447+
"""
448+
def __init__(self):
449+
r"""
450+
TESTS::
451+
452+
sage: from sage.features.sagemath import sage__schemes
453+
sage: isinstance(sage__schemes(), sage__schemes)
454+
True
455+
"""
456+
JoinFeature.__init__(self, 'sage.schemes',
457+
[PythonModule('sage.schemes.elliptic_curves.ell_generic')],
458+
spkg="sagemath_schemes")
333459

334460

335461
class sage__symbolic(JoinFeature):
@@ -382,13 +508,18 @@ def all_features():
382508
sage__geometry__polyhedron(),
383509
sage__graphs(),
384510
sage__groups(),
511+
sage__libs__flint(),
512+
sage__libs__ntl(),
385513
sage__libs__pari(),
514+
sage__modular(),
386515
sage__modules(),
387516
sage__plot(),
388517
sage__rings__finite_rings(),
389518
sage__rings__function_field(),
390519
sage__rings__number_field(),
391520
sage__rings__padics(),
521+
sage__rings__polynomial__pbori(),
392522
sage__rings__real_double(),
393523
sage__rings__real_mpfr(),
524+
sage__schemes(),
394525
sage__symbolic()]

‎src/sage/misc/cachefunc.pyx

+3-2
Original file line numberDiff line numberDiff line change
@@ -3707,8 +3707,9 @@ class disk_cached_function:
37073707
sage: dir = tmp_dir()
37083708
sage: @disk_cached_function(dir)
37093709
....: def foo(x): return ModularSymbols(x)
3710-
sage: foo(389)
3711-
Modular Symbols space of dimension 65 for Gamma_0(389) of weight 2 with sign 0 over Rational Field
3710+
sage: foo(389) # optional - sage.modular
3711+
Modular Symbols space of dimension 65 for Gamma_0(389) of weight 2
3712+
with sign 0 over Rational Field
37123713
"""
37133714
return DiskCachedFunction(f, self._dir, memory_cache=self._memory_cache, key=self._key)
37143715

0 commit comments

Comments
 (0)
Please sign in to comment.