Skip to main content

Python Comment Conformity Formatter

Project description

ComForm: Python Comment Conformity Formatter

code style: black Imports: isort

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 are considered enabled 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.1
    hooks:
      - id: comform

Development

Too see my development process see development.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comform-0.1.1.tar.gz (27.9 kB view hashes)

Uploaded Source

Built Distribution

comform-0.1.1-py2.py3-none-any.whl (20.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page