-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Move to yaml1.2 #4415
Merged
Merged
Move to yaml1.2 #4415
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit: * gets rid of pyyaml * uses ruamel everywhere * tries to unite toml and yaml However, this will require a few more changes that will come soonish. Eg: Current `parse_yaml` and `parse_toml` behavior could be error-prone, so, it's better to introduce `tree` inside these serialization methods (which I will try to tackle next). Another is, yaml load can be slow for json. We could speed it up just by using `json.load(s)` here (also in upcoming patch).
skshetry
commented
Aug 18, 2020
skshetry
commented
Aug 18, 2020
skshetry
commented
Aug 18, 2020
skshetry
commented
Aug 18, 2020
This comment has been minimized.
This comment has been minimized.
skshetry
commented
Aug 18, 2020
@@ -2,12 +2,11 @@ | |||
from collections import defaultdict | |||
|
|||
import dpath.util | |||
import toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skshetry
commented
Aug 18, 2020
pmrowla
approved these changes
Aug 19, 2020
pared
approved these changes
Aug 19, 2020
skshetry
commented
Aug 19, 2020
from ._toml import * # noqa, pylint: disable=wildcard-import | ||
from ._yaml import * # noqa, pylint: disable=wildcard-import | ||
|
||
PARSERS = defaultdict(lambda: parse_yaml) # noqa: F405 | ||
PARSERS.update({".toml": parse_toml}) # noqa: F405 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it'd be good to have JSON utils after the upcoming PR with trees are done. Maybe even move to ujson
as it has now wheels on all platforms.
In [1]: %timeit json.loads('{"ja": "son"}')
2.32 Β΅s Β± 35 ns per loop (mean Β± std. dev. of 7 runs, 100000 loops each)
In [2]: %timeit YAML(typ='safe').load('{"ja": "son"}')
180 Β΅s Β± 1.28 Β΅s per loop (mean Β± std. dev. of 7 runs, 10000 loops each)
In [3]: %timeit ujson.loads('{"ja": "son"}')
372 ns Β± 13.4 ns per loop (mean Β± std. dev. of 7 runs, 1000000 loops each)
This was referenced Aug 19, 2020
skshetry
added a commit
to iterative/dvc.org
that referenced
this pull request
Sep 8, 2020
20 tasks
shcheklein
pushed a commit
to iterative/dvc.org
that referenced
this pull request
Oct 19, 2020
* Document that YAML files are expected to be in YAML1.2 Refer iterative/dvc#4415 * remove note, embed the note in the paragraph * Apply suggestions from code review Co-authored-by: Jorge Orpinel <[email protected]> * Restyled by prettier Co-authored-by: Jorge Orpinel <[email protected]> Co-authored-by: Restyled.io <[email protected]>
12 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR:
gets rid of pyyaml
uses ruamel everywhere
tries to unite toml and yaml
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Document that yaml files are expected to be in YAML v1.2Β dvc.org#1704
Thank you for the contribution - we'll try to review it as soon as possible. π
Closes #4281