I’m about to start working on open-source desktop app using wxPython. I need to include and bind 3rd party C library and build Python extension using cffi/cython, possibly use Nuitka python compiler, would like to to provide manual in html/epub/pdf formats created from (most probably) rst markup and desire to provide binary packages for Win/Mac as well as rpm (I’m on Fedora) & deb packages.
Now I wonder what would be about appropriate build system for such a project? I am thinking about CMake & SCons…
I’m biased here, but I think PyInstaller is the way to go. I’m biased because I’m a core developer in case you’re wondering. And wxPython itself works seamlessly with PyInstaller at the moment.
You’re original post is unclear. Could you clarify it? - I see 2 different meanings. PyInstaller will work with both. And RE waf: we use it to build the bootloaders for PyInstaller. I’m not a fan of some parts, but it works - well and easily.
Good to know about PyInstaller’s compatibility with wxpython.
I’ve noticed that packaging world in Python is changing with PEP517 and PEP518…I want to do wxpython project which should possibly provide binary installer for Windows and binary package for Mac OS. I’d also like to generate *.deb package as well as RPM *.spec to cover majority of distros. (not considering container images atm.)
Furthermore, I’ll most certainly make use of Cython package to provide bindings for 3rd party C library (dealing with low-level computations) which I want to include along with the sources of my application. I’ll also use Cython to generate Python C extension for the critical parts of my application which would need some speed up.
Lastly I also want to have some documentation generated in epub/html/PDF formats from the sources written using rst/ConTeXt markup…
Afaik, PyInstaller can help by bundling the whole application and generate stand-alone executables, but I’m not sure it can serve as general build-system to compile C lib, generate Cython extensions etc.?
Does waf support e.g. Cython and other stuff I mentioned above?
waf could be configured to compile cython modules, yes. waf is a meta build system. It’s not actually bound to any language/compiler. You could configure waf to invoke and use PyInstaller as a compiler if you wanted.
RE Documentation. https://sphinx-doc.org is by far the way to go. I use that for all of my personal projects, and it’s used on PyInstaller, wxPython, and Python itself for documentation generation - and most *.readthedocs.io sites are sphinx-generated. reST is recommended. Sphinx supports LaTeX PDF, html, and epub output.
So as I understand you have a project. The GUI - and maybe more - is in python. High-speed stuff is written in C, with Cython binding it into python extensions. You need to compile it all with a one-command setup. I’d use waf or write a python/shell/batch/powershell script(s) which call each of the seperate compilers and pull all of the output together. (We have 4 seperate bootloader builds for PyInstaller. We only need run python ./waf all to build them all because waf can do that.
And finally installers. When it comes to Linux/macOS I must admit to be as stumped as you - or more. I personally use InnoSetup for windows, which is kind of open source. It’s a great solution that generates a single .exe file which starts a Wizard to install everything. I’ve also heard NSIS is good, but never used it myself.
PS There is a solution for distribution on Linux/macOS which is easy and I know of. Unfortunately it’s commercial and costs - a lot.
Well, I want to write custom code using 3rd party C library which I want to call from Python by using bindings produced by Cython
Furthermore, if some Python back-end code is going to be too slow, then I plan to speed it up by Cythonizing it.
I was close enough .
So if you use Meson the disadvantage is you can’t compile the Cython/Python code easily AFAIK - but I don’t use Meson so . Python is a powerful scripting language after all - I have a python script to checkout the latest changes from the PyInstaller repo, build the bootloaders, build a python script, and test it. It can reset branches, change the origin, pass options to the bootloader build command etc. It’s less than 100 lines.
So a quick summary of recommendation:
A build system for C/everthing
waf - everything
meson - C, but you can use scripts to do the rest - even trigger the meson build.
Cython for the cython modules. Either use the cythonize command, or use a setup.py system.
Spinx - documentation. Readthedocs/GitHub pages are the best free hosting options.
PyInstaller for building the final executable from the python frontend. This is very compatible but probably won’t work straight out of the box with pyinstaller main.py; you’ll need to use a large set of options. See https://pyinstaller.readthedocs.io for documentation.