Set up code formatting tools

- auto-format code with:
  + autoflake => * remove unused imports and variables
                 * remove duplicate dict keys
                 * expand star imports
  + black => enforce an uncompromising code style
  + isort => enforce a consistent import style
             compliant with Google's Python style guide
- add nox session "format" to run these tools
This commit is contained in:
Alexander Hess 2024-09-10 01:27:34 +02:00
commit fb407631d9
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
5 changed files with 335 additions and 2 deletions

View file

@ -8,6 +8,9 @@ The goal of the `lalib` project is to create
by reading and writing code.
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
## Contributing & Development
This project is open for any kind of contribution,
@ -65,6 +68,21 @@ To execute all default tasks, simply invoke:
`nox`
#### Code Formatting
We follow [Google's Python style guide](https://google.github.io/styleguide/pyguide.html).
During development,
`nox -s format` may be helpful.
It can be speed up by re-using a previously created environment
with the `-R` flag.
This task formats all source code files with
[autoflake](https://pypi.org/project/autoflake/),
[black](https://pypi.org/project/black/), and
[isort](https://pypi.org/project/isort/).
### Branching Strategy
The branches in this repository follow the