So I'm a python dev and I've discovered the very good bundle Python FMT recently. I wanted to share a few tips and tricks with you.
Using venvs
I'm a big user of venvs, so Python FMT needs to be told where to find the python executable for each project. This is easily achieved with the .tm_properties file in each repo like so:
TM_PYTHON_FMT_PYTHON_PATH=$TM_PROJECT_DIRECTORY/venv/bin/python3
Pylintrc
By default, pylint as run by Python FMT will look for a pylintrc file. It's meant to be looking in the current project directory but somehow that didn't work for me. Again .tm_properties is handy to fix this:
TM_PYTHON_FMT_PYLINTRC=$TM_PROJECT_DIRECTORY/.pylintrc
If you don't use a project-specific pylintrc file, then you can create one for your user and get rid of the error message that pops up by running the following command:
pylint --generate-rcfile > ~/.pylintrc
Disabling a linter
We happen to only use pylint at work, so I don't need flake8 to run as well (default). In order to disable it, simply set the variable TM_PYTHON_FMT_FLAKE8 to /dev/null. If you only use flake8, do the same with pylint with the variable TM_PYTHON_FMT_PYLINT instead.
Disabling Black
Some of our repos don't use Black (yet). So to avoid making a commit mess, Black can be bypassed by setting the variable TM_PYTHON_FMT_BLACK to /usr/bin/tee.