2025-09-22 17:38:33 +02:00

31 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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`
## 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
- `just pytest` run the unit tests through pytest to get pytest-style output and plugins
## Running tests
Use Sage's Python so Sage-specific imports resolve correctly when you run the bundled unittest suite. The tests ship as `unittest.TestCase` classes, so you can call either driver:
```bash
sage -python -m unittest discover -s tests -t .
# or, for pytest reporting
sage -python -m pytest
```
## Project layout
- `demo_package/` minimal package source code
- `elliptic_curve_demo.py` Python entry point using SageMath
- `tests/` example unittest-based tests
Feel free to copy this template, rename the package, and extend the demos for your own SageMath projects.