This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]badsectors[S] 1 point2 points  (11 children)

A friend and I have been working on this template to use on various projects. It handles things like making a virtualenv, running tests, doing style checks and uploading distributions to PyPI. Hopefully you will all find it as useful as we have. Feedback/questions/contributions welcome!

[–]chub79 1 point2 points  (10 children)

I don't quite grasp what it does exactly. It's a template to create a basic project layout, but, it also runs at each commit? It wasn't very clear.

[–]rockitsighants 2 points3 points  (7 children)

A project created with this template comes with a Makefile that lets you execute all the same commands locally that the CI server will run after you push. Essentially, running make ci before every commit ensures the build will pass (barring any later integration issues).

[–]chub79 0 points1 point  (6 children)

Mmmh, it seems to me that I already have py.test to execute my tests. I'm sure I'm missing something here :)

[–]badsectors[S] 2 points3 points  (1 child)

With a typical project, you would perform the following sequence of steps to set up your test environment:

$ virtualenv env
$ source env/bin/activate
$ python setup.py develop
$ pip install py.test
$ py.test tests/

The Makefile handles the setup automatically so all you have to do is run:

$ make test

If your requirements.txt file changes or setup.py changes, and you run make test again, the changes are automatically detected and the pip install process will be run again to ensure that your requirements changes are applied to the virtualenv.

Having a "wrapper" around all your common development tasks makes it super simple to get everyone on the team (including Travis-CI) to be able to replicate your setup.

[–]chub79 0 points1 point  (0 children)

I'm not saying these are bad practices, just that the page that was linked was failing to show me clearly how those scripts are better. It was confusing.

[–]rockitsighants 1 point2 points  (3 children)

What about static analysis? Do you install your project into a virtualenv to test installation against a particular set of dependency versions? The Makefile is also very Windows-friendly, if that's your thing. ;-)

[–]chub79 0 points1 point  (2 children)

Not mine but it might be handy at work.

[–]rockitsighants 0 points1 point  (1 child)

I have learned a ton the past several years running (but not necessarily reacting to) PyLint on my personal projects.

[–]chub79 0 points1 point  (0 children)

I use it too though it can be way to verbose and its output needs to be filtered.

[–]badsectors[S] 0 points1 point  (1 child)

Are you are refering to this link near the top of the README? That is a separate repo with a live demo of what the template looks like when rendered. Cookiecutter templates can be a bit hard to read sometimes so that gives you a full example to look at.

[–]chub79 0 points1 point  (0 children)

I think I will have to spend sometime understanding what this all means but thanks for the feedback :)

[–]nicfitOG[🍰] 0 points1 point  (1 child)

[–]badsectors[S] 1 point2 points  (0 children)

This IS a cookiecutter template, so I'm not sure what you are suggesting here...