Comments (1)
Yeah, it's a feature in this module, and not in YAML format itself.
See https://github.com/mk-fg/pretty-yaml/#warning - which is the first section of the README that says:
Warning
Prime goal of this module is to produce human-readable output that can be easily
manipulated and re-used, but maybe with some occasional caveats.
One good example of such "caveat" is that e.g. {'foo': '123'} will serialize to
foo: 123, which for PyYAML would be a bug, as 123 will then be read back as an
integer from that, but here it's a feature.
So please do not rely on the thing to produce output that can always be
deserialized exactly to what was exported, at least - use PyYAML (e.g. with
options from the next section) for that.
There a plenty of such cases here, which I occasionally fix, but it'll never be safe to use this output for serialization purposes.
You can use regular pyyaml module for that though, as far as I know that module is designed to produce correct output, regardless of how it looks.
Iirc there should be some option suggestions for making its output nicer in the README too.
from pretty-yaml.
Related Issues (20)
- pyaml converts integer-like strings to integers HOT 7
- Default to safe=True? HOT 10
- pyaml output stringified inexplicably in places HOT 1
- dump fails on numpy arrays HOT 3
- Cannot install with Python 3.6 on Windows 10 HOT 2
- Multiline String as block and quoted Strings HOT 3
- Since dict is ordered by default since 3.6, the order is lost now HOT 1
- yaml.composer.ComposerError: expected a single document in the stream HOT 1
- Deprecation warning HOT 1
- Format and write into file HOT 2
- RepresenterError: 'cannot represent an object' for custom object HOT 5
- pyaml not compatible with ruamel.yaml HOT 8
- openapi.yaml is invalid after re-formatting HOT 2
- Why does it sort my keys in alphabet order? HOT 2
- Although I'm using string_val_style='plain', a string value is still quoted HOT 2
- pretty-yaml creates output not readable by itself for escaped strings HOT 2
- Test regression with Python 3.11: DumpTests.test_enum HOT 2
- To ensure Python compatibility, it is recommended to avoid using the := operator in your code. HOT 1
- 23.5.9 from pypi installs empty directory HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pretty-yaml.