Package: pyinilint
PyINILintThepyinilintcommand line utility allows you to lint (check the
syntax) ofINI-like
configuration files. Here’s an example of the simplest possible
useage.pyinilint myfile.iniSilent output, and a0exit status means thatmyfile.inihas been
parsed successfully.Thepyinilintutility is a front-end to the Pythonconfigparsermodule, 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.InstallationCoprIf you use Fedora then you can installpyinilintvia aCopr
respository.dnf copr enable danieljrmay/pyinilintdnf install pyinilintThe installed RPMs include a man page and Bash completion script.PyPIYou can get a distribution ofpyinilintfrom
PyPI.pip install pyinilintHowever, this distribution currently does not include the man page or
Bash completion script.Source Code ReleaseYou can download a source code release from thepyinilintproject’s
GitLab releasespage. You can then install with something like the following:tar -xzf pyinilint-0.10.tar.gzcd pyinilint-0.10makemake pybuildsudo make installsudo make pyinstallThemakeandsudo make installbuilds and installs the man page
and Bash completion script. Themake pybuildandsudo make pyinstallbuilds and installs the Python module and console script.Usagepyinilint --helpusage: 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 checkoptional 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 ENCODINGset 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 configurationto stdout-v, --verbose         show verbose messagesSee https://github.com/danieljrmay/pyinilint for more information.Options-b,--basicUse basic interpolation when parsing. See the Python configparser
interpolation documentation below for more information.-d,--debugOutput debugging messages, probably only of interest to those
developing pyinilint.-e ENCODING,--encoding ENCODINGSpecifiy a non-default encoding to use when parsing the files to be
checked.h,--helpDisplay help and version information.i,--interpolateInterpolate the parsed configuration but do not output anything. This
is useful for detecting warnings and errors in the interpolation
syntax or values.-m,--mergeRead all the specifiedfiles into a single PythonConfigParserobject; this allows interpolation between files. When this option is
not specified each file is read into its own seperateConfigParserobject.-o,--outputOutput the parsed configuration toSTDOUTwithout any
interpolation. Use the--serializeoptions to enable interpolation.-r,--rawUse raw mode, so there is no interpolation when parsing. See the
Python configparser interpolation documentation below for more
information.-s,--serializeOutput the parsed, interpolated and serialized configuration toSTDOUT. Use this together with the--basic,--mergeand--rawoptions to inspect the interpolation of "variables" within you
INI-files.-v,--verbosePrint verbose messages.Exit statusThis is the list of exit status codes and their meanings returned to
the shell bypyinilint.Exit StatusNameMeaning0EXIT_OKEverything went well, all files linted successfully.1EXIT_NON_EXISTANT_FILEAt least one of the specified files does not exist.2EXIT_SYNTAX_ERRORThere was an error in the command line syntax.3EXIT_UNREADABLE_FILEAt least one of the specified files existed but was not readable.4EXIT_DUPLICATE_SECTIONThere is a duplicate section in the INI file.5EXIT_DUPLICATE_OPTIONThere is a duplicate option in the INI file.6EXIT_INTERPOLATION_MISSING_OPTIONThere is no corresponding option to a given interpolation key in the configuration.7EXIT_INTERPOLATION_DEPTHMaximum recursion depth has been exceeded in interpolation.8EXIT_MISSING_SECTION_HEADERThere is a missing section header.9EXIT_PARSING_ERRORUsually some kind of syntax error within an INI file.10EXIT_UNKNOWN_ERRORA catch-all for some other kind of error, inspect the error message for more details.ExamplesCheck a single filepyinilint myfile.iniA silent response (with exit status of 0) means thatmyfile.inihas
passed the lint check.Check multiple individual filespyinilint -v myfile1.ini myfile2.iniCheck multiple files treating each one individually and output verbose
messages.Check multiple files in a collection, and output the serialized resultspyinilint -m -s myfile1.ini myfile2.iniCheck multiple files as part of a singleConfigParserobject,
and output the parsed and interpolated values.Check a file with a custom encodingpyinilint -e iso8859_15 myfile.iniCheckmyfile.iniusing  iso8859_15 encoding.CautionIf your INI-files are ultimatly going to be parsed by an INI-parser
different fromConfigParserthen you should be aware that there can
be subtle differences in INI-file format between parsers. However, it
should still spot most howling errors!ContactPlease get in contact via thepyinilintproject’s GitLab
websiteto:Report issuesor
make feature requests.Clone or fork the Git source code tree.Say “hello!” 😉ReferencesPythonconfigparser interpolation documentationThepyinilint project website