ComForm: Python Comment Conformity Formatter
An auto-formatter for pretty and readable comment formatting in python.
WARNING: comform
is made for my own usage so it's not been tested in a variety of
environments. Use it on your own code at peril ;)
.
Comments are formatted as markdown text using the fantastic
mdformat
package. Treating comments as
markdown has drawbacks, but I've found these to be outweighed.
Usage
This package can be installed from PyPI as usual via pip install comform
and is meant
to be used as a command line tool. It can also be used as a pre-commit
hook. Whichever
way comform
is used I recommend running black
first; it was mainly developed for
this use-case.
The command line interface is:
comform [-h] [--version] [--check] [--align] [--dividers] [--wrap N] paths [paths ...]
and inputs can also be configured in pyproject.toml
:
[tool.comform]
# these are the default values:
check = false
align = false
dividers = false
wrap = 88
check
, align
and dividers
work if they are set in the CLI or the config. If
wrap
is set in both then the CLI takes priority.
To use comform
as a pre-commit
hook add the following to your
.pre-commit-config.yaml
:
- repo: https://github.com/j-hil/comform
rev: 0.1.0
hooks:
- id: comform
Development
Too see my development process see development.md.