Ask Your Question

Revision history [back]

I would like to answer two questions rather than one. Namely

  1. how to interface your C++ code with SageMath or Python
  2. how to distribute your C++ library (so that SageMath users can easily benefit from it)

interface: writing a Python interface to a C++ library can be done in several ways. I know of at least

Each one of these tools has its pros and cons. The interface needs not be written in sage source code itself and can easily be a standalone library. The three examples above are of this kind.

distribution: the first step in having people try your C++ library (and possibly a Python interface) is to have releases of your source code. This comes with versioning, API/ABI compatibilities between versions, ... One way out of the box is to use some automatized tools such as GNU autoconf, GNU automake or alternatively cmake. Though not all softwares use it, eg PARI/GP has a home-made build script.

Once you have proper and official releases of your libraries, you can ask yourself how to make this library available in a binary form (for conda, for linux distributions, for homebrew, etc). Each system has its own way of compiling and distributing packages. If your library is popular enough, you will easily find help to make packages available but this is a question towards them rather than sage developers.