Dot Configs¶

Import and handle project configurations as dot-separated configs object
Full documentation can be found here: https://dot-configs.readthedocs.io/en/latest/
Features¶
- Easy parsing and handling of project options by using a modifiable configuration object
- Simple setup
- Splittable configs
- Backlinks: Every end-node can trace back its connection to the root node
- Dot-seperated object chain, convenient for addressing nodes and properties
- Configurations can quickly be inspected inside a command line interpreter, like Jupyter/iPython
Contents:¶
Installation¶
It is recommended to use a virtual environment to install dot-configs. Once your virtual environment is activated, install via pip:
$ pip install dot-configs
Usage¶
An example of a JSON configuration file could look like this [1] :
{
"architecture": {
"convNet": {
"spectrograms": {
"frame_sizes": [
1024,
2048,
4096
],
"hop_size": 441,
"num_bands": 40
},
"training_data": {
"test_size": 0.1,
"val_size": 0.2,
"random_state": 42
},
"paths": {
"files": {
"train_logs": "train_logs.csv",
"state": "state.json",
"model": "model.hdf5"
},
"dirs": {
"store": "/path/to/data_store",
"sandbox": "/path/to/sandbox",
"tests": "/path/to/test_dir"
}
},
"overwrite": false,
"default_params": null
}
}
}
Note that these configurations can be nested. You can use strings, floats, integers, lists, booleans and null values. The JSON format does not support None directly but, once imported, null will be converted to None. The same goes for false/true which will be converted to their upper case equivalents False and True.
To use dot-configs in your project:
import dot_configs as dc
config_filepath = '/path/to/json_configuration_file'
cfg = dc.Configurations(config_filepath).get_configurations()
Now you can address any of the values in the following way:
cfg.architecture.convNet.paths.files.train_logs # "train_logs.csv"
Footnotes
[1] | You can find this example JSON under examples in the repository. |
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://gitlab.com/loxosceles/dot_configs/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitLab issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitLab issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
Dot Configs could always use more documentation, whether as part of the official Dot Configs docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://gitlab.com/loxosceles/dot_configs/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up dot_configs for local development.
Fork the dot_configs repo on GitLab.
Clone your fork locally:
$ git clone git@gitlab.com:your_name_here/dot_configs.git
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass style and unit tests, including testing other Python versions with tox:
$ tox
To get tox, just pip install it.
Commit your changes and push your branch to GitLab:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitLab website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- Run the
tox
command and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Magnus “Loxosceles” Henkel <loxosceles@gmx.de>
Contributors¶
None yet. Why not be the first?
Feedback¶
If you have any suggestions or questions about Dot Configs feel free to email me at loxosceles@gmx.de.
If you encounter any errors or problems with Dot Configs, please let me know! Open an Issue at the GitLab http://gitlab.com/loxosceles/dot_configs main repository.