Eloi Torrents ee6e422a4d init
2025-09-21 14:45:15 +02:00

1.1 KiB
Raw Blame History

SageMath Package Template

A lightweight template that shows how to structure a SageMath package and ship a couple of runnable demos.

Quick start

  • Install the package in editable mode with sage -pip install -e .
  • Run the elliptic curve demo: sage -python elliptic_curve_demo.py
  • Try the simple Sage script: sage -python hello_world.sage

Just shortcuts

  • just prepare create the Sage-aware virtualenv and install the package editable
  • just run execute the elliptic curve demo inside that virtualenv
  • just test run the unit tests with Sage's Python

Running tests

Use Sage's Python so Sage-specific imports resolve correctly when you run the bundled unittest suite:

sage -python -m unittest discover -s tests -t .

Project layout

  • demo_package/ minimal package source code
  • elliptic_curve_demo.py Python entry point using SageMath
  • hello_world.sage / hello_world.sage.py companion Sage script demo
  • tests/ example unittest-based tests

Feel free to copy this template, rename the package, and extend the demos for your own SageMath projects.