Skip to main content

Elastic dictionaries.

Project description

PyPI status PyPI version Pipeline status Code style

frkl

elastic dictionaries (and configuration)

Description

frkl is basically a string/object transformation library, with the main goal being enabling as minimal as possible initial state. I rather suspect that this here is one of those things whose value won't be immediately obvious (if there is one at all -- still not sure about that myself), and examples might be a better way of explaining what its use is.

frkl is most useful for cases where you have a list of similar configuration items, which might or might not inherit from each other. In those cases, you don't want to duplicate information that is needed for each of the items. To illustrate, here's some yaml:

vars:
  location: at_home
  task_type: cleaning
tasks:
  - clean_bathroom
  - clean_living_room
  - clean_desk:
      location: at_work

This task list describes how we want to clean three things, two of which are at home, and one is at work. Our robot would not like this way of describing it though, since it is much harder to parse. For example, there is no 'proper' schema, the list for example has mixed types, strings and a dictionary with one key/value pair. What our robot would want is:

- task:
    name: clean_bathroom
  vars:
    location: at_home
    task_type: cleaning
- task:
    name: clean_living_room
  vars:
    location: at_home
    task_type: cleaning
- task:
    name: clean_desk
  vars:
    location: at_work
    task_type: cleaning

Basically, this is what frkl does: expanding (and also modifying if wanted) configuration from as minimal as possible to as comprehensive as necessary.

Now, of course, in this example the reduction in size is not that big. And, one might argue, not having a fixed schema might not be a good idea in the first place. I can even see the point, but I do like being able to express myself as simple and minimal as possible. Obviously we are introducing more fragility by loosening up our schema. But we gain clarity, and ease of use. Whether this trade-off is justifiable or not depends on the situation I think. This library is for the situations where it is :-)

frkl is written in Python.

Features

  • transform configurations, focusing on clarity and the removal of redundancy
  • plug-able architecture
  • pre-made string/object processors/filters (regex, url abbreviation, jinja templates, etc.)
  • auto-downloading, merging of configuration items
  • mix and match of local and remote configuration items

Development

Assuming you use pyenv and pyenv-virtualenv for development, here's how to setup a 'frkl' development environment manually:

pyenv install 3.7.3
pyenv virtualenv 3.7.3 frkl
git clone https://gitlab.com/frkl/frkl
cd <frkl_dir>
pyenv local frkl
pip install -e .[develop,testing,docs]
pre-commit install

Copyright & license

Please check the LICENSE file in this repository (it's a short license!), also check out the freckles license page for more details.

Parity Public License 6.0.0

Copyright (c) 2019 frkl OÜ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frkl-0.9.0.tar.gz (44.3 kB view details)

Uploaded Source

Built Distribution

frkl-0.9.0-py2.py3-none-any.whl (29.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file frkl-0.9.0.tar.gz.

File metadata

  • Download URL: frkl-0.9.0.tar.gz
  • Upload date:
  • Size: 44.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: devpi-server/4.9.0 (py2.7.13; linux2)

File hashes

Hashes for frkl-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2b5c828094242d69c224d6a409c0be83530937f3805b9a45e854553bbac082c6
MD5 904b232d2b9cfc81529f239e76224fbd
BLAKE2b-256 6a94f70b7b5af2c4be05583c24cc78a8da87831e64526b9f1ea4022f4871e6ff

See more details on using hashes here.

File details

Details for the file frkl-0.9.0-py2.py3-none-any.whl.

File metadata

  • Download URL: frkl-0.9.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: devpi-server/4.9.0 (py2.7.13; linux2)

File hashes

Hashes for frkl-0.9.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d27062096d64c0d550f14ea13a45e3f8448125290bd347ca7daf63876f30a1d9
MD5 c24d02adaba310e444cdf51f58172ccc
BLAKE2b-256 cfccbf878bf0a4b650c674fc13dffd04308ca9ec5408a32c2def23ff2ffcf001

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page