Thursday, January 18, 2018

The file of a Python project can be as simple as this:

from setuptools import setup
setup(name='foo', version='1.0.0')

But for atelier there are two additional required conventions:

  • The must actually call the setup() function only if invoked from a command line, i.e. only if __name__ == ‘__main__’.
  • The must definea name SETUP_INFO which is a dict containing all those keyword arguments passed to the setup() function.

So the above minimal file becomes:

from setuptools import setup
SETUP_INFO = dict(name='foo', version='1.0.0')
if __name__ == '__main__':

When I recently added the timtools project to my atelier, I forgot to verify this condition. It took me at least one hour to find the reason. I now added a test to atelier.projects.get_setup_info() in order to make it more fool-proof:

Oops, {} called sys.exit().
Atelier requires the setup() call to be in a "if __name__ == '__main__':\" condition.

I updated the documentation about atelier Usage.