lwjs
Light Weight JSON Shell is a package to allow simple inline "like-in-bash-shell" expressions in JSON documents. Technically, no limits exist to apply on Python objects as well. It recursively scans any given object and performs evaluation of fun and ref and sub and esc expressions.
Consider the example:
import lwjs
data = "$(calc 5 + 5)"
data = lwjs.cook(data)
print(data)
data = { "tasks": [ "1+1", "2+2" ], "solve": "$(map $(@calc) ${tasks})" }
data = lwjs.cook(data)
print(data)
data = { "in": { "v1": 2, "v2": 5 }, "r": "$(calc ${in.v1} + ${in.v2})" }
data = lwjs.cook(data)
print(data)
data = "Must escape '$$' character"
data = lwjs.cook(data)
print(data)
Legend:
funexpression example is"$(calc)"or"$(map)"refexpression example is"$(@calc)"subexpression example is"${tasks}"or"${in.v1}"or"${in.v2}"escexpression example is$$: whenever you need a$you have to pay$$
Output:
10
{'tasks': ['1+1', '2+2'], 'solve': [2, 4]}
{'in': {'v1': 2, 'v2': 5}, 'r': 7}
Must escape '$' character
NB: calc and map are lwjs-shipped funs: calc.py, map.py
installation
pip install lwjs
moar
Visit project homepage for more documentation and examples
Metadata
Release files for lwjs 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lwjs-1.0.0.tar.gz | 11.8 kB | Without provenance | Details for lwjs-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lwjs-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for lwjs-1.0.0-py3-none-any.whl |
Total release size: 22.6 kB
Release files / lwjs-1.0.0.tar.gz
| Download URL | lwjs-1.0.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15d5a1fa499113d6764751b43c599dd3d105c136f164ccbc23335e885f536adf
|
|
BLAKE2b-256 checksum How to use checksums |
3bd7ecdc433ea3781e966c36a06323ecaa960c63721a47c2f263b731a2c39af5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Release files / lwjs-1.0.0-py3-none-any.whl
| Download URL | lwjs-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
142707bb2eea04488eb6d413db00b88e250c0ec316a211a6cf2bcc8ed0fbf982
|
|
BLAKE2b-256 checksum How to use checksums |
7a93cfc6ea2bc69d8666f5096deb7599d4370fe4eaf82a811e9157115d8c73eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Security for lwjs 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.