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

sort_keys=True/False is ignored #179

Open
theodore86 opened this issue Oct 20, 2024 · 0 comments
Open

sort_keys=True/False is ignored #179

theodore86 opened this issue Oct 20, 2024 · 0 comments
Assignees
Labels

Comments

@theodore86
Copy link

theodore86 commented Oct 20, 2024

Describe the bug
It seems that the keyword argument sort_keys=True/False in PYYaml parser is ignored and the order is not preserved:

To Reproduce

[31]: d = load("/tmp/test.yaml")

In [32]: d
Out[32]: {'x': 2, 'y': ['1'], 'a': 'test'}
In [35]: dump(d, "/tmp/test2.yaml", sort_keys=False)

In [36]: !cat /tmp/test2.yaml
a: test
x: 2
y:
- '1'

Expected behavior

sort_keys=False should not sort alphanumeric

Additional context
python-anyconfig==0.14.0

Most probably you need to add the "sort_keys" : https://github.com/ssato/python-anyconfig/blob/next/src/anyconfig/backend/yaml/pyyaml.py#L230

Could you please add this yaml option and release a new version?

Thank you for this great library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants