Jump to content

anyone using TOML files ?


Recommended Posts

Hi all,

A customer is pushing us towards using TOML file for app configuration.

So far we're using json - thanks to jsontext from JDP Science - and we're happy with it.

I've been testing the MIT-Licensed TOML library available here, but in term of features it's far behind jsontext.

The cool thing with TOML - really cool - is the support for comments.

 

So just out of curiosity, has anyone ever tried to use TOML?

Link to comment

Yep!  TOML is like INI file syntax learning how to do everything that JSON can do... with comments.  I'm a fan.

I've also been using the Erdosmiller library.  I've found a few bugs, it's not full-feature, and it's not TOML 1.0 compliant. (TOML just 1.0'd recently).  It's the best I've found thus far though, and it's been working well enough for me.

Link to comment
2 hours ago, drjdpowell said:

I have been coming round to supporting comments in JSONtext, at least for ignoring comments on reading (which is quite simple to implement, I think).  And possibly features to be more forgiving of common User error, such as missing commas.

Sounds great.

 

I've seen you're also working issue 56, which would be another big advantage of jsontext over the TOML library.

Link to comment
3 hours ago, Antoine Chalons said:

So just out of curiosity, has anyone ever tried to use TOML?

It is a really nice format, but I'd recommend using something else in LabVIEW because of lack of support, unless the EM library covers everything you need.

3 hours ago, Antoine Chalons said:

Intersting, have you considered submitting your bug-fixes on the github repo?

The repo is unmaintained. (source: I'm the author)

  • Thanks 1
Link to comment
  • 3 weeks later...

I'm going to fork the repo on GitHub and work on it for my needs, What I'm planning to do is :

short term :

- move to LV2017 (just because it's the oldest I have already available on a VM)

- add support for path

- improve error reporting

 

hopefully one day :

- add support for comments

 

At this point, I'm not planning to do any major refactoring.

If anyone wants to participate... feel free : https://github.com/AntoineChalons/lv-toml

Link to comment
On 3/15/2021 at 2:41 PM, bjustice said:

Yep!  TOML is like INI file syntax learning how to do everything that JSON can do... with comments.  I'm a fan.

I've also been using the Erdosmiller library.  I've found a few bugs, it's not full-feature, and it's not TOML 1.0 compliant. (TOML just 1.0'd recently).  It's the best I've found thus far though, and it's been working well enough for me.

@bjusticeI've seen issue #2 that you created on the original repo, I have to say I don't understand the problem nor the suggested solution.

Could you post more info about this please?

Link to comment

Thanks Antoine for taking on this project. Looks like you are making some good progress already.

Just a little detail, you might want to add some text at the top of the license file along the lines of:

Contributions up to v1.2.1 Copyright (c) 2017, Erdos Miller

Unless you received written permission to from the original owner to change the copyright.

Link to comment

A nice feature would be to optionally preserve top-level comments (lines that start with #). I don't think that this is a trivial to implement, but it could be useful.

And it might even be simple to preserve inline comments while we're at it (keep the comment with the key-value pair).

Edited by Porter
Link to comment
9 hours ago, Porter said:

Just a little detail, you might want to add some text at the top of the license file along the lines of:

Contributions up to v1.2.1 Copyright (c) 2017, Erdos Miller

Ah.. I knew I'd screw-up the license handling... I have to say I didn't even look up how to handle open source license when forking.

My bad, will fix that soon.

Link to comment
9 hours ago, Porter said:

A nice feature would be to optionally preserve top-level comments (lines that start with #). I don't think that this is a trivial to implement, but it could be useful.

And it might even be simple to preserve inline comments while we're at it (keep the comment with the key-value pair).

I've been thinking about this but as I said above, this a not a short term need for me.

I do hope I'll find some me-time to play with comments during the summer.

 

Interestingly, there is a reported issue on the original repo that is linked to comments : https://github.com/erdosmiller/lv-toml/issues/1

Link to comment

Let me make sure I understand what you mean by this :

11 hours ago, bjustice said:

I've found that comments in the original LV-TOML library seem to work pretty well.

You mean, they are ignored and don't mess up with extracting the data, right? (appart from the case in issue #1)

 

Because for me one thing that is a bit annoying is if you load data from a TOML file that has some comments, as soon as you write using this lib, you lose all the comments, or am I missing something?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.