Skip to main content

A linter and inspector for INI format files

Project description

logo PyINILint

pipeline status Copr build status pypi package

The pyinilint command line utility allows you to lint (check the syntax) of INI-like configuration files. Here’s an example of the simplest possible useage.

pyinilint myfile.ini

Silent output, and a 0 exit status means that myfile.ini has been parsed successfully.

The pyinilint utility is a front-end to the Python configparser module, which supports interpolation. This means you can have "variables" in your INI-files which can be optionally replaced with values, which can be defined within the same, or different, INI-file. Using different pyinilint command line switches you can inspect what is happening with variable interpolation in your INI-files.



If you use Fedora then you can install pyinilint via a Copr respository.

dnf copr enable danieljrmay/pyinilint
dnf install pyinilint

The installed RPMs include a man page and Bash completion script.


You can get a distribution of pyinilint from PyPI.

pip install pyinilint

However, this distribution currently does not include the man page or Bash completion script.

Source Code Release

You can download a source code release from the pyinilint project’s GitLab releases page. You can then install with something like the following:

tar -xzf pyinilint-0.10.tar.gz
cd pyinilint-0.10
make pybuild
sudo make install
sudo make pyinstall

The make and sudo make install builds and installs the man page and Bash completion script. The make pybuild and sudo make pyinstall builds and installs the Python module and console script.


pyinilint --help
usage: pyinilint [-h] [-b] [-d] [-e ENCODING] [-m] [-o] [-r] [-s] [-v]
                 paths [paths ...]

pyinilint (version 0.10) is a linter and inspector for INI format files.

positional arguments:
  paths                 paths of the file(s) to check

optional arguments:
  -h, --help            show this help message and exit
  -b, --basic           use basic interpolation, the default is extended
  -d, --debug           show debugging messages
  -e ENCODING, --encoding ENCODING
                        set the encoding to be used, omit to use the default
  -i, --interpolate     interpolate the parsed configuration without output
  -m, --merge           merge files into a single configuration
  -o, --output          output the parsed configuration to stdout
  -r, --raw             output raw, do not interpolate
  -s, --serialize       output the interpolated and serialized configuration
                        to stdout
  -v, --verbose         show verbose messages

See for more information.


-b, --basic

Use basic interpolation when parsing. See the Python configparser interpolation documentation below for more information.

-d, --debug

Output debugging messages, probably only of interest to those developing pyinilint.

-e ENCODING, --encoding ENCODING

Specifiy a non-default encoding to use when parsing the files to be checked.

h, --help

Display help and version information.

i, --interpolate

Interpolate the parsed configuration but do not output anything. This is useful for detecting warnings and errors in the interpolation syntax or values.

-m, --merge

Read all the specified files into a single Python ConfigParser object; this allows interpolation between files. When this option is not specified each file is read into its own seperate ConfigParser object.

-o, --output

Output the parsed configuration to STDOUT without any interpolation. Use the --serialize options to enable interpolation.

-r, --raw

Use raw mode, so there is no interpolation when parsing. See the Python configparser interpolation documentation below for more information.

-s, --serialize

Output the parsed, interpolated and serialized configuration to STDOUT. Use this together with the --basic, --merge and --raw options to inspect the interpolation of "variables" within you INI-files.

-v, --verbose

Print verbose messages.

Exit status

This is the list of exit status codes and their meanings returned to the shell by pyinilint.

Exit Status Name Meaning
0 EXIT_OK Everything went well, all files linted successfully.
1 EXIT_NON_EXISTANT_FILE At least one of the specified files does not exist.
2 EXIT_SYNTAX_ERROR There was an error in the command line syntax.
3 EXIT_UNREADABLE_FILE At least one of the specified files existed but was not readable.
4 EXIT_DUPLICATE_SECTION There is a duplicate section in the INI file.
5 EXIT_DUPLICATE_OPTION There is a duplicate option in the INI file.
6 EXIT_INTERPOLATION_MISSING_OPTION There is no corresponding option to a given interpolation key in the configuration.
7 EXIT_INTERPOLATION_DEPTH Maximum recursion depth has been exceeded in interpolation.
8 EXIT_MISSING_SECTION_HEADER There is a missing section header.
9 EXIT_PARSING_ERROR Usually some kind of syntax error within an INI file.
10 EXIT_UNKNOWN_ERROR A catch-all for some other kind of error, inspect the error message for more details.


Check a single file

pyinilint myfile.ini

A silent response (with exit status of 0) means that myfile.ini has passed the lint check.

Check multiple individual files

pyinilint -v myfile1.ini myfile2.ini

Check multiple files treating each one individually and output verbose messages.

Check multiple files in a collection, and output the serialized results

pyinilint -m -s myfile1.ini myfile2.ini

Check multiple files as part of a single ConfigParser object, and output the parsed and interpolated values.

Check a file with a custom encoding

pyinilint -e iso8859_15 myfile.ini

Check myfile.ini using iso8859_15 encoding.


If your INI-files are ultimatly going to be parsed by an INI-parser different from ConfigParser then you should be aware that there can be subtle differences in INI-file format between parsers. However, it should still spot most howling errors!


Please get in contact via the pyinilint project’s GitLab website to:

  • Report issues or make feature requests.
  • Clone or fork the Git source code tree.
  • Say “hello!” 😉


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

pyinilint-0.17.tar.gz (23.5 kB view hashes)

Uploaded source

Built Distribution

pyinilint-0.17-py3-none-any.whl (22.2 kB view hashes)

Uploaded py3

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