freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Updates to Docwriter: Logging, testing, linting


From: Nikhil Ramakrishnan
Subject: Re: [ft-devel] Updates to Docwriter: Logging, testing, linting
Date: Sat, 14 Jul 2018 19:27:58 +0530


There likely isn’t one because `foo( bar )` is discouraged in Python-land: https://www.python.org/dev/peps/pep-0008/#pet-peeves. If it’s okay with Werner, I strongly suggest going with idiomatic Python style instead of carrying over the C style. The formatter Black will do everything you need for that.

I've applied black to docwriter.py in the latest commit where I implement cli using argparse. It looks quite readable, IMHO. Of course, I'll only go ahead with this formatting style (PEP8 with line length 80) if Werner agrees. Here's the 'black' formatted version:

  https://github.com/nikramakrishnan/freetype-docwriter/blob/f6f9dd07d89fa72bb5f17d563011e0790f2324a1/docwriter.py

> This is fixed. Module descriptions are in docstrings now.

As I commented on GitHub, I recommend using https://pypi.org/project/docformatter/ for formatting docstrings.

Yes, I'll add this, thanks.
 
In short: automate all the drudgery you can automate and you will increase maintainability.


Speaking of automation, did I mention pre-commit yet? https://pre-commit.com/, `pip install pre-commit`.

It automates running Git hooks on your project on every commit. You can e.g. automatically run black on the source, remove spurious line-end whitespace, check YAML files and much more.

You insert a file like https://github.com/fonttools/ufoLib2/blob/master/.pre-commit-config.yaml in your top-level and run `pre-commit install`. After that, every commit is run through the gauntlet before being allowed to pass. Follow the repo URLs to see available hooks to run. I personally like pyupgrade.

This looks great, I'll check it out as soon as I can.
 
You could also run it via tox on Travis: https://github.com/fonttools/ufoLib2/blob/master/tox.ini

Tox seemed too much for this module, and Travis does the multi-version checks anyway. but I'll consider adding it.


--
Nikhil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]