How can I avoid getting useless warnings while building my package using setuptools?

Viewed 1371

It seems that setuptools triggers various warnings that are really of zero value and I want to get rid of them as they are spamming the continuous integration progress, making just harder to spot real warnings.

Here are those that I do want to get rid of:

python setup.py -q bdist_wheel
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*.pyo' found under directory '*'
warning: no previously-included files matching '*.orig' found under directory '*'
warning: no files found matching '*.md' under directory 'releases'
warning: no files found matching '*.rst' under directory 'releases'
warning: no files found matching '*.json' under directory 'releases'
warning: no previously-included files matching '*' found under directory 'examples/node_modules'
no previously-included directories found matching 'examples/node_modules'
warning: build_py: byte-compiling is disabled, skipping.

warning: install_lib: byte-compiling is disabled, skipping.

It seems that all these are caused by the MANIFEST.in file but the conditions there do have a reason for being there, and that's clearly not the one of generating warnings when exclude patters do find no files to match?!

2 Answers

I use a makefile to build my project and I had to add the following line to the top:

unexport PYTHONDONTWRITEBYTECODE

In shell, you must unset PYTHONDONTWRITEBYTECODE, too. Setting it from 1 to 0 won't work. I am using zsh though, so maybe the answer above will work elsewhere.

Also, you can pass -B to python directly to disable byte-compiling, but the environment variable takes precedence over it (at least in the Python 3 version I am using - 3.6.8). I do not see an option to force turning on byte-compiling, though.

Lastly, you can pass --help to most setup.py commands to get info on flags they support. For example, build_py and install_lib support --compile/-c, --no-compile flags which should help you with fine-grain control, although the environment variable again takes precedence from my experience.

Related