Creates metaclasses for parameter definition and checking with taking respect to the jsonschema defined by https://json-schema.org/
Project description
jsonmetamodel
jsonmetamodel is used to provide a definition of struct like classes with direct type conversion, which are returning a Mapping type like dict.
Installing
Installing the latest release using pip is recommended.
$ pip install jsonmetamodel
Basic Usage
>>> from jsonmetamodel import JsonModel, JsonInteger, JsonString
>>> class Person(JsonModel):
... name = JsonString()
... age = JsonInteger()
...
>>> person = Person({"age": "65", "name": "Max Power"})
>>> person
MappingTreeItem({"age": 65, "name": "Max Power"})
>>> person["age"]
65
>>> person.age
65
>>> person.age = 66
>>> person.age
66
>>> dict(person)
{"age": 65, "name": "Max Power"}
Contribution
Any contribution by reporting a bug or desired changes are welcomed. The preferred way is to create an issue on the gitlab's project page, to keep track of everything regarding this project.
Contribution of Source Code
Code style
This project follows the recommendations of PEP8. The project is using black as the code formatter.
Workflow
- Fork the project on Gitlab.
- Commit changes to your own branch.
- Submit a pull request from your fork's branch to our branch 'dev'.
Authors
License
This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE file for details
Acknowledge
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jsonmetamodel-0.1a0.tar.gz
.
File metadata
- Download URL: jsonmetamodel-0.1a0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c75759d7db553d3f3bc9dfa3164d66dd34548c7c848ea2d3e47bf53ce7dfc3 |
|
MD5 | 2cced28ba009c9701e4ddd2e2f82626c |
|
BLAKE2b-256 | 3e2e2dc8d8de65b210c2c2199d5ca2e3b5a8b25afba9b2e0ecc38fc318461f67 |
File details
Details for the file jsonmetamodel-0.1a0-py3-none-any.whl
.
File metadata
- Download URL: jsonmetamodel-0.1a0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c10447f23236638b4a0ae9009870429a15fc89960fb3a0b267bbba0e82c62b88 |
|
MD5 | 65c99c3f4854ba8e78a84e0c9b72ccfc |
|
BLAKE2b-256 | b6d539f8a9fcbe70b62b4aa614884a1e0d64cb715b813c1165dda586b523c902 |