Import a json file as a fully functional module with classes, inheritance, attributes, properties and constraints
Project description
importjson : Import json data into a python application
It is sometimes useful to be able to use json data to initialise classes and other data structures, giving your application a portable and human readable configuration capability. To do this you will probably write some level of functionality around the json standard library, and use the resulting data loaded from the json file, to populate classes and instances implemented in your application. This separates your data and functionality, which can often present challenges later down the line as you need to keep the data and functionality in step. It would be better in many cases to be able to combine the data and functionality in a single place, and with the importjson library you can do that.
The library allows you to import a json file direct into your python application, and automatically build a real python module, complete with classes, class attributes, and instance data attributes (implemented with set and get descriptors).
Your code can use these classes, attributes and methods just as if you have written the code yourself.
The importjson library also allows you to set constraints on your instance attributes, checking for the data type and simple range checks on the values your attempt to set when you create instances of the classes. You can also determine whether attributes are read only, or whether they will be allowed to be set to None (or not).
See the full documentation for examples of how to use the library and how to format the json file.
Bugs |
---|
Every care is taken to try to ensure that this code comes to you bug free. If you do find an error - please report the problem on : GitHub or by email to : Tony Flury |
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 Distributions
Built Distributions
File details
Details for the file importjson-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: importjson-0.2.3-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8c7cfb54278fe9cd6842fe92b07c4de2efec2910bc5ce75c16cd9a9454e28cc |
|
MD5 | d3fdd664bb80a80b4cbdfaf6519c543d |
|
BLAKE2b-256 | 3c2d17b7fddf7b40193cc4b38789f24f0f8e62cafd9bb87352e4c1420af9b843 |
File details
Details for the file importjson-0.2.3-py2-none-any.whl
.
File metadata
- Download URL: importjson-0.2.3-py2-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d080e8ba48e64454d493bd1ba20d944b703550625d1dd350976f76de92343a55 |
|
MD5 | 7dd02bb2b54d1ece33ba0b02f043f559 |
|
BLAKE2b-256 | eb55e6cb8f8c764a4c84bbff20098fafd1750965fad33e1f744a240ed4c4e4c4 |