Packaging BornAgain into PyPi (to be installed with pip)
The plan is to prepare BornAgain as a standard package in PyPi repository. First, a fully working Python package with the required specifications will be built for the Linux platform. After the successful test of this package, the CI scripts for Linux will be modified to produce the package automatically. Finally, upon the experience on Linux, the package will be built for other platforms.
Plan
-
Gather the dependencies inside the package for an easy installation and avoiding interference with the libraries on the user machine (similar to Numpy's approach). Major external dependencies: libBornAgain*.so ├─libboost_iostreams.so.1.74.0 (GZIP, BZIP2 support in Device) ├─libtiff.so.5 ├─libtiffxx.so.5 ├─libcerf.so.1 ├─libfftw3.so.3 └─libgsl.so.25 └─libgslcblas.so.0
-
Add link flag -Wl,-rpath,\$ORIGIN
to BA shared libraries to setRPATH
to the directory of the BA library, so that the local copy of shared libraries be found by the dynamic linker; see eg., Drepper’s article, “How to write shared libraries” (2011). -
The secondary dependency of libgsl
onlibgslcblas
can only be resolved via a static linking of those libraries. Proper static libraries must be built with the flag-fPIC
. A better way might be possible.
-
-
Provide the Python interface for multiple Python versions, 3.6–3.9. -
Build a minimal Python platform for earlier versions 3.6–3.9 (not available on the recent Debian repository). -
Add Numpy and Matplotlib to the Python platform. -
Compose CMake scripts to find the proper Python headers and libraries. -
Compile and link the BornAgain shared libraries for the selected Python versions.
-
-
Compose the Python setup script and config files to build the Python wheel according to the latest prescriptions (PEP 518). -
Publish the first prototype on the Test PyPI.
-
-
Extend the CMake and GitLab CI scripts to automatically build BA shared libraries for multiple versions of Python in the build process -
Add a switch to turn on Python package building. -
Add switches to turn off the support for GZIP, BZIP2, and TIFF to reduce external dependencies. -
Add Python tests for each Python version of the library. -
Incorporate the Python package building script in the CMake scripts.
-
-
Upload the Python wheel to the standard PyPI repository. -
Provide the Python package for Windows and Mac operating systems (repeat the steps above for each platform).
Note that all the steps must be documented.