Skip to main content

write config files

This tool allows you to render templated config files and write them out.

This can be used to manage personal config files with different settings in different places (e.g. work/personal) or without committing secrets to a git repo.

getting started

You will need a file to configure the templates and a file to provide context variables. By default these are names templates.yaml and context.yaml, respectively. e.g:

templates

The root template directory is relative to the templates file. Each entry in the template_groups must be a group of templates that will be written to the output directory. All template files must be listed explicitly.

Templates may be written to a different name than the name of the template file by setting the destination attribute. The written files may be made executable by making is_executable true.

e.g:

root_template_dir: ./templates
template_groups:
-   output_dir: '~'
    templates:
    -   template: .editorconfig
    -   template: .zshrc
-   output_dir: ~/.config/
    templates:
    -   template: git/config
    -   template: git/ignore
-   output_dir: ~/.local/bin
    templates:
    -   template: my_script.py
        destination: my-script
        is_executable: true

context

This will be parsed from YAML into a plain dictionary and used as the template context. A context file be provided. If no context is needed, make it an empty dict:

{}

usage

write

Render the templates and write the output files.

usage: write-config-files write [-h] [-t TEMPLATES] [-c CONTEXT] [-f] [-d]

options:
  -h, --help            show this help message and exit
  -t TEMPLATES, --templates TEMPLATES
                        path to config file (default: templates.yaml)
  -c CONTEXT, --context CONTEXT
                        path to context file (default: context.yaml)
  -f, --force           overwrite existing files
  -d, --dry-run         render templates but do not write files

diff

Show the diff between the current files and what would be written with write.

usage: write-config-files diff [-h] [-t TEMPLATES] [-c CONTEXT] [-p PAGER]

options:
  -h, --help            show this help message and exit
  -t TEMPLATES, --templates TEMPLATES
                        path to config file (default: templates.yaml)
  -c CONTEXT, --context CONTEXT
                        path to context file (default: context.yaml)
  -p PAGER, --pager PAGER
                        the pager to use to display each diff (default: no pager)

Metadata

Release files for write-config-files 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for write-config-files 0.4.0
File Size Uploaded Provenance
write_config_files-0.4.0.tar.gz 7.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for write-config-files 0.4.0
File Interpreter ABI Platform
write_config_files-0.4.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.9 kB

Release files / write_config_files-0.4.0.tar.gz

Download URL write_config_files-0.4.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
55bfb235a474c83dd17d18485bd9fcb5d5cb5bf82a011f36eb48af722e539452
BLAKE2b-256 checksum
How to use checksums
dfc9274524c5923335d2ce54bae42f9c30904a9e23f29eff829e7fd37a51ad86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / write_config_files-0.4.0-py2.py3-none-any.whl

Download URL write_config_files-0.4.0-py2.py3-none-any.whl
Size 9.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8cb3f850aa4eafc834f84e3a7b2209ab5008b8b38c5379cac6af68850577d3a8
BLAKE2b-256 checksum
How to use checksums
3754a0d78d727450f26461264592704664f443130e8f89db170a94ee470d3c29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Security for write-config-files 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page