Replies: 5 comments 4 replies
-
|
Adding the implementation here. A good bit of this is vibe-coded so I'd very much want to clean this up and also build test infrastructure to be confident that it handles all the options correctly. So far I've done nothing more than run code like the example above. |
Beta Was this translation helpful? Give feedback.
-
|
I like this idea a lot. They Python ecosystem is hot these days, and I'd love for FJ to be available there. But I'm a noob there, so I'm glad you know your way around, @masaccio. I'd absolutely love it if you would maintain the Python side. I'm currently getting ready to release version 5. All the code and tests are done and checked into the main branches for .NET and TypeScript. The change logs are updated. But I still need to update a bunch of documentation. So version 5 would be a good place to start, I expect. A few things we probably should consider:
Let me know what you think, @masaccio and anyone else who wants to pitch ideas. |
Beta Was this translation helpful? Give feedback.
-
|
The python interface for .NET seems to be really very good so I expect that callbacks will work for wide character support. I have that in For version 5, are any API changes already in as I can test against your dev branch. What I was thinking for the python package was to version it and build it using triggers off your releases so as long as tests keep passing it will always be-up-to date. I can easily convert enums to command line options and the only manual thing I’ve spotted is free-text descriptions of options. I will take a look at the config file too for the CLI as not everyone wants a big long list of verbose command line options. Let me build something and see what gotchas I find. Testing might be the significant work unless I come up with a way to with reflection to run the .NET tests on the python library. I already use the reflection APIs and they too seem remarkably complete. |
Beta Was this translation helpful? Give feedback.
-
|
The python wrapper will live here: https://github.com/masaccio/fractured-json-python The CLI seems to work but there's a lot of testing and automation to do get before I publish on PyPI. |
Beta Was this translation helpful? Give feedback.
-
|
For anyone tracking, the package has now been published on PyPI (https://pypi.org/project/fractured-json/). I consider the options management feature complete though the Enums could do with some refactoring to be more Pythonic. Serialisation is not currently supported, but that's pretty much all that is missing. Project-wise it needs work for coverage, especially around exceptions, and I've not done any GitHub workflow hooks to have it build off changes to the upstream FracturedJson. I've also marked compact-json as archived so it should be clear it gets no new development. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
compact-json is falling further and further behind the latest version of this project and also suffers from performance problems given it's pure python (see my issue #35).
Given that Python.NET (
pythonnet) is well advanced, I think the right solution is to offer a Python package that wraps the .NET classes and exposes a pythonic interface.I've proven this out with a prototype and reasonably straightforwardly you can achieve an interface like this:
The code behind this dynamically looks up enum values and the public interface of
FracturedJsonOptionsso any new options will automatically be picked up. In my original port, I changedmax_compact_array_complexitytomax_compact_list_complexitybut that's arguably too far and the new implementation will completely break the API for the original anyway.In principle I could just create a PyPI package called
fractured_jsonand the appropriate build infrastructure in GitHub to create updates whenever a new release happens here. More logically though, the builds here should create a Python package and publish it to PyPI.The runtime requirements for .NET in Python are not super simple so I can see that python purists might stumble over things like environment variables and keeping the .NET runtime up-to-date so there may be support involved in this.
So this is an open question to how @j-brooke you'd like to handle this. I am perfectly OK with handling the Python packaging and that's likely easiest for you, especially if you'd rather not learn yet another environment. I don't have access to any Windows hosts other than the GitHub runners so I might have to lean on you occasionally if that goes wrong.
Beta Was this translation helpful? Give feedback.
All reactions