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

[WIP][RFC] Add TOML #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Code0x58
Copy link

@Code0x58 Code0x58 commented Dec 11, 2018

I thought I'd quickly add TOML as an optional dependency to see how it fits in, as the interface is like the usual JSON+YAML load(s)/dump(s). It was easy to drop in TOML as a store for objects, but that's without any mapping to additional types in TOML.

Mapping to TOML types would be nice, as it could allow more generally craftable/ingestable toml files.

I'm thinking there are some options (in order of personal preference):

  • do something like update the to_dict(…) single dispatch methods to take something like a for_toml=True kwarg which branches the handling. I'm not sure how this would tie in with to_model other than making the relevant fields fields also handle
  • consider it out of scope for related at the moment
  • just go with strings as is
    • stay that way and generally lose advantages of TOML
    • change it in a major release (I dislike this a lot because of having to migrate data)

Are there any maintainer/community thoughts on this?

@Code0x58 Code0x58 changed the title [WI{[RFC] Add TOML [WIP][RFC] Add TOML Dec 11, 2018
@codecov-io
Copy link

Codecov Report

Merging #32 into master will decrease coverage by 0.53%.
The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #32      +/-   ##
==========================================
- Coverage   99.81%   99.27%   -0.54%     
==========================================
  Files           9        9              
  Lines         536      553      +17     
==========================================
+ Hits          535      549      +14     
- Misses          1        4       +3
Impacted Files Coverage Δ
src/related/__init__.py 100% <ø> (ø) ⬆️
src/related/functions.py 97.02% <82.35%> (-2.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7577a69...fb59c99. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Dec 11, 2018

Codecov Report

Merging #32 into master will decrease coverage by 0.53%.
The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #32      +/-   ##
==========================================
- Coverage   99.81%   99.27%   -0.54%     
==========================================
  Files           9        9              
  Lines         536      553      +17     
==========================================
+ Hits          535      549      +14     
- Misses          1        4       +3
Impacted Files Coverage Δ
src/related/__init__.py 100% <ø> (ø) ⬆️
src/related/functions.py 97.02% <82.35%> (-2.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7577a69...15825ac. Read the comment docs.

This does not handle mapping to the types TOML has over JSON
closed_on = "17:30:00"
customers = 192
day_type = "Holiday"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the best of my knowledge, TOML also supports the following data types that are from missing from this test.
Boolean
Inline Table
Vanilla Arrays
Nested Arrays of tables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reviewed your PR as a training exercise. We recognize this was meant to be a minimal TOML add on and to that end it looks awesome! Congrats!

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

Successfully merging this pull request may close these issues.

3 participants