to_yaml() does not honor ordered_box
Open
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 135
- PR merge metrics
- No merged PRs in 30d
Description
```python
In [1]: from box import Box
In [2]: ordered_box = Box(ordered_box=True)
In [3]: ordered_box.zlast = 'first'
In [4]: ordered_box.afirst = 'last'
In [5]: ordered_box.keys()
Out[5]: ['zlast', 'afirst'] # correct, as expected
In [6]: ordered_box.to_yaml()
Out[6]: 'afirst: last\nzlast: first\n' # not ordered as expected!
```
YAML really looks better when ordered logically, not arbitrarily!
Contributor guide
Research direction
Start at the Box.to_yaml() entry point and reproduce the ordered_box example from the issue. Check how the mapping is passed to YAML serialization, then verify that the generated YAML preserves insertion order, including the zlast and afirst example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100