Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which build tool(s) do you recommend for python? [closed]

I'm starting a small/medium-sized python project, likely in Test Driven Development. My backgrounds are more in C and java than python (I used ant and makefile)

I know that in python you might not need a build tool, but I will, because I'll use cython and PyInstaller (the thing should work on a couple of different UNIXes, without depending directly on python) and I'd like the convenience of selecting the tests form CLI, building the docs, maybe check dependencies, etc.

Somebody is complaining that python lacks a make-like tool. I know that few tools exist, like scon and paver, but I'd like to hear from real users and not just their website. Does anybody use paver?

What's about the usual setup.py that comes with many packages? I looked into a few to see if there is a common usage, but I didn't find anything interesting (maybe I used the wrong examples)

Do you recommend sticking with things I already know (ant and Makefile) at least to start? If so, is there any ant extension you recommend for python (+cython+pyinstaller+pyUnit)?


EDIT: to avoid further answers like jwp's one, note that, for this project, I absolutely need my program being a standalone executable because it is absolutely impossible to have a python VM on the target platform where the executable will run. I have exactly the same hw available for compiling, so luckly I don't need to cross-compile (but I'd do the development on a more friendly Linux).

I'd also like to test if my code compile in Cython from the beginning, not to premature optimize, but just to be sure that I'm not going too far with the use of incompatible features, which would require a painful refactoring if Cython would be seriously needed.

So please focus on my actual question

like image 963
Davide Avatar asked May 15 '09 19:05

Davide


People also ask

What is the best build tool for Python?

PyBuilder is a powerful software build tool written in Python programming language. Because of the way it was engineered, this library primarily targets Python projects, but due to its extensible nature it can be used for the building and management of software in other languages as well.

Does Python have a build tool?

The ActiveState Platform provides a cloud-based Python build tool that requires no Python or operating system expertise. It automates the building of Python packages (including linked C libraries) from source code, resolving dependencies, and packaging your environment for deployment on Windows, Linux and Mac.

What is build system for Python?

The Python build system consists of a frontend user interface that integrates with a backend to build package artifacts. Because the build process creates package artifacts, you can now check the effect of running the build. List the contents of the root directory for your package now.


2 Answers

If it is at all possible, I'd suggest avoiding extension modules(C/cython) in the beginning. Get your all code written in Python, use a simple distutils based configuration, run your tests using -m (python -m mypkg.test.testall, or whatever; import unittest).

Once you get your project to a comfy state, then start tackling some optimizations with cython and the extra project management that comes with that. distutils can build extension modules, so I'm not sure you'll need make/scons..

 project-dir/   setup.py   mypkg/    __init__.py    mymod.py    test/     __init__.py     testall.py     testsomething_specific.py 
like image 180
jwp Avatar answered Oct 05 '22 19:10

jwp


Your requirements suggest rather Scons which, according to their website, has more control over variety of building tasks than Paver. In the latter you would end up using a lot of sh() which runs a regular command line programs.

Recently, I started using Paver which is really great to run tests, build documentations with Sphinx, but I use only pure Python. If you want to see what's possible with Paver I highly recommend those 2 articles: converting-from-make-to-paver and writing-technical-documentation by Doug Hellmann and you definitely want to check his pavement.py configuration file.

like image 23
Piotr Byzia Avatar answered Oct 05 '22 17:10

Piotr Byzia