Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration data structure transforms #24

Open
jayvdb opened this issue May 29, 2018 · 4 comments
Open

Configuration data structure transforms #24

jayvdb opened this issue May 29, 2018 · 4 comments
Milestone

Comments

@jayvdb
Copy link
Member

jayvdb commented May 29, 2018

jinja is a horrible language to transform data structures before they are used by a block in another template.

I tried to fill extra_dependencies using jinja set. {% set extra_dependencies = ... %} does work, but it requires the exact same structure.

I couldnt transform existing data from a different structure.

Anyway, there could be a better way..

https://github.com/coala/coala-bears/blob/master/.moban.yaml overrides
https://github.com/coala/coala-bears/blob/master/bear-requirements.yaml
which has

pip_requirements:
  HTTPolice:
    version: ~=0.5.2
  aenum:
    version: ~=2.0.8

I want it to look like

extra_dependencies:
  - all:
    - HTTPolice~=0.5.2
    - aenum~=2.0.8

One way to do this is to incorporate a transform system like https://github.com/dreftymac/dynamic.yaml

Another is #23

I assume the same problem occurs in reverse. e.g. If I have configuration data in format

a:
  - b: z
    c: y
    d: x

But a template supports multiple values, and thus wants it in a structure like

a:
  b:
    - z
  c:
    - y
  d:
    - x
@chfw
Copy link
Member

chfw commented Jul 15, 2018

I suppose two filters are needed.

For now, I have not thought about moban file import. Configuration file override and template override are in place.

@jayvdb
Copy link
Member Author

jayvdb commented Jan 24, 2019

one feasible and very generic approach is to have a yaml -> yaml target which uses jinja to do the transform, and load the generated yaml. I.e. #127

@jayvdb jayvdb added this to the 0.6.0 milestone Jan 24, 2019
@chfw
Copy link
Member

chfw commented Oct 12, 2019

this topic has a lot of tangible values and with this issue resolved, moban will have an edge over other cli commands.

@chfw
Copy link
Member

chfw commented Dec 28, 2019

a further thought on this: a specific data transformer is required per use case, because input data structure and output data structure varies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants