UConf
UConf is a small tool aiming to provide simple handling of configuration files for an heterogeneous computer set.
Its key concepts are:
Abstract host-specific config to common features (server, relay, …)
Host-specific configuration may range from a single-line change to a whole file rewrite
Configuration files are modified in place, not in the source - versionned - repository.
In other words, it provides the following features:
Map each host to a set of categories (e.g laptop, server, dev, remote, …)
For each category (or combination thereof), list the files to install and their destinations
For each file, conditionnally include some parts depending on the active categories
Usage
Configuration
First, create the folder structure:
$ cd ~/conf
$ mkdir .uconf
$ touch .uconf/config
Then, set a few settings:
# .uconf/config
[core]
# Install files to my home folder
target = ~/
[categories]
# The host names "myhostname" belongs to the 'shell' and 'x11' categories
myhostname: shell x11
[files]
# Hosts in the 'shell' category should install
# the 'shell/gitconfig' and 'ssh/config' files
shell: shell/gitconfig ssh/config
# Hosts in the 'shell' but not the 'work' category should install
# our authorized_keys
shell && !work: ssh/authorized_keys
[actions]
# Files located in ~/conf/ssh are parsed and written to ~/.ssh/
ssh/* = parse destdir=".ssh/"
# shell/gitconfig goes to ~/.gitconfig
shell/gitconfig = parse destdir="~/.gitconfig"
Files
The heart of uconf is its file processing engine.
On the surface, it is a simple preprocessor that will parse files based on the categories defined in the .uconf/config file.
In other words, if the file shell/gitconfig contains:
[user]
#@if work
name = Raphaël Barrois
email = raphael.barrois@example.org
#@else
name = Xelnor
email = raphael.barrois@polytechnique.org
#@endif
And is build on the myhostname from the above example, the output will be:
# ~/.gitconfig
[user]
name = Xelnor
email = raphael.barrois@polytechnique.org
Commands
Once your configuration folder is set up, basic commands will be:
$ cd ~/conf
$ uconf make
Building file shell/gitconfig (FileProcessingAction)
Building file ssh/config (FileProcessingAction)
Building file ssh/authorized_keys (FileProcessingAction)
If you have modified a file, just backport its changes:
$ cd ~/conf
$ uconf back shell/gitconfig
Backporting file shell/gitconfig (FileProcessingAction)
This will update the source file (~/conf/shell/gitconfig in this example) to incorporate the changes from the destination file (here, ~/.gitconfig).
This works even if the file contained branches, i.e if the source file was:
[user]
#@if work
name = Raphaël Barrois
email = raphael.barrois@example.org
#@else
name = Xelnor
email = raphael.barrois@polytechnique.org
#@endif
And the destination (on a non-work machine) was modified to read:
[user]
name = Raphaël "Xelnor" Barrois
email = raphael.barrois@polytechnique.org
Then the result of running uconf back shell/gitconfig will be:
[user]
#@if work
name = Raphaël Barrois
email = raphael.barrois@example.org
#@else
name = Raphaël "Xelnor" Barrois
email = raphael.barrois@polytechnique.org
#@endif
Metadata
Release files for uconf 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| uconf-0.4.1.tar.gz | 23.7 kB | Without provenance | Details for uconf-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uconf-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for uconf-0.4.1-py3-none-any.whl |
Total release size: 48.5 kB
Release files / uconf-0.4.1.tar.gz
| Download URL | uconf-0.4.1.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4d7da64932e4c19e4e935f2f3ec66860971dae71e0deb47959b3c1206825fc4
|
|
BLAKE2b-256 checksum How to use checksums |
27ad211e3cca1c439376e4f3bc7bf7e3d90f477980b81962f55c90927de414fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7
|
Release files / uconf-0.4.1-py3-none-any.whl
| Download URL | uconf-0.4.1-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45fd6d8df1dcb80e296e3d7782514332e5d45008331eb1f3c48dee6a8c4eab28
|
|
BLAKE2b-256 checksum How to use checksums |
b755bc48eecdd13262a4af56414ed048333c84f605644e6814e63d7d4267a64b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7
|
Security for uconf 0.4.1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.