The functionality outlined below, and much more, is implemented in Hodge diamond cutter, which can be used in Sage. If you use it for your research, please cite it using DOI.

It was a tedious task, but the Hodge diamond cutter now has

Using the library

It's enough to have the file diamond.py (pay attention to the file extension) somewhere where Sage can find it via load("diamond.py") and then you are good to go.

Unit tests

Having unit tests is very convenient to test regressions, and to showcase the functionality. Almost every method and construction now has (multiple) examples showcasing how to use it, and the library in general.

By typing sage -t diamond.py Sage automatically executes all the code in the examples section in the documentation, and reports (as of today) that

Doctesting 1 file.
sage -t --random-seed=0 diamond.py
    [194 tests, 5.49 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 5.6 seconds
    cpu time: 5.5 seconds
    cumulative wall time: 5.5 seconds

Thanks to Alex Best and Jieao Song for pull requests, fixing things and significantly improving the efficiency!