I've been a long-time fan of KDL format, so I liked Confetti even more.
I spent a couple hours writing a fully complaint parser in pure Python. It passes all tests, and among other things has a separate "mapper" mode for more pythonic usage.
Python is able to load Python code at runtime, so one can use Python for configuration. A solution doesn’t need to go looking for problems that are already solved.
People interested in configuring Python software in Python
should look into Starlark.
There are Python bindings for two versions of Starlark:
Go (https://github.com/caketop/python-starlark-go)
and Rust (https://github.com/inducer/starlark-pyo3).
I used python-starlark-go for a time
in a project that ran on x86-64 Linux
and had no problems with it.
(I stopped because my project's configuration turned out simpler than expected,
so I switched to TOML.)
Worth noting that it is specifically CPython that has been called impossible to sandbox.
(2014 discussion: https://news.ycombinator.com/item?id=8280053.)
It may be possible to sandbox PyPy.
PyPy has a sandboxing feature its website calls a "working prototype"
(https://www.pypy.org/features.html#sandboxing).
If someone invested in it—potentially a huge effort—it could plausibly become good enough for configuration.
But, IMO, Starlark is a better choice here
because it was designed for isolation from the start.
If you wanted to invest in Python-as-config-for-Python,
a good use of your time might be improving Starlark for Python.
So true. One of the major config mgt utilities which shall remain nameless, (cough, Ansible, cough), is written in python but created an excrable POS config language build on YAML. At least Ant had the excuse that Java was not suitable for a config language. Will people never learn that building scripting languages on markup languages will inevitably end in tears?
I'm a big fan but be careful, Ruff doesn't support current versions of python >=3.11 yet.
Instead of direct python parsing ruff uses RustPython, that is still lack of match operator support and other modern 3.10+ stuff. If you're ok with that - go ahead and switch to ruff, you will never get back.
That's right -- we don't support match statements, and we don't support except* (which is part of 3.11 IIRC), but I _think_ we support everything else. And of course, I intend to support all of those language features.
If interested: CPython moved to a new parser, a PEG parser, in Python 3.9, and part of the motivation was to support language features like pattern matching, which introduced ambiguities in the grammar that the existing parser couldn't handle. For the same reason, they've been non-trivial to implement in the RustPython parser -- they either require clever techniques, or the parser needs to be written as a PEG parser. I am hoping to do the former, but I need to find time to prioritize it.
Oh that explains why it is hung up on "match item['blah']:" then. I was scratching my head trying to work out what i had done wrong since the code worked fine.
On their page, they claim "Python 3.11 compatibility" – perhaps they've added it since you formed your impression, or is this "compatibility" word misleading?
I don't know. But that's not unique to ruff. Plenty of Python linting tools had issues with new Python syntax in the past. Rust's rustfmt can still not format some of the most recent syntax additions and rust-analyzer has some limitations with new stuff as well.
CoWasm supports WASI right now via this library https://www.npmjs.com/package/wasi-js, which I actually develop as part of CoWasm . One unusually thing I did, which goes beyond what emscripten does, is I implemented a quite a bit of posix functionality, often by writing extension code to nodejs and calling it from Javascript, because there's a lot of POSIX that Node.js doesn't expose. This only works on Mac and Linux and is also available standalone in this library https://www.npmjs.com/package/posix-node, which is implemented in Zig. You can get a sense of the scope of POSIX functionality that goes beyond what WASI defines here: https://github.com/sagemathinc/cowasm/tree/main/packages/ker...
One motivation for doing this is to try to get the full Python test suite to pass, including all the functionality that involves subprocesses, posix calls, etc. I've only got to about 85% at this point. It can be a ton of tedious work, but at least Zig helps impose some discipline (e.g, it doesn't let you ignore handling errors until later), and makes it easy to test compilation for all supported targets on every change (due to excellent cross compilation support).
Internet (as ARPANET) has started at 1969. And before 1982 it wasn’t widely adopted. It’s pretty normal to be biased but fact checking is a must for this type of conversation.
Internet “invented” а 1969 and never was used widely till 1982.
Neural networks was developed at 1980 but real applications started at 2011.
Speech recognition showed at 1962 and still looks like “pretty new piece of tech” for humanity.
We have to admit, we are really slow in adopting tech.
Just for clarification: it's illegal to build news aggregator in Russia if you use any sources that is not certified by Russian government. So technically you're right, "source is state_approved_media", and pretty the same for all Russian news aggregation services.
Disclosure: I've worked for Yandex as deputy CTO till 2015, and one of the reasons i've left the company was increased pressure from Russian government. Since then I have lived in Ukraine, now in Kyiv.
We're nervously joking about "ID of Good Russian" inside the Russian community. It's like "somebody from Russia who proves he/she is against Putin's regime." At least a third of them are now in Israel, trying to do something to stop this war. Arkady, who was the founder and CEO of Yandex since the beginning for me, is one of these "good Russians." He's helping to run from Russia for many people who's against the war now, trying to build a startup-asylium for russians with jewish roots in Tel-Aviv. I do not believe that Russia as a country will change soon, so one of the best ways to accelerate the process is to help intelligent people to leave the country, as Arkady does.
Honestly, I think everybody at Yandex, including me is guilty because, indirectly, we helped to build this regime. It is not fair to penalty for Volozh this hard. We all have to be penalized somehow, but give us a chance to fix at least something.
> We all have to be penalized somehow, but give us a chance to fix at least something.
I concur with the rest of your argument, but I think excessive penalization should be upheld as long as Russian forces are in Ukraine. The more penalization, the faster that war will end. After war - yeah, some sanctions should be lifted.
It looks like similar problem as with Germany after WW I. They got held down too much "so that they pose threat no more" and it backfired. Western world tried to appease Russia with economic integration and flow of capital, but it still didn't work. Germany somehow departed from their war-oriented path, how would you do that with Russia?
I understand the idea of sanctions but didn't get how it works in this case. He is not in Russia. He lived and pay taxes in Israel for last 3 years. He is even not a Russian citizen (changed his passport to Malta and Israel 4 years ago).
I have nothing to say about sanctions against Tigran Khudaverdyan (who is COO and really in charge of Yandex actually), it's pretty logical.
I always assumed that WWII was facilitated by heavy sanctions imposed on Germany. See [1] for a romanticized description of economic disarray that thrusted Hitler into power.
I wouldn’t feel too guilty. It’s hard to leave friends and family and culture and work and stability behind. I’ve kept my head down and continued to work in the US despite some terrible presidents and plenty of wars and other governmental actions that I completely disagreed with. Do I feel guilty for that? No. I didn’t support it. I didn’t start it. I couldn’t stop it. Leaving would have only destabilized my family and robbed my children of knowing their grandparents.
This isn’t whataboutism. I’m not trying to say Russia is equivalent to the US, etc, etc.
But I think it’s unjust how much guilt and responsibility we put on the shoulders of the average citizen who is just trying to live.
I think the point was exactly that the author of the parent comment is not just an average citizen. As you grow, you tend to (IMHO, rightly) feel more and more responsibility for people around you.
> I do not believe that Russia as a country will change soon, so one of the best ways to accelerate the process is to help intelligent people to leave the country, as Arkady does.
At a personal lever, I feel it's very good and I wish these Russian all the best trying to do something meaningful in exile. On a more global level, though, it's clear that if all anti-war folks leave, the country becomes even more pro-war, and there is nobody left to save it.
That's the difference between us: you're believe in possibility to save the country, I believe that "Carthage must be destroyed" before people can build the new country on top of that. 20 years of dictatorship for Russia, even more for Belarus - it's not something that can be easily fixed.
The big question is what happens next. Call me biased, but after seeing how my fellow Russian colleagues are transpiring the official propaganda, I think it may end up just like when they kill a dictator in the Middle East (i.e. suffering for everybody), not like in, say, Romania where basically the whole country was against Ceaușescu.
I spent a couple hours writing a fully complaint parser in pure Python. It passes all tests, and among other things has a separate "mapper" mode for more pythonic usage.
https://github.com/bobuk/pyconfetti