Antoine Chalons Posted March 15, 2021 Report Share Posted March 15, 2021 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? Quote Link to comment
bjustice Posted March 15, 2021 Report Share Posted March 15, 2021 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. Quote Link to comment
Antoine Chalons Posted March 15, 2021 Author Report Share Posted March 15, 2021 Intersting, have you considered submitting your bug-fixes on the github repo? Also, have you implemented support for path? or do you just use strings? Quote Link to comment
Popular Post drjdpowell Posted March 15, 2021 Popular Post Report Share Posted March 15, 2021 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. 4 Quote Link to comment
Antoine Chalons Posted March 15, 2021 Author Report Share Posted March 15, 2021 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. Quote Link to comment
joerghampel Posted March 15, 2021 Report Share Posted March 15, 2021 I've only seen/used TOML for GitLab CI's gitlab-runner configuration (i.e. not in LabVIEW)... Quote Link to comment
DTaylor Posted March 15, 2021 Report Share Posted March 15, 2021 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) 1 Quote Link to comment
Antoine Chalons Posted March 15, 2021 Author Report Share Posted March 15, 2021 I see. Well it's great that you created it and shared it on GitHub. The tree display is also a nice feature. Now.. If jsontext gets support for comments and LabVIEW objects, it will be a no brainner. Quote Link to comment
Popular Post Porter Posted March 16, 2021 Popular Post Report Share Posted March 16, 2021 I've been toying with the idea of implementing a new TOML library for LabVIEW. I've been using OpenG variant config for years, but I would prefer to use a more standardized format for my ini config files. TOML is the best candidate for this. Erdosmiller's library is pretty good, but as the author points out, it is no longer maintained, and it didn't gracefully handle all of the datatypes that I wanted to use. It would be great to have the flexibility of jsontext but for TOML format. I'll post back here if I manage to get the project off the ground. 3 Quote Link to comment
bjustice Posted March 16, 2021 Report Share Posted March 16, 2021 Now is the time to do it, TOML just released a v1.0 spec. I, for one, would buy you a beer at NI week Quote Link to comment
Popular Post drjdpowell Posted March 16, 2021 Popular Post Report Share Posted March 16, 2021 On 3/15/2021 at 2:39 PM, 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. I've just implemented this and posted a beta: https://forums.ni.com/t5/JDP-Science-Tools/BETA-version-of-JSONtext-1-5-0/m-p/4136116 Handles comments like this: // Supports Comments { "a":1 // like this "b":2 /*or this style of multiline comment*/ "c": 3 /*oh, and notice I'm forgetting some commas A new line will serve as a comma, similar to HJSON*/ "d":4, // except I've foolishly left a trailing one at the end } 5 Quote Link to comment
Antoine Chalons Posted March 17, 2021 Author Report Share Posted March 17, 2021 This is great! Just in case we are thousands of LV users silently wishing for native TOML support : https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Add-native-support-for-TOML-file-format/idi-p/4136157 Quote Link to comment
Antoine Chalons Posted April 6, 2021 Author Report Share Posted April 6, 2021 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 Quote Link to comment
Antoine Chalons Posted April 6, 2021 Author Report Share Posted April 6, 2021 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? Quote Link to comment
bjustice Posted April 6, 2021 Report Share Posted April 6, 2021 in "TOML to LabVIEW.vi" Here are the mods that I made. Those cyan VIs are from the JDP utility VIPM package that ships with JSONtext 1 Quote Link to comment
Antoine Chalons Posted April 6, 2021 Author Report Share Posted April 6, 2021 Thanks a lot for the clarification. I'll fix this in my fork. Quote Link to comment
drjdpowell Posted April 6, 2021 Report Share Posted April 6, 2021 23 minutes ago, bjustice said: Those cyan VIs are from the JDP utility VIPM package Note: that package also has RFC3339-compliant Datetime format VIs, if you haven't already done Timestamps. Quote Link to comment
Antoine Chalons Posted April 6, 2021 Author Report Share Posted April 6, 2021 Timestamp support is not on my roadmap (yet) but I'll keep that in mind, thanks! Quote Link to comment
Porter Posted April 6, 2021 Report Share Posted April 6, 2021 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. Quote Link to comment
Porter Posted April 6, 2021 Report Share Posted April 6, 2021 (edited) 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 April 7, 2021 by Porter Quote Link to comment
Antoine Chalons Posted April 7, 2021 Author Report Share Posted April 7, 2021 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. Quote Link to comment
Antoine Chalons Posted April 7, 2021 Author Report Share Posted April 7, 2021 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 Quote Link to comment
Antoine Chalons Posted April 7, 2021 Author Report Share Posted April 7, 2021 Just released v2.0.0 There's not a lot in it really, I'm hopping that the effort in improving the error reporting will help future developments like adding support for new data types and comments. Quote Link to comment
bjustice Posted April 7, 2021 Report Share Posted April 7, 2021 I've found that comments in the original LV-TOML library seem to work pretty well. That issue ticket that you linked has been the only bug related to comments that I've found Quote Link to comment
Antoine Chalons Posted April 8, 2021 Author Report Share Posted April 8, 2021 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? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.