mkstd


Namemkstd JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
SummaryMake standards compatible with HDF5/JSON/XML/YAML.
upload_time2024-10-31 15:33:48
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseBSD 3-Clause License Copyright (c) 2024, Dilan Pathirana Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords standard hdf5 json xml yaml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mkstd
Make standards that can be exported/imported/validated via HDF5/JSON/XML/YAML.

`mkstd` uses pre-existing standards for validation and schema specification, such that files produced using `mkstd` can be used independently of `mkstd`. For example, a tool developer can use `mkstd` to create a standard for their tool's data, but users do not necessarily need `mkstd` installed to use the data. However, `mkstd` also provides importers and exporters, so intended use also involves an `mkstd` installation for convenience.

# Installation
```bash
pip install mkstd

# For HDF5 support
pip install hdfdict@git+https://github.com/SiggiGue/hdfdict
```
For environments requiring `numpy<2`, replace `mkstd` with `mkstd[numpyv1]` above.

# Intended use
`mkstd` is intended to be used at two stages of data management. An example of these stages is provided in [](https://github/dilpath/mkstd/examples/libssr/ssr_data.py).
## Generating a standard
At this stage, the "user" is the person designing the data type and corresponding standard. For example, a tool developer who wants to standardize the data produced by their tool. The steps could look like:
1. (with `mkstd`) Design the data type as a Pydantic data model. Thanks to Pydantic, it behaves like a standard for your data, as a Python object.
2. (with `mkstd`) Export the standard as e.g. XML and JSON schemas.
3. (TODO, with `mkstd`) Generate documentation for the standard, based on the Pydantic data model docstrings.
## Using a standard
At this stage, the "user" is someone who wants to use data generated by the tool, or import their own data into the tool.
1. (with or without `mkstd`) Reformat data to match the standard specified by the e.g. `mkstd`-generated XML or JSON schema.
2. (with or without `mkstd`) Validate the data against the schema.
3. (with or without `mkstd`) Import/export the reformatted data with the tool.

# External validation
As written above, many uses of the standard produced by `mkstd` are intended to be possible without an `mkstd` installation. This is because the generated standards are in standardized schema formats. Below are the different formats supported by `mkstd`, and how to use/validate standards/data independently of `mkstd`.

## XML
The [XSD format](https://en.wikipedia.org/wiki/XML_Schema_%28W3C%29) is used. Search the web for `validate xml data against schema`.

## JSON
The [official JSON schema](https://en.wikipedia.org/wiki/JSON#Metadata_and_schema) format is used. Search the web for `validate json data against schema`.

## YAML
There is no official YAML schema format, so [YAML data is typically validated against JSON schemas](https://json-schema-everywhere.github.io/yaml). `mkstd` takes this approach too. Hence, tools that can validate YAML data against a JSON schema can be used, without an `mkstd` installation.

For example, [the `pajv` tool](https://github.com/json-schema-everywhere/pajv) can be used to validate YAML data against a JSON schema, without `mkstd`.
```bash
pajv validate -s output/mkstd_generated_schema.yaml -d output/data.yaml
```

By default, `mkstd` stores the schemas for YAML standards in YAML too.

## HDF5
There is currently no standard available for the specification of HDF5 schemas. Hence, the HDF5 files produced by `mkstd` can only be validated with `mkstd`.

There is a [format for HDF5 that enables interconversion with JSON](https://github.com/HDFGroup/hdf5-json). This is out-of-scope.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mkstd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "standard, hdf5, json, xml, yaml",
    "author": null,
    "author_email": "Dilan Pathirana <dilan.pathirana@uni-bonn.de>",
    "download_url": "https://files.pythonhosted.org/packages/15/bb/d4ac6604a24a4e8bb180671ecada2294e6c4f0cc3ba1951b042b238459b5/mkstd-0.0.5.tar.gz",
    "platform": null,
    "description": "# mkstd\nMake standards that can be exported/imported/validated via HDF5/JSON/XML/YAML.\n\n`mkstd` uses pre-existing standards for validation and schema specification, such that files produced using `mkstd` can be used independently of `mkstd`. For example, a tool developer can use `mkstd` to create a standard for their tool's data, but users do not necessarily need `mkstd` installed to use the data. However, `mkstd` also provides importers and exporters, so intended use also involves an `mkstd` installation for convenience.\n\n# Installation\n```bash\npip install mkstd\n\n# For HDF5 support\npip install hdfdict@git+https://github.com/SiggiGue/hdfdict\n```\nFor environments requiring `numpy<2`, replace `mkstd` with `mkstd[numpyv1]` above.\n\n# Intended use\n`mkstd` is intended to be used at two stages of data management. An example of these stages is provided in [](https://github/dilpath/mkstd/examples/libssr/ssr_data.py).\n## Generating a standard\nAt this stage, the \"user\" is the person designing the data type and corresponding standard. For example, a tool developer who wants to standardize the data produced by their tool. The steps could look like:\n1. (with `mkstd`) Design the data type as a Pydantic data model. Thanks to Pydantic, it behaves like a standard for your data, as a Python object.\n2. (with `mkstd`) Export the standard as e.g. XML and JSON schemas.\n3. (TODO, with `mkstd`) Generate documentation for the standard, based on the Pydantic data model docstrings.\n## Using a standard\nAt this stage, the \"user\" is someone who wants to use data generated by the tool, or import their own data into the tool.\n1. (with or without `mkstd`) Reformat data to match the standard specified by the e.g. `mkstd`-generated XML or JSON schema.\n2. (with or without `mkstd`) Validate the data against the schema.\n3. (with or without `mkstd`) Import/export the reformatted data with the tool.\n\n# External validation\nAs written above, many uses of the standard produced by `mkstd` are intended to be possible without an `mkstd` installation. This is because the generated standards are in standardized schema formats. Below are the different formats supported by `mkstd`, and how to use/validate standards/data independently of `mkstd`.\n\n## XML\nThe [XSD format](https://en.wikipedia.org/wiki/XML_Schema_%28W3C%29) is used. Search the web for `validate xml data against schema`.\n\n## JSON\nThe [official JSON schema](https://en.wikipedia.org/wiki/JSON#Metadata_and_schema) format is used. Search the web for `validate json data against schema`.\n\n## YAML\nThere is no official YAML schema format, so [YAML data is typically validated against JSON schemas](https://json-schema-everywhere.github.io/yaml). `mkstd` takes this approach too. Hence, tools that can validate YAML data against a JSON schema can be used, without an `mkstd` installation.\n\nFor example, [the `pajv` tool](https://github.com/json-schema-everywhere/pajv) can be used to validate YAML data against a JSON schema, without `mkstd`.\n```bash\npajv validate -s output/mkstd_generated_schema.yaml -d output/data.yaml\n```\n\nBy default, `mkstd` stores the schemas for YAML standards in YAML too.\n\n## HDF5\nThere is currently no standard available for the specification of HDF5 schemas. Hence, the HDF5 files produced by `mkstd` can only be validated with `mkstd`.\n\nThere is a [format for HDF5 that enables interconversion with JSON](https://github.com/HDFGroup/hdf5-json). This is out-of-scope.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2024, Dilan Pathirana  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Make standards compatible with HDF5/JSON/XML/YAML.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/dilpath/mkstd"
    },
    "split_keywords": [
        "standard",
        " hdf5",
        " json",
        " xml",
        " yaml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cd0f46c63d6878652f2899298a35cf35129385002d16d03d2717a3ea3425ae3",
                "md5": "68d29bf1c4dc90baeed2bf490fb0c703",
                "sha256": "fa05593ffefba7564fbe21b57f17a972afe30d9b772a69db55393f17408e3470"
            },
            "downloads": -1,
            "filename": "mkstd-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "68d29bf1c4dc90baeed2bf490fb0c703",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 18602,
            "upload_time": "2024-10-31T15:33:46",
            "upload_time_iso_8601": "2024-10-31T15:33:46.666583Z",
            "url": "https://files.pythonhosted.org/packages/0c/d0/f46c63d6878652f2899298a35cf35129385002d16d03d2717a3ea3425ae3/mkstd-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15bbd4ac6604a24a4e8bb180671ecada2294e6c4f0cc3ba1951b042b238459b5",
                "md5": "f7763b4172f7ce1e8f5ead8289f120f7",
                "sha256": "998184e6e79b18d8478fe68d8a0a6666c04a87c8eae5bf6a2b9e6a860ed5739d"
            },
            "downloads": -1,
            "filename": "mkstd-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "f7763b4172f7ce1e8f5ead8289f120f7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14663,
            "upload_time": "2024-10-31T15:33:48",
            "upload_time_iso_8601": "2024-10-31T15:33:48.797327Z",
            "url": "https://files.pythonhosted.org/packages/15/bb/d4ac6604a24a4e8bb180671ecada2294e6c4f0cc3ba1951b042b238459b5/mkstd-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-31 15:33:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dilpath",
    "github_project": "mkstd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mkstd"
}
        
Elapsed time: 0.56984s