Merge key with multiple levels, invalid merge-expand output
To remove unnecessary noise, here is a bit different example that can be compared same way:
import yaml with open("1.yaml") as f: y = yaml.safe_load(f) # print(y) with open(r'merged.yaml', 'w') as file: yaml.dump(y, file) python yaml have different opinion: you can just run that and view merged result, which does replace values such as "cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook" to "cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook+CONFIG_MODULE_COMPRESS=n" and compare it with result your tool is generating on yaml...
Merge key with multiple levels, invalid merge-expand output
It generate wrong data, here is example what is in output: chromeos_nocompress_variants: <skipped some lines> x86_64: base_defconfig: cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config fragments: [x86-chromebook] extra_configs: - cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook - cros://chromeos-5.10/x86_64/chromeos-intel-denverton.flavour.config+x86-chromebook - cros://chromeos-5.10/x86_64/chromeos-intel-pineview.flavour.config+x86-chromebook - cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config+x86-chromebook...
It gets wrong data, here is example what is in output: chromeos_nocompress_variants: <skipped some lines> x86_64: base_defconfig: cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config fragments: [x86-chromebook] extra_configs: - cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook - cros://chromeos-5.10/x86_64/chromeos-intel-denverton.flavour.config+x86-chromebook - cros://chromeos-5.10/x86_64/chromeos-intel-pineview.flavour.config+x86-chromebook - cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config+x86-chromebook...
Merge key with multiple levels, invalid merge-expand output
Any indication of what is incorrect and/or a program to reproduce that? Doesn't it load, do you get wrong data, do you get wrong output when dumped?
Merge key with multiple levels, invalid merge-expand output
roundtrip does not preserve escape newlines in double-quoted flow scalars
This is unlikely going to be added. You should look into using folded scalars if you want newlines in your documents that are preserved on roundtrip but not in the loaded data: foo: >- bar, baz, qux The - after > is necessary to strip the trailing newline, as that is not in your double-quoted flow scalar.
Ticket moved from /p/ruamel-yaml/tickets/401/
Thank you! I confirm that the latest ruamel.yaml.cmd-0.5.7 version works fine for me
ImportError: cannot import name 'text_type' from 'ruamel.yaml.compat'
This was a result of ruamel.yaml no longer supporting py27 and ruamel.yaml.cmd relying on some compatibility code in the former. I had already made all the necessary changes in ruamel.yaml.cmd (so it worked for me localy) but forgot to push a new version to pypi. There is 0.5.7 now on pypi which should have this fixed. Thanks for reporting
Added tag 0.5.7 for changeset 26d64a3b38da
removed support for 2.7 as per ruamel.yaml
ImportError: cannot import name 'text_type' from 'ruamel.yaml.compat'
added --width option to rt subcommand
Added tag 0.5.6 for changeset dc9773c7de1c
You might be right. But if you would present it as a YAML transformation, showing what you wanted to do it should be right. Have you tried yaml rt --help resp. yaml rt --save <filename>?
Are you sure question regarding CLI tool won't get down? Stackoverflow is primarily for code questions. but I am not writing a code here hence can not provide code snippet. I'm afraid such question might be just taken down and I would be redirected to e.g. superuser forum.
Essentially a round trip is where you get back to where you were: you have YAML document in a file; load the document into data; make some changes; dump the data back into a file as YAML document. At the end you are back where you started. Using its round-trip mode ruamel.yaml tries to preserve comments, tags and other things during such a round-trip. (A bit of googling would show you that the documentation for the ruamel.yaml package underlying this commandline utility uses that term repeatedly)....
Please improve documentation. How do I use this thing?
Added tag 0.4.0 for changeset 253f0dd25950
new version
new setup
- _package_data converted from JSON to PON
update on metadata and wheel
adapt to changes in pip/setuptools that prevented correct install
Added tag 0.2.3 for changeset 5d2d21f7a2a1
updated setup.py dependency on new ruamel.yaml.convert
update wheel
old version number
version number
tox update for nested packages
added mapping command
Added tag 0.4.2 for changeset 0a92dfc02312
first release
by default suppress "normal" anchors/aliases in merge_expand
Added tag 0.2.4 for changeset c7ca643f6bb7
Added tag 0.3.1 for changeset e88578022a24
added merge_expand option
new version
Added tag 0.4.1 for changeset 5428cffcd523
add option to smarten multiline strings and quotes
Added tag 0.2.0 for changeset a8839b09c406
Added tag 0.2.2 for changeset 11551932b389
new setup.py, suppressing -nspkg.pth
Added tag 0.5.5 for changeset f9422e267082
using YAML class, fixes issue #4
Added tag 0.5.4 for changeset 67684f236e78
status set to resolved (originally posted on 2018-10-15 at 06:34:31)
Sorry for that, I had only tested with yaml -h. 0.5.3 should now have that fixed (and tox based testing works as well again) (originally posted on 2018-10-15 at 05:31:02)
After upgrading to 0.5.1: Traceback (most recent call last): File "f:\portableapps\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\portableapps\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\PortableApps\Python\Scripts\yaml.exe\__main__.py", line 9, in <module> File "f:\portableapps\python\lib\site-packages\ruamel\yaml\cmd\__main__.py", line 212, in main sys.exit(n.run()) File "f:\portableapps\python\lib\site-packages\ruamel\yaml\cmd\__main__.py",...
I uploaded a new version of ruamel.yaml.cmd (0.5.1), can you try that one, and if that works close this issue? (originally posted on 2018-10-14 at 12:38:36)
Those .pth files extend the paths from which python imports, which is only important if you install next to each other. (originally posted on 2018-10-14 at 11:45:35)
It looks like pip/distutils/setuptools once more screw up installing and handling namespace packages properly. If you install ruamel.yaml separately things work fine. If you remove the ruamel.yaml.cmd-0.5.0* info from site-packages things work so that metadata interferes in some way. (originally posted on 2018-10-14 at 11:42:25)
.Confirmed on Windows: after removing the pth file for yaml.cmd, I can run "from ruamel.yaml import YAML" again. But yaml(.exe) still doesn't work because of the missing pth file. Why are those even needed?! The only other package on my machine that uses a pth file is pywin32. (originally posted on 2018-10-14 at 11:41:39 by Thorsten Kampe <thorstenkampe@bitbucket>)
The issue is the .pth file for yaml.cmd: sudo rm /usr/local/lib/python3.6/dist-packages/ruamel.yaml.cmd-0.5.0-py3.6-nspkg.pth python3 -c 'from ruamel.yaml import YAML' [no error] (originally posted on 2018-10-14 at 11:34:27 by Thorsten Kampe <thorstenkampe@bitbucket>)
it actually is a problem with yaml.cmd. Uninstalling yaml.cmd removes the yaml error: sudo --set-home pip3 uninstall ruamel.yaml.cmd Uninstalling ruamel.yaml.cmd-0.5.0: Would remove: /usr/local/bin/yaml /usr/local/lib/python3.6/dist-packages/ruamel.yaml.cmd-0.5.0-py3.6-nspkg.pth /usr/local/lib/python3.6/dist-packages/ruamel.yaml.cmd-0.5.0.dist-info/* /usr/local/lib/python3.6/dist-packages/ruamel/yaml/cmd/* Proceed (y/n)? y Successfully uninstalled ruamel.yaml.cmd-0.5.0 python3 -c 'from ruamel.yaml...
it looks like yaml.cmd pulls in the wrong(?) dependencies: Installing ruamel.yaml directly: sudo --set-home pip3 install ruamel.yaml Collecting ruamel.yaml Downloading https://files.pythonhosted.org/packages/e0/5b/1e2fe3c00e0ecf37bebeb0a7c7eab24bbcc0cb0d7fab8e7ab3e41eaf788c/ruamel.yaml-0.15.72-cp36-cp36m-manylinux1_x86_64.whl (659kB) 100% |████████████████████████████████| 665kB 122kB/s Installing collected packages: ruamel.yaml Successfully installed ruamel.yaml-0.15.72 python3 -c 'from ruamel.yaml...
Older versions of ruamel.yaml ( < 0.15 ) don't have YAML imported into ruamel.yaml.__init__.py, so ruamel.yaml.cmd cannot find that. That is why I asked for the version, but I realise it was not clear that I needed the ruamel.yaml version number on your windows installation, not the ruamel.yaml.cmd version. You are not using anaconda do you (their stuff is broken). (originally posted on 2018-10-14 at 11:04:12)
The Ubuntu package (python3-ruamel.yaml) works. I'm trying to figure out the difference between the pip version and the apt-get package. (originally posted on 2018-10-14 at 10:57:32 by Thorsten Kampe <thorstenkampe@bitbucket>)
This is not a yaml.cmd issue but a yaml issue. I tested it on Linux going back to 1.4.12 and Python 2.7: all show the same error. (originally posted on 2018-10-14 at 10:54:25 by Thorsten Kampe <thorstenkampe@bitbucket>)
status set to on hold How did you install ruamel.yaml.cmd? Which version is this? If you install using pip it will install/upgrade ruamel.yaml to version 0.15.72 (https://bitbucket.org/ruamel/yaml.cmd/src/6750e051d2f24dffc97e1e9192928268b536d79a/init.py#lines-19) (originally posted on 2018-10-14 at 10:36:58)
status set to resolved using YAML class, fixes issue #4 When this change indeed resolves your problem, please Close this issue. (You can do so using the WorkFlow pull-down (close to the top right of this page)) → <<cset 67684f236e78="">></cset> (originally posted on 2019-07-14 at 07:38:30)
I also get this, with and without the --indent arg (originally posted on 2019-07-12 at 08:56:47 by John Vandenberg <John Vandenberg@bitbucket>)
status set to closed (originally posted on 2017-01-13 at 19:07:56)