ZConfig Tooling

ZConfig ships with some tools that can be helpful to anyone either writing configurations or writing programs that read configurations.

Schema and Configuration Validation

When ZConfig is installed, it installs a program called zconfig that can validate both schemas and configurations written against those schemas:

usage: zconfig [-h] -s FILE [file [file ...]]

Script to check validity of a configuration file

positional arguments:
  file                  Optional configuration file to check

optional arguments:
  -h, --help            show this help message and exit
  -s FILE, --schema FILE
                        use the schema in FILE (can be a URL)

Each file named on the command line is checked for syntactical errors and
schema conformance. The schema must be specified. If no files are specified
and standard input is not a TTY, standard in is treated as a configuration
file. Specifying a schema and no configuration files causes the schema to be
checked.

Documenting Schemas

ZConfig also installs a tool called zconfig_schema2html that can print schemas in a simple HTML format.

Hint

To document components in reStructuredText, e.g., with Sphinx, see Documenting Components.

usage: zconfig_schema2html [-h] [--out OUT] [--package]
                           [--package-file PACKAGE_FILE]
                           [--members [MEMBERS [MEMBERS ...]]]
                           [--format {html,xml}]
                           [SCHEMA-OR-PACKAGE]

Print an HTML version of a schema

positional arguments:
  [SCHEMA-OR-PACKAGE]   The schema to print. By default, a file. Optionally, a
                        Python package. If not given, defaults to reading a
                        schema file from stdin

optional arguments:
  -h, --help            show this help message and exit
  --out OUT, -o OUT     Write the schema to this file; if not given, write to
                        stdout
  --package             The SCHEMA-OR-PACKAGE argument indicates a Python
                        package instead of a file. The component.xml (by
                        default) from the package will be read.
  --package-file PACKAGE_FILE
                        When PACKAGE is given, this can specify the file
                        inside it to load.
  --members [MEMBERS [MEMBERS ...]]
                        Only output sections and types in this list (and
                        reachable from it)
  --format {html,xml}   What output format to produce