pyyaml
concise-encoding
Our great sponsors
pyyaml | concise-encoding | |
---|---|---|
16 | 22 | |
2,406 | 255 | |
1.5% | - | |
3.9 | 7.2 | |
9 days ago | 6 months ago | |
Python | ANTLR | |
MIT License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pyyaml
-
Cython 3.0 Released
Mostly because of PyYAML: https://github.com/yaml/pyyaml/issues/724
PyYAML knew about the breakage since january 2022[0], and nothing really happened. After a year and a half with lots of alphas and betas, I don't think there is much cython could do, short of fixing PyYAML themselves.
- I'm needing a hand, I do not understand some (seemingly) simple Python stuff.
-
Using Rust to not have to touch Yaml in k8s land
Note some parsers, most notably pyyaml are still at yaml 1.1, because 13 years is just not enough time to update it.
-
I accidentally used YAML.parse instead of JSON.parse, and it worked?
Many parsers either default to YAML pre-1.2 or do not even expose a YAML 1.2 option. PyYAML has no 1.2 option, for example. So unless Ansible is using something other than PyYAML...
Relevant (open) PR: https://github.com/yaml/pyyaml/pull/555
- The Norway Problem
-
Strict YAML deserialization in Python with marshmallow
So I imported PyYaml and call load method:
concise-encoding
- Ask HN: What Underrated Open Source Project Deserves More Recognition?
-
It's Time for a Change: Datetime.utcnow() Is Now Deprecated
"Local time" is time zone metadata. I've written a fair bit about timekeeping, because the context of what you're capturing becomes very important: https://github.com/kstenerud/concise-encoding/blob/master/ce...
-
RFC 3339 vs. ISO 8601
This is basically why I ended up rolling my own text date format for Concise Encoding: https://github.com/kstenerud/concise-encoding/blob/master/ct...
ISO 8601 and RFC 3339 are fine for dates in the past, but they're not great as a general time format.
-
Ask HN: Please critique my metalanguage: “Dogma”
It's to scratch a personal itch of mine: formal descriptions of binary data formats. I couldn't find anything suitable for describing the binary format for Concise Encoding (https://concise-encoding.org/), so I did the crazy thing, thinking "how hard could it be?" But it worked out and I have a formal description for it now:
* https://github.com/kstenerud/concise-encoding/blob/master/cb...
* https://github.com/kstenerud/concise-encoding/blob/master/ct...
So it's primarily geared towards documentation. That being said, there's no reason why tools couldn't use it as well (I'm trying to keep it consistent enough that tools could be built).
Error handling would be an implementation detail. The spec only describes what counts as a malformed grammar, and what counts as an ambiguous grammar (and a small bit about undefined behaviour, which counts as ambiguous).
This looks similar to https://concise-encoding.org/
Dogma was developed as a consequence of trying to describe Concise Binary Encoding. The CBE spec used to look like the preserves binary spec, full of hex values, tables and various ad-hoc illustrations: https://preserves.dev/preserves-binary.html
Now the CBE formal description looks like this: https://github.com/kstenerud/concise-encoding/blob/master/cb...
And the regular documentation looks like this: https://github.com/kstenerud/concise-encoding/blob/master/cb...
Dogma also does text formats (Concise Encoding has a text and binary format, so I needed a metalanguage that could do both in order to make it less jarring for a reader):
https://github.com/kstenerud/concise-encoding/blob/master/ct...
https://github.com/kstenerud/concise-encoding/blob/master/ct...
-
Keep ’Em Coming: Why Your First Ideas Aren’t Always the Best
Hey thanks for taking the time to critique!
I actually do have an ANTLR file that is about 90% of the way there ( https://github.com/kstenerud/concise-encoding/tree/master/an... ), so I could use those as a basis...
One thing I'm not sure about is how to define a BNF rule that says for example: "An identifier is a series of characters from unicode categories Cf, L, M, N, and these specific symbol characters". BNF feels very ASCII-centric...
-
Working in the software industry, circa 1989 – Jim Grey
It's still in the prerelease stage, but v1 will be released later this year. I'm mostly getting hits from China since they tend to be a lot more worried about security. I expect the rest of the world to catch on to the gaping security holes of JSON and friends in the next few years as the more sophisticated actors start taking advantage of them. For example https://github.com/kstenerud/concise-encoding/blob/master/ce...
There are still a few things to do:
- Update enctool (https://github.com/kstenerud/enctool) to integrate https://cuelang.org so that there's at least a command line schema validator for CE.
- Update the grammar file (https://github.com/kstenerud/concise-encoding/tree/master/an...) because it's a bit out of date.
- Revamp the compliance tests to be themselves written in Concise Encoding (for example https://github.com/kstenerud/go-concise-encoding/blob/master... but I'll be simplifying the format some more). That way, we can run the same tests on all CE implementations instead of everyone coming up with their own. I'll move the test definitions to their own repo when they're done and then you can just submodule it.
I'm thinking that they should look more like:
c1
It's weird... I was never big on writing, but when I finally tried my hand at a data format specification (https://github.com/kstenerud/concise-encoding), I found that I really enjoyed the experience.
It's 3000 lines and took me four years and countless revisions, but I feel it was worth it. I actually enjoyed writing the spec even more than writing the reference implementation :)
-
Breaking our Latin-1 assumptions
Ugh Unicode has been the bane of my existence trying to write a text format spec. I started by trying to forbid certain characters to keep files editable and avoid Unicode rendering exploits (like hiding text, or making structured text behave differently than it looks), but in the end it became so much like herding cats that I had to just settle on https://github.com/kstenerud/concise-encoding/blob/master/ct...
Basically allow everything except some separators, most control chars, and some lookalike characters (which have to be updated as more characters are added to Unicode). It's not as clean as I'd like, but it's at least manageable this way.
-
I accidentally used YAML.parse instead of JSON.parse, and it worked?
You might get a kick out of Concise Encoding then (shameless plug). It focuses on security and consistency of behavior.
In particular:
* How to deal with unrepresentable values: https://github.com/kstenerud/concise-encoding/blob/master/ce...
* Mandatory limits and security considerations: https://github.com/kstenerud/concise-encoding/blob/master/ce...
* Consistent error classification and processing: https://github.com/kstenerud/concise-encoding/blob/master/ce...
What are some alternatives?
confuse - painless YAML config files for Python
strictyaml - Type-safe YAML parser and validator.
yamllint - A linter for YAML files.
cue - The home of the CUE language! Validate and define text-based and dynamic configuration
joystick - A full-stack JavaScript framework for building stable, easy-to-maintain apps and websites.
jsonnet - Jsonnet - The data templating language
marshmallow - A lightweight library for converting complex objects to and from simple Python datatypes.
FrameworkBenchmarks - Source for the TechEmpower Framework Benchmarks project
python-strict-yaml-parsing - Examples of strict yaml parsing in python
postal-codes-json-xml-csv - Collection of postal codes in different formats, ready for importing.
futurecoder - 100% free and interactive Python course for beginners
cue - CUE has moved to https://github.com/cue-lang/cue