Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.rings.function_field: Modularization fixes #35230

Merged
merged 60 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
b7a0325
sage.features: Add 'sage.libs.singular'
mkoeppe Feb 27, 2023
6557578
sage.features: Add 'sage.libs.singular' (fixup)
mkoeppe Feb 27, 2023
8f05e2c
src/sage/features/singular.py: Fix up doctest
mkoeppe Feb 27, 2023
ebac0f2
sage.features.standard: New
mkoeppe Mar 5, 2023
a9fc02e
src/sage/features/standard.py: Fix up, rename features to match spkgs
mkoeppe Mar 6, 2023
2fafd82
src/sage/features/standard.py: Fix up
mkoeppe Mar 6, 2023
86a2c57
src/sage/features: Add/update copyright according to "git blame -w --…
mkoeppe Mar 7, 2023
2f0583c
sage.features: Add feature sage.libs.gap
mkoeppe Mar 8, 2023
1c8c6bc
sage.rings.function_field: Add # optional
mkoeppe Mar 5, 2023
deffc68
sage.rings.function_field: Move some imports into methods
mkoeppe Mar 5, 2023
9338584
sage.rings.function_field.derivations: Split out from .maps
mkoeppe Mar 5, 2023
64736f3
sage.rings.function_field: Move some imports into methods
mkoeppe Mar 5, 2023
219aedc
sage.rings.function_field.derivations: Add to docs
mkoeppe Mar 5, 2023
d3e9388
src/sage/rings/function_field/function_field.py: Fix lazy imports
mkoeppe Mar 5, 2023
9eb81aa
src/sage/rings/function_field/function_field.py: More # optional
mkoeppe Mar 5, 2023
4921648
sage.rings.function_field: Mark doctests # optional - sage.libs.singu…
mkoeppe Mar 5, 2023
0587b82
src/sage/rings/function_field/function_field_valuation.py: Fix up # o…
mkoeppe Mar 5, 2023
31ad4be
src/sage/rings/function_field/derivations.py: Fix imports in doctests
mkoeppe Mar 5, 2023
e1d2af7
src/sage/rings/function_field/function_field.py: Fix # optional
mkoeppe Mar 6, 2023
a1083b7
src/sage/rings/function_field/maps.py: Fill in PR number for deprecation
mkoeppe Mar 8, 2023
3a6bb7f
src/sage/rings/function_field: In # optional, no commas between tags
mkoeppe Mar 10, 2023
fe5faf6
src/sage/rings/function_field/order.py: Split into modules order_...
mkoeppe Mar 10, 2023
e6c197e
Split off _rational modules
kwankyu Mar 14, 2023
36f456a
Fix failures in sage/rings/valuation
kwankyu Mar 15, 2023
43130d0
Add new files
kwankyu Mar 15, 2023
4c7515e
Small fix
kwankyu Mar 15, 2023
4aa6c00
src/sage/rings/function_field: Make 'tox -e pycodestyle-minimal' pass
mkoeppe Mar 16, 2023
a9ec286
Merge branch 't/32664/add_sage_rings_abc_finitefield__deprecate_is_fi…
mkoeppe Mar 16, 2023
4572758
Merge branch 'features' into refactor_function_field
mkoeppe Mar 16, 2023
f3f8269
sage.features: Add feature sage.rings.function_field
mkoeppe Mar 16, 2023
8131fc6
src/sage/rings/function_field: Update doctests to use # optional - sa…
mkoeppe Mar 16, 2023
14bf26f
sage.features: Add features sage.libs.pari, sage.modules
mkoeppe Mar 3, 2023
fde26d6
src/sage/rings/function_field: Update remaining doctests to use # opt…
mkoeppe Mar 16, 2023
77ee282
src/doc/en/reference/function_fields/index.rst: Add new modules
mkoeppe Mar 16, 2023
96bd608
src/sage/rings/function_field: Fix some imports
mkoeppe Mar 16, 2023
699d6ff
src/doc/en/reference/valuations/index.rst: Update module name in sage…
mkoeppe Mar 16, 2023
83b0be1
src/sage/rings/function_field/function_field.py: try...except for imp…
mkoeppe Mar 16, 2023
0e6a923
sage.rings.function_field: More # optional
mkoeppe Mar 16, 2023
8b7c7c6
src/sage/rings/function_field: Add/update copyright, according to 'gi…
mkoeppe Mar 17, 2023
1e5ab99
src/sage/rings/function_field/derivations*.py: Copy copyright here fr…
mkoeppe Mar 17, 2023
95511b1
src/doc/en/reference/function_fields/index.rst: Revert add of valuation
mkoeppe Mar 17, 2023
4b81613
src/sage/categories/function_fields.py: Update # optional
mkoeppe Mar 17, 2023
2bd115a
src/sage/rings/function_field/function_field_polymod.py: Cosmetic doc…
mkoeppe Mar 17, 2023
42fc4af
src/sage/rings/function_field/ideal.py: Cosmetic doctest changes
mkoeppe Mar 17, 2023
d8f4af5
src/sage/rings/function_field/order_basis.py: Cosmetic doctest changes
mkoeppe Mar 17, 2023
45b274b
src/sage/rings/function_field/place*.py: Cosmetic doctest changes
mkoeppe Mar 17, 2023
913c7e0
src/sage/rings/function_field/derivations_polymod.py: Cosmetic doctes…
mkoeppe Mar 17, 2023
de9a7ad
sage.features: Add feature sage.rings.finite_rings
mkoeppe Mar 17, 2023
7496d84
sage.rings.function_field, sage.categories.function_fields: Use # opt…
mkoeppe Mar 17, 2023
7c4e35d
sage.rings.function_field: Import directly from .order_*
mkoeppe Mar 18, 2023
3f098a0
sage.rings.function_field: Remove unnecessary lazy imports for intern…
mkoeppe Mar 18, 2023
7f12a8e
src/doc/en/developer/packaging_sage_library.rst: Add best practices f…
mkoeppe Mar 18, 2023
97894ee
Add missing titles to new files
kwankyu Mar 19, 2023
07e3416
Add more
kwankyu Mar 19, 2023
63be8bf
Merge pull request #3 from kwankyu/refactor_function_field
mkoeppe Mar 19, 2023
5d9a148
Merge tag '10.0.beta6' into refactor_function_field
mkoeppe Mar 26, 2023
bbc1997
src/sage/rings/function_field: Fix linter
mkoeppe Mar 27, 2023
a25f3d9
Merge remote-tracking branch 'upstream/develop' into features
mkoeppe Mar 30, 2023
9990302
src/sage/features/standard.py: Remove rpy2 feature for now
mkoeppe Mar 30, 2023
db2f8dd
Merge branch 'features' into refactor_function_field
mkoeppe Mar 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/doc/en/developer/packaging_sage_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,15 @@ doctests that depend on :class:`sage.symbolic.ring.SymbolicRing` for integration
testing. Hence, these doctests are marked ``# optional -
sage.symbolic``.

