Opened 2 years ago

Closed 2 years ago

#28565 closed enhancement (fixed)

improve introspection of Macaulay2 interface

Reported by: gh-mwageringel Owned by:
Priority: major Milestone: sage-9.0
Component: interfaces: optional Keywords: macaulay2, IMA Coding Sprint
Cc: saliola, dimpase, gh-antonleykin Merged in:
Authors: Markus Wageringel Reviewers: Franco Saliola
Report Upstream: N/A Work issues:
Branch: 4ae76ef (Commits, GitHub, GitLab) Commit: 4ae76efe3f1fea4eab29214059e42277f5100eb3
Dependencies: Stopgaps:

Status badges


This ticket improves the introspection for the Macaulay2 interface:

  • help is now called with a Macaulay2 string instead of a symbol, as this works in more generality, for example for global variables:
    sage: macaulay2.errorDepth?
  • The class Macaulay2FunctionElement of functions with applied first argument is implemented. This allows to make the help and source code more specific by taking into account the first argument. For example the following only shows the relevant output for Ideal, but not for Matrix or Module.
    sage: I = macaulay2('ideal 4')
    sage: I.resolution?
    sage: I.resolution??

The __getattr__ of Macaulay2 is removed as it is not needed anymore since _function_class is implemented.

  • The _sage_src_ of Macaulay2Function is simplified. This also fixes an issue where all the lines are shown with a special end character ^M when inspecting Macaulay2 source code as in:
    sage: macaulay2.matrix??
    code(methods matrix)^M
    o1000000008 = -- code for method: matrix(List)^M
  • The nodetex and noreplace directives for Sage documentation are added to avoid reformatting of the Macaulay2 documentation. Previously one would get
    sage: macaulay2.matrix?
    | i1 : matrix{{1,2,3},{4,5,6}} |
    | o1 = | 1 2 3 | 4 5 6 |  2    |
    | 3  o1 : Matrix ZZ  <--- ZZ   |
    instead of
    |i1 : matrix{{1,2,3},{4,5,6}}|
    |                            |
    |o1 = | 1 2 3 |              |
    |     | 4 5 6 |              |
    |                            |
    |              2        3    |
    |o1 : Matrix ZZ  <--- ZZ     |

Change History (5)

comment:1 Changed 2 years ago by gh-mwageringel

  • Authors set to Markus Wageringel
  • Branch set to u/gh-mwageringel/28565
  • Cc saliola dimpase added
  • Commit set to dc7922f88f68b78b1fc817b01a5a8ae5b3586815
  • Status changed from new to needs_review

New commits:

dc7922f28565: improve macaulay2 introspection

comment:2 Changed 2 years ago by gh-mwageringel

  • Cc gh-antonleykin added
  • Keywords IMA Coding Sprint added

comment:3 Changed 2 years ago by saliola

  • Branch changed from u/gh-mwageringel/28565 to public/interfaces/m2/28565
  • Commit changed from dc7922f88f68b78b1fc817b01a5a8ae5b3586815 to 4ae76efe3f1fea4eab29214059e42277f5100eb3

New commits:

4ae76efMerge branch 'develop' into u/gh-mwageringel/28565

comment:4 Changed 2 years ago by saliola

  • Reviewers set to Franco Saliola
  • Status changed from needs_review to positive_review

comment:5 Changed 2 years ago by vbraun

  • Branch changed from public/interfaces/m2/28565 to 4ae76efe3f1fea4eab29214059e42277f5100eb3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.