Ask Your Question

Revision history [back]

What people do since 10 years to solve this question is the following. This method has been used many times especially in the cases of books using Sage. Every example appearing in their book/paper is added as a doctests in a file which is included in Sage (folder src/sage/tests) that are then guarrenteed to continue running at each new release of Sage.

For example, the README of the src/sage/tests/french_book subfolder says:

This directory contains all the example code from the french book
about Sage by Alexandre Casamayou, Guillaume Connan, Thierry Dumont,
Laurent Fousse, François Maltey, Matthias Meulien, Marc Mezzarobba,
Clément Pernet, Nicolas Thiéry and Paul Zimmermann. Each file corresponds
to a chapter of the book.

The book is freely available from http://sagebook.gforge.inria.fr/

What people do since 10 years to solve this question is the following. This method was suggested by William Stein in December 2008 and has been used many times especially in the cases of books using Sage. Every example appearing in their book/paper is added as a doctests in a file which is included in Sage (folder (in the folder src/sage/tests) that are then guarrenteed to continue running at each new release of Sage.

For example, all the README of code examples from the french book about Sage is in the subfolder src/sage/tests/french_book subfolder says:

This directory contains all the example code from the french book
about Sage by Alexandre Casamayou, Guillaume Connan, Thierry Dumont,
Laurent Fousse, François Maltey, Matthias Meulien, Marc Mezzarobba,
Clément Pernet, Nicolas Thiéry and Paul Zimmermann. Each where "each file corresponds
corresponds to a chapter of the book.
book".

The book

Another example which was added by Dan Drake in 2008 is freely available from http://sagebook.gforge.inria.fr/

named after a paper he submitted on arxiv src/sage/tests/arxiv_0812_2725.py

What people do since 10 years to solve this question is the following. This method was suggested by William Stein in December 2008 and has been used many times especially in the cases of books using Sage. Every example appearing in their book/paper is added as a doctests in a file which is included in Sage (in the folder src/sage/tests) that are then guarrenteed to continue running at each new release of Sage.

For example, all the code examples from the french book about Sage is in the subfolder src/sage/tests/french_book where "each file corresponds to a chapter of the book".

Another example which was added by Dan Drake in 2008 is named after a paper he submitted on arxiv src/sage/tests/arxiv_0812_2725.py

Another option is to publish your code in ReScience: "ReScience is a peer-reviewed journal that targets computational research and encourages the explicit replication of already published research, promoting new and open-source implementations in order to ensure that the original research is reproducible."