When defining new features for the purpose of doctest annotations, it may be a good
idea to hide implementation details from feature names. For example, all doctests that
use finite fields have to depend on PARI. However, we have defined a feature
:mod:`sage.rings.finite_rings` (which implies the presence of :mod:`sage.libs.pari`).
Annotating the doctests ``# optional - sage.rings.finite_rings`` expresses the
dependency in a clearer way than using ``# optional - sage.libs.pari``, and it
will be a smaller maintenance burden when implementation details change.


Testing the distribution in virtual environments with tox
---------------------------------------------------------

Expand Down
14 changes: 14 additions & 0 deletions src/doc/en/reference/function_fields/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,27 @@ algebraic closure of `\QQ`.
:maxdepth: 1

sage/rings/function_field/function_field
sage/rings/function_field/function_field_rational
sage/rings/function_field/function_field_polymod
sage/rings/function_field/element
sage/rings/function_field/element_rational
sage/rings/function_field/element_polymod
sage/rings/function_field/order
sage/rings/function_field/order_rational
sage/rings/function_field/order_basis
sage/rings/function_field/order_polymod
sage/rings/function_field/ideal
sage/rings/function_field/ideal_rational
sage/rings/function_field/ideal_polymod
sage/rings/function_field/place
sage/rings/function_field/place_rational
sage/rings/function_field/place_polymod
sage/rings/function_field/divisor
sage/rings/function_field/differential
sage/rings/function_field/valuation_ring
sage/rings/function_field/derivations
sage/rings/function_field/derivations_rational
sage/rings/function_field/derivations_polymod
sage/rings/function_field/maps
sage/rings/function_field/extensions
sage/rings/function_field/constructor
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/reference/valuations/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ More Details
sage/rings/valuation/mapped_valuation
sage/rings/valuation/scaled_valuation

sage/rings/function_field/function_field_valuation
sage/rings/function_field/valuation
sage/rings/padics/padic_valuation

.. include:: ../footer.txt
8 changes: 4 additions & 4 deletions src/sage/categories/function_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def _call_(self, x):
EXAMPLES::

sage: C = FunctionFields()
sage: K.<x>=FunctionField(QQ)
sage: K.<x> = FunctionField(QQ)
sage: C(K)
Rational function field in x over Rational Field
sage: Ky.<y> = K[]
sage: L = K.extension(y^2-x)
sage: C(L)
sage: L = K.extension(y^2 - x) # optional - sage.rings.function_field
sage: C(L) # optional - sage.rings.function_field
Function field in y defined by y^2 - x
sage: C(L.equation_order())
sage: C(L.equation_order()) # optional - sage.rings.function_field
Function field in y defined by y^2 - x
"""
try:
Expand Down
13 changes: 13 additions & 0 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@
As can be seen above, features try to produce helpful error messages.
"""

# *****************************************************************************
# Copyright (C) 2016 Julian Rüth
# 2018 Jeroen Demeyer
# 2018 Timo Kaufmann
# 2019-2022 Matthias Koeppe
# 2021 Kwankyu Lee
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from __future__ import annotations

