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

RFE: HCL Support #6

Open
langdon opened this issue Oct 15, 2015 · 7 comments
Open

RFE: HCL Support #6

langdon opened this issue Oct 15, 2015 · 7 comments

Comments

@langdon
Copy link

langdon commented Oct 15, 2015

Hashicorp developed HCL as an alternative to JSON and YAML and allows its use with some of their tools. As some of our tools use anymarkup and interact with some Hashicorp tools, I would like anymarkup to support HCL.

@bkabrda
Copy link
Owner

bkabrda commented Oct 16, 2015

You know, I started thinking about this just 2 days ago :)

There are two key points here:

  • https://github.com/virtuald/pyhcl package is the only Python HCL manipulation library I could find and it only supports parsing, but not dumping HCL. I'll first need to work with pyhcl upstream to implement dumping.
  • I'm a bit worried that not everyone using anymarkup wants HCL. In fact, I think most people only use 2-3 backends, but have to install all dependencies. I'm starting to think that I should introduce package anymarkup-core, that would have all the current code, but would import the individual parsers dynamically. This would allow people to install and use just anymarkup-core with a limited set of parsers of their choice. anymarkup would be just a metapackage, that would install anymarkup-core and all parsers, so people could still just install that and get going. Does that sound ok?

@bkabrda
Copy link
Owner

bkabrda commented Oct 19, 2015

Note that implementing the HCL support may get a bit tricky, as HCL seems to be ambiguous and that needs to be sorted out in the first place [1]. The pyhcl implementation of dumping pretty much depends on that, so I'll wait until [1] is resolved and then go on with implementing this.

(I sorted out the second point by creating https://github.com/bkabrda/anymarkup-core and making anymarkup be pretty much only "meta-package" to install all the dependencies + anymarkup-core itself. I released that work in 0.5.0 and would welcome testing/comments.)

[1] hashicorp/hcl#24

@langdon
Copy link
Author

langdon commented Oct 20, 2015

Probably need a new issue for this, but TBH, I think you should include all the markups by default to make for a better first time user experience. I can't imagine it is all that much disk or time to install them all. However, once someone wants to move to production (or whatever) or becomes a "power user" the ability to remove markups they don't use would be nice. However, as I re-read your remark, maybe that is what you said? :)

@bkabrda
Copy link
Owner

bkabrda commented Oct 20, 2015

So here's what I did:

  • created anymarkup-core, that has all the code, but try/except imports, doesn't explicitly depend on any of the parsers
  • made anymarkup a "meta-package", which basically only installs all the parsers + anymarkup-core; and it also imports all the toplevel functions + exceptions from anymarkup-core

Effectively, there is no visible change for people who just install "anymarkup" - and that is still the preferred way. The only change is that you can choose to install anymarkup-core with only a limited set of parsers, if you really need to do that for a reason.

@langdon
Copy link
Author

langdon commented Oct 22, 2015

Github needs a "like" button. +1

@bkabrda
Copy link
Owner

bkabrda commented Oct 23, 2015

You can always tweet about how awesome I am (and I have twitter account now - https://twitter.com/slavek_k - , so that makes as cool as anyone else!)

@langdon
Copy link
Author

langdon commented Oct 23, 2015

I may have to wait for the HCL support ;)

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