Skip to content

Improve SnapPy integration with Sage knots and links #40105

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

soehms
Copy link
Member

@soehms soehms commented May 14, 2025

Currently, the usage of SnapPy in connection with Sage's knots and links is not really supported, although it can be installed as an optional package. The aim of this PR is to start with an improvement of the integration. In detail the following is done:

  1. add SnapPy as a feature
  2. add direct access to the SnapPy instance of a link by a new method snappy_link
  3. add an alternative implementation to some Sage methods, for example for jones_polynomial
  4. add functionality currently missing in Sage but available in SnapPy, for example verify_hyperbolicity, simplify, deconnect_sum
  5. add new functionality with the help of SnapPy functionality, for example symmetry_type

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@tscrim tscrim self-requested a review May 19, 2025 04:11
@soehms
Copy link
Member Author

soehms commented May 23, 2025

I ran a modified CI-Linux-incremental workflow (the modification just allowed me to set the optional packages to test manually). In these runs all test (exept for an unrelated test in src/sage/rings/complex_double.pyx in tow cases) passed (even for Fedora 41 which failed by a system problem: The hosted runner lost communication with the server). Here some examples:

Ubuntu focal

2025-05-23T13:09:24.5087361Z ### make ptest-nodoc: Running ./sage -t --logfile=logs/test.log -p --optional=sage,optional,!sagemath_doc_html,!sagemath_doc_pdf --all
2025-05-23T13:09:24.5088139Z Running doctests with ID 2025-05-23-12-22-31-5e18a0b2.
2025-05-23T13:09:24.5088937Z Running with SAGE_LOCAL='/sage/local' and SAGE_VENV='/sage/local/var/lib/sage/venv-python3.12.5'
2025-05-23T13:09:24.5089775Z Using --optional=!sagemath_doc_html,!sagemath_doc_pdf,database_knotinfo,debian,pip,sage,sage_spkg
2025-05-23T13:09:24.5096549Z Features to be detected: 4ti2,SAGE_SRC,benzene,bliss,buckygen,conway_polynomials,coxeter3,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dot2tex,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polenta,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,giac,glucose,graphviz,imagemagick,info,ipython,jmol,jupymake,jupyter_sphinx,kenzo,kissat,latte_int,lrcalc_python,lrslib,mathics,matroid_database,mcqd,meataxe,meson_editable,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pycosat,pycryptosat,pynormaliz,pyparsing,python_igraph,requests,rpy2,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.giac,sage.libs.homfly,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,scipy,singular,sirocco,sloane_database,snappy,sphinx,symengine_py,sympy,tdlib,threejs,topcom
2025-05-23T13:09:24.5102784Z Doctesting entire Sage library.
2025-05-23T13:09:24.5103285Z Doctesting all documentation sources.
2025-05-23T13:09:24.5104197Z Sorting sources by runtime so that slower doctests are run first....
2025-05-23T13:09:24.5104737Z Doctesting 4705 files using 5 threads.
2025-05-23T13:09:24.5105940Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/databases/cubic_hecke_db.py
2025-05-23T13:09:24.5106568Z     [178 tests, 2.61s wall]
2025-05-23T13:09:24.5107320Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/knots/free_knotinfo_monoid.py
2025-05-23T13:09:24.5107890Z     [67 tests, 2.84s wall]
2025-05-23T13:09:24.5108612Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/knots/knot.py
2025-05-23T13:09:24.5109122Z     [104 tests, 2.97s wall]
2025-05-23T13:09:24.5109836Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/knots/knotinfo.py
2025-05-23T13:09:24.5110355Z     [379 tests, 6.61s wall]
2025-05-23T13:09:24.5111084Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/features/__init__.py
2025-05-23T13:09:24.5111843Z     [142 tests, 4.21s wall]
...
2025-05-23T13:09:24.5126149Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/features/snappy.py
2025-05-23T13:09:24.5126675Z     [4 tests, 0.01s wall]
...
2025-05-23T13:09:24.5250491Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/knots/link.py
2025-05-23T13:09:24.5251157Z     [682 tests, 22.83s wall]
...
2025-05-23T13:03:20.0894230Z     [18 tests, 3.68s wall]
2025-05-23T13:03:20.0895255Z ----------------------------------------------------------------------
2025-05-23T13:03:20.0899285Z sage -t --warn-long 5.0 --random-seed=277545619004009458150098052305695272649 src/sage/rings/complex_double.pyx  # 1 doctest failed
2025-05-23T13:03:20.0900139Z ----------------------------------------------------------------------
2025-05-23T13:03:20.0900571Z Total time for all tests: 2446.3 seconds
2025-05-23T13:03:20.0900910Z     cpu time: 8413.2 seconds
2025-05-23T13:03:20.0901259Z     cumulative wall time: 10308.3 seconds
2025-05-23T13:03:20.0907404Z Features detected for doctesting: bliss,conway_polynomials,coxeter3,cvxopt,database_cremona_mini_ellcurve,database_ellcurves,database_graphs,fpylll,gap_package_polycyclic,gfan,info,jupyter_sphinx,lrcalc_python,mcqd,meataxe,mpmath,nauty,networkx,numpy,palp,pexpect,pillow,polytopes_db,pplpy,primecountpy,ptyprocess,pyparsing,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.homfly,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.schemes,sage.symbolic,scipy,singular,sirocco,snappy,sphinx,sympy,tdlib,threejs
2025-05-23T13:03:20.9505121Z make[2]: warning: -j9 forced in submake: resetting jobserver mode.

Fedora 41:

sage -t --warn-long 5.0 --random-seed=93077958085837172847315309431099481326 src/sage_setup/util.py
    [6 tests, 0.01s wall]
sage -t --warn-long 5.0 --random-seed=93077958085837172847315309431099481326 src/sage_docbuild/utils.py
    [12 tests, 3.15s wall]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 2002.9 seconds
    cpu time: 6621.8 seconds
    cumulative wall time: 8048.2 seconds
Features detected for doctesting: bliss,conway_polynomials,coxeter3,cvxopt,database_cremona_mini_ellcurve,database_ellcurves,database_graphs,fpylll,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_hap,gap_package_polenta,gap_package_polycyclic,gfan,graphviz,imagemagick,info,jupyter_sphinx,lrcalc_python,mcqd,meataxe,mpmath,nauty,networkx,numpy,palp,pexpect,pillow,plantri,polytopes_db,pplpy,primecountpy,ptyprocess,pyparsing,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.homfly,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.schemes,sage.symbolic,scipy,singular,sirocco,snappy,sphinx,sympy,tdlib,threejs,topcom

Note that snappy is listed under Features detected for doctesting!

@soehms soehms marked this pull request as ready for review May 23, 2025 14:50
@soehms soehms marked this pull request as draft May 26, 2025 06:29
@soehms soehms force-pushed the integration_snappy_knots branch from e9104e9 to ab9b718 Compare May 26, 2025 08:36
@soehms soehms marked this pull request as ready for review May 26, 2025 08:38
Copy link

github-actions bot commented Jun 2, 2025

Documentation preview for this PR (built with commit 21f424e; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant