Look in the devel/sage/sage/matrix/ directory for examples. matrix_mpolynomial_dense.pyx looks like a pretty minimal example. matrix_symbolic_dense.pyx and matrix_double_dense.pyx might be good examples too.