import os
Expand Down
9 changes: 9 additions & 0 deletions src/sage/features/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Enumeration of all defined features
"""

# *****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

def all_features():
r"""
Return an iterable of all features.
Expand Down
13 changes: 12 additions & 1 deletion src/sage/features/bliss.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``bliss``
"""

# *****************************************************************************
# Copyright (C) 2016 Julian Rüth
# 2018 Jeroen Demeyer
# 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import CythonFeature, PythonModule
from .join_feature import JoinFeature

Expand Down
10 changes: 10 additions & 0 deletions src/sage/features/cddlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
r"""
Feature for testing the presence of ``cddlib``
"""

# *****************************************************************************
# Copyright (C) 2022 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import Executable


Expand Down
12 changes: 12 additions & 0 deletions src/sage/features/csdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
Feature for testing the presence of ``csdp``
"""

# *****************************************************************************
# Copyright (C) 2016 Julian Rüth
# 2018 Jeroen Demeyer
# 2019 David Coudert
# 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

import os
import re
import subprocess
Expand Down
10 changes: 9 additions & 1 deletion src/sage/features/cython.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``cython``
"""

# *****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import CythonFeature


Expand Down
15 changes: 14 additions & 1 deletion src/sage/features/databases.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of various databases
"""

# *****************************************************************************
# Copyright (C) 2016 Julian Rüth
# 2018-2019 Jeroen Demeyer
# 2018 Timo Kaufmann
# 2020-2022 Matthias Koeppe
# 2020-2022 Sebastian Oehms
# 2021 Kwankyu Lee
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************


from . import StaticFile, PythonModule
from sage.env import (
Expand Down
1 change: 0 additions & 1 deletion src/sage/features/dvipng.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``dvipng``
"""
Expand Down
3 changes: 1 addition & 2 deletions src/sage/features/ffmpeg.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``ffmpeg``
"""
# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <[email protected]>
# Copyright (C) 2018-2022 Sebastien Labbe <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
44 changes: 42 additions & 2 deletions src/sage/features/gap.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of GAP packages
"""
# *****************************************************************************
# Copyright (C) 2016 Julian Rüth
# 2018 Jeroen Demeyer
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import Feature, FeatureTestResult
from . import Feature, FeatureTestResult, PythonModule
from .join_feature import JoinFeature


class GapPackage(Feature):
Expand Down Expand Up @@ -48,3 +57,34 @@ def _is_present(self):
else:
return FeatureTestResult(self, False,
reason="`{command}` evaluated to `{presence}` in GAP.".format(command=command, presence=presence))


class sage__libs__gap(JoinFeature):
r"""
A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.gap`
(the library interface to GAP) and :mod:`sage.interfaces.gap` (the pexpect
interface to GAP). By design, we do not distinguish between these two, in order
to facilitate the conversion of code from the pexpect interface to the library
interface.

EXAMPLES::

sage: from sage.features.gap import sage__libs__gap
sage: sage__libs__gap().is_present() # optional - sage.libs.gap
FeatureTestResult('sage.libs.gap', True)
"""
def __init__(self):
r"""
TESTS::

sage: from sage.features.gap import sage__libs__gap
sage: isinstance(sage__libs__gap(), sage__libs__gap)
True
"""
JoinFeature.__init__(self, 'sage.libs.gap',
[PythonModule('sage.libs.gap.libgap'),
PythonModule('sage.interfaces.gap')])


def all_features():
return [sage__libs__gap()]
9 changes: 9 additions & 0 deletions src/sage/features/gfan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Features for testing the presence of ``gfan``
"""

# *****************************************************************************
# Copyright (C) 2022 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import Executable


Expand Down
14 changes: 13 additions & 1 deletion src/sage/features/graph_generators.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of various graph generator programs
"""

# *****************************************************************************
# Copyright (C) 2016 Julian Rüth
# 2018 Jeroen Demeyer
# 2019 Frédéric Chapoton
# 2021 Matthias Koeppe
# 2021 Kwankyu Lee
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

import os
import subprocess

Expand Down
4 changes: 3 additions & 1 deletion src/sage/features/graphviz.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``graphviz``
"""

# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <[email protected]>
# 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import Executable
from .join_feature import JoinFeature

Expand Down
11 changes: 11 additions & 0 deletions src/sage/features/igraph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
r"""
Check for igraph
"""

# ****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import PythonModule
from .join_feature import JoinFeature

Expand Down
4 changes: 2 additions & 2 deletions src/sage/features/imagemagick.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``imagemagick``

Expand All @@ -7,8 +6,9 @@
``identify``, ``composite``, ``montage``, ``compare``, etc. could be also
checked in this module.
"""

# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <[email protected]>
# Copyright (C) 2018-2022 Sebastien Labbe <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
11 changes: 11 additions & 0 deletions src/sage/features/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
r"""
Features for testing whether interpreter interfaces are functional
"""

# ****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

import importlib

from . import Feature, FeatureTestResult, PythonModule
Expand Down
Loading