Opened 11 months ago

Last modified 3 weeks ago

#33384 new enhancement

Deprecate global imports of CombinatorialObject, CombinatorialClass, MapCombinatorialClass

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.9
Component: combinatorics Keywords:
Cc: Travis Scrimshaw, Frédéric Chapoton Merged in:
Authors: Matthias Koeppe Reviewers:
Report Upstream: N/A Work issues:
Branch: u/mkoeppe/deprecate_global_imports_of_combinatorialobject__combinatorialclass__mapcombinatorialclass (Commits, GitHub, GitLab) Commit: 1d3a09baf94a54112382f06acacb098c9f186d27
Dependencies: Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

Part of #12913 (Meta-ticket: Deprecate CombinatorialClass in favor of the EnumeratedSet's categories)

Change History (9)

comment:1 Changed 11 months ago by Matthias Köppe

Branch: u/mkoeppe/deprecate_global_imports_of_combinatorialobject__combinatorialclass__mapcombinatorialclass

comment:2 Changed 11 months ago by Matthias Köppe

Authors: Matthias Koeppe
Commit: 81fcc921a5a35f3fd0a02bc8ccb6373dbd76af41
Description: modified (diff)

New commits:

231fe03src/sage/combinat/all.py: Deprecate the global imports of CombinatorialObject, CombinatorialClass, MapCombinatorialClass
81fcc92src/doc/en/developer/coding_basics.rst: Replace use of CombinatorialObject in doctest

comment:3 Changed 11 months ago by git

Commit: 81fcc921a5a35f3fd0a02bc8ccb6373dbd76af411d3a09baf94a54112382f06acacb098c9f186d27

Branch pushed to git repo; I updated commit sha1. New commits:

d4810bfsrc/sage/misc/persist.pyx: Import CombinatorialObject in doctest here
ad521cfsrc/sage/combinat/combinat.py: Add deprecation warning in doctest output
1d3a09bsrc/sage/combinat/combinat.py: Explicitly import CombinatorialClass in some doctests

comment:4 Changed 11 months ago by Matthias Köppe

The deprecation via lazy imports unfortunately does not work very well:

sage -t --random-seed=332440843511251861710123815794934176969 src/sage/combinat/combinat.py
**********************************************************************
File "src/sage/combinat/combinat.py", line 1198, in sage.combinat.combinat.CombinatorialObject.__eq__
Failed example:
    class Bar(Element, CombinatorialObject):
        def __init__(self, l):
            CombinatorialObject.__init__(self, l)
Exception raised:
    Traceback (most recent call last):
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.combinat.combinat.CombinatorialObject.__eq__[7]>", line 1, in <module>
        class Bar(Element, CombinatorialObject):
    TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

comment:5 Changed 11 months ago by Matthias Köppe

Cc: Travis Scrimshaw Frédéric Chapoton added

comment:6 Changed 11 months ago by Travis Scrimshaw

Hmm...that is a bit strange. Perhaps something is not being resolved correctly? I don't know from a quick look what is going on. However, +1 for doing this ticket.

comment:7 Changed 10 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:8 Changed 5 months ago by Matthias Köppe

Milestone: sage-9.7sage-9.8

comment:9 Changed 3 weeks ago by Matthias Köppe

Milestone: sage-9.8sage-9.9
Note: See TracTickets for help on using tickets.