Skip to main content

A tool for indentation in text files

Project description

Canonicalise the leading indentation of blank lines in text files.


For the purposes of this tool, a “blank line” is a line containing only whitespace characters.

Intentionally Blank can apply one or more formatters to a text file for the purposes of modifying the arrangement or representation of whitespace.

To get command-line help, use the --help option:

$ intentionally-blank --help
Usage: intentionally-blank [OPTIONS] COMMAND [ARGS]...

                                  The logging level to use.
  --version                       Show the version and exit.
  --help                          Show this message and exit.


To list the available formatters, used the list-formats command:

$ intentionally-blank list-formats

To describe the action of particular formatter, use the describe-format command:

$ intentionally-blank describe-format --format=leading
Blank lines have leading whitespace equal to that on the previous non-blank line.

To actually reformat a text file, we can use the format command. To get help on a particular command, like format, use the command and the --help option:

$ intentionally-blank format --help
Usage: intentionally-blank format [OPTIONS] INPUT OUTPUT

  --format [empty|identity|leading|visible]
  --help                          Show this message and exit.

Now, use the format command to adjust whitespace:

$ intentionally-blank format --format=leading infile.txt outfile.txt

To have blank lines be completely empty save for the terminating newline sequence, use --format=empty:

$ intentionally-blank format --format=empty infile.txt outfile.txt

Multiple --format options can be provided, and they will be applied in the order given. Here we apply the “leading” format, and then the “visible” format which makes whitespace characters visible:

$ intentionally-blank format --format=leading --format=visible infile.txt outfile.txt

Either the INPUT or OUTPUT positional arguments can be replaced with a hyphen - to cause input to be read from stdin or output to be written to stdout:

$ intentionally-blank format --format=leading --format=visible infile.txt -

## CI/CD


To release, there is a short manual process:

$ bumpversion patch $ python sdist bdist_wheel $ twine upload dist/* –config-file=path/to/sixty-north.pypirc

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

intentionally-blank-1.1.1.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

intentionally_blank-1.1.1-py3-none-any.whl (16.2 kB view hashes)

Uploaded 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