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

Feature request: support !!omap in YAML configs #166

Closed
jkeroes opened this issue Jul 3, 2018 · 2 comments
Closed

Feature request: support !!omap in YAML configs #166

jkeroes opened this issue Jul 3, 2018 · 2 comments

Comments

@jkeroes
Copy link

jkeroes commented Jul 3, 2018

An ordered map would make, for example, the relink hash tables execute in order, which would present clearer output. It would also help when reviewing the output log to see what was was, when, and what may have been missed.

The YAML syntax looks basically like this:

- relink !!omap
    - ~/.foo: "foorc"
    - ~/.bar: "bar_file"
    - ~/.baz:

I believe support would need to be added in config.py.

As an aside, this would likely be a YAML-only feature. There doesn't appear to be support provided by the default JSON parsers.

@anishathalye
Copy link
Owner

anishathalye commented Jul 3, 2018

Good idea!

It would be nice to support this for both JSON and YAML, do it by default, and not have any syntactic overhead in the configuration files.

It looks like this is possible [1, 2]. And it looks like with Python 3.7+ and PyYAML, order is preserved by default [3, 4]. We should be able to find some clean solution that works across the Python versions supported by Dotbot.

If anyone wants to work on this, I'm happy to review a PR, otherwise I'll get around to implementing this sometime soon.

@anishathalye
Copy link
Owner

On second thought: I don't think it's worth the additional complexity involved in implementing this functionality in a backward-compatible way. Especially since I think people shouldn't rely on this behavior for correctness, only for readability of the output, so it's not critical if it doesn't work on some platforms.

Even though Dotbot will continue to support Python 2.7 and Python 3.4+ for the foreseeable future, Python 2 has been sunset, and PyYAML on Python 3.7+ already has this behavior of preserving order.

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

No branches or pull requests

2 participants