[openstack-dev] [all] PYTHONDONTWRITEBYTECODE=true in tox.ini

Doug Hellmann doug at doughellmann.com
Fri Sep 12 15:11:43 UTC 2014


On Sep 12, 2014, at 7:39 AM, Sean Dague <sean at dague.net> wrote:

> I assume you, gentle OpenStack developers, often find yourself in a hair
> tearing out moment of frustration about why local unit tests are doing
> completely insane things. The code that it is stack tracing on is no
> where to be found, and yet it fails.
> 
> And then you realize.... that part of oslo doesn't exist any more....
> except there are still pyc files laying around. Gah!
> 
> I've proposed the following to Nova and Python novaclient -
> https://review.openstack.org/#/c/121044/
> 
> Which sets PYTHONDONTWRITEBYTECODE=true in the unit tests.
> 
> This prevents pyc files from being writen in your git tree (win!). It
> doesn't seem to impact what pip installs... and if anyone knows how to
> prevent those pyc files from getting created, that would be great.
> 
> But it's something which hopefully causes less perceived developer
> fragility of the system.
> 
> 	-Sean

I also use git-hooks with a post-checkout script to remove pyc files any time I change between branches, which is especially helpful if the different branches have code being moved around:

git-hooks: https://github.com/icefox/git-hooks

The script:

$ cat ~/.git_hooks/post-checkout/remove_pyc
#!/bin/sh
echo "Removing pyc files from `pwd`"
find . -name '*.pyc' | xargs rm -f
exit 0

> 
> -- 
> Sean Dague
> http://dague.net
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev




More information about the OpenStack-dev mailing list