structa


Namestructa JSON
Version 0.4 PyPI version JSON
download
home_page
SummaryAnalyzes data files for common structures
upload_time2023-05-04 07:32:33
maintainer
docs_urlNone
authorDave Jones
requires_python>=3.5
license
keywords json yaml csv data analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =======
structa
=======

structa is a small, semi-magical utility for discerning the "overall structure"
of large data files. Typically this is something like a document oriented
database in JSON format, or a CSV file of a database dump, or a YAML document.


Usage
=====

Use from the command line::

    structa <filename>

The usual ``--help`` and ``--version`` switches are available for more
information. The full `documentation`_ may also help understanding the myriad
switches!


Examples
========

The `People in Space API`_ shows the number of people currently in space, and
their names and craft name::

    curl -s http://api.open-notify.org/astros.json | structa

Output::

    {
        'message': str range="success" pattern="success",
        'number': int range=10,
        'people': [
            {
                'craft': str range="ISS".."Tiangong",
                'name': str range="Akihiko Hoshide".."Thomas Pesquet"
            }
        ]
    }


The `Python Package Index`_ (PyPI) provides a JSON API for packages. You can
feed the JSON of several packages to ``structa`` to get an idea of the overall
structure of these records (when structa is given multiple inputs on the same
invocation, it assumes all have a common source)::

    for pkg in numpy scipy pandas matplotlib structa; do
        curl -s https://pypi.org/pypi/$pkg/json > $pkg.json
    done
    structa numpy.json scipy.json pandas.json matplotlib.json structa.json

Output::

    {
        'info': { str: value },
        'last_serial': int range=11.9M..13.1M,
        'releases': {
            str range="0.1".."3.5.1": [
                {
                    'comment_text': str,
                    'digests': {
                        'md5': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        'sha256': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                    },
                    'downloads': int range=-1,
                    'filename': str,
                    'has_sig': bool,
                    'md5_digest': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                    'packagetype': str range="bdist_wheel".."sdist",
                    'python_version': str range="2.4".."source",
                    'requires_python': value,
                    'size': int range=39.3K..118.4M,
                    'upload_time': str of timestamp range=2006-01-09 14:02:01..2022-03-10 16:45:20 pattern="%Y-%m-%dT%H:%M:%S",
                    'upload_time_iso_8601': str of timestamp range=2009-04-06 06:19:25..2022-03-10 16:45:20 pattern="%Y-%m-%dT%H:%M:%S.%f%z",
                    'url': URL,
                    'yanked': bool,
                    'yanked_reason': value
                }
            ]
        },
        'urls': [
            {
                'comment_text': str range="",
                'digests': {
                    'md5': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                    'sha256': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                },
                'downloads': int range=-1,
                'filename': str,
                'has_sig': bool,
                'md5_digest': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                'packagetype': str range="bdist_wheel".."sdist",
                'python_version': str range="cp310".."source",
                'requires_python': value,
                'size': int range=47.2K..55.6M,
                'upload_time': str of timestamp range=2021-10-27 23:57:01..2022-03-10 16:45:20 pattern="%Y-%m-%dT%H:%M:%S",
                'upload_time_iso_8601': str of timestamp range=2021-10-27 23:57:01..2022-03-10 16:45:20 pattern="%Y-%m-%dT%H:%M:%S.%f%z",
                'url': URL,
                'yanked': bool,
                'yanked_reason': value
            }
        ],
        'vulnerabilities': [ empty ]
    }


The `Ubuntu Security Notices`_ database contains the list of all security
issues in releases of Ubuntu (warning, this one takes some time to analyze and
eats about a gigabyte of RAM while doing so)::

    curl -s https://usn.ubuntu.com/usn-db/database.json | structa

Output::

    {
        str range="1430-1".."4630-1" pattern="dddd-d": {
            'action'?: str,
            'cves': [ str ],
            'description': str,
            'id': str range="1430-1".."4630-1" pattern="dddd-d",
            'isummary'?: str,
            'releases': {
                str range="artful".."zesty": {
                    'allbinaries'?: {
                        str: { 'version': str }
                    },
                    'archs'?: {
                        str range="all".."source": {
                            'urls': {
                                URL: {
                                    'md5': str pattern="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                                    'size': int range=20..1.2G
                                }
                            }
                        }
                    },
                    'binaries': {
                        str: { 'version': str }
                    },
                    'sources': {
                        str: {
                            'description': str,
                            'version': str
                        }
                    }
                }
            },
            'summary': str,
            'timestamp': float of timestamp range=2012-04-27 12:57:41..2020-11-11 18:01:48,
            'title': str
        }
    }

.. _documentation: https://structa.readthedocs.io/
.. _People in Space API: http://open-notify.org/Open-Notify-API/People-In-Space/
.. _Python Package Index: https://pypi.org/
.. _Ubuntu Security Notices: https://usn.ubuntu.com/usn-db/database.json



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "structa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "json yaml csv data analysis",
    "author": "Dave Jones",
    "author_email": "dave@waveform.org.uk",
    "download_url": "https://files.pythonhosted.org/packages/78/6b/642bb4b68695e78716627c24b92c94b0fd2e3ec971b0f4c217b46e46c490/structa-0.4.tar.gz",
    "platform": null,
    "description": "=======\nstructa\n=======\n\nstructa is a small, semi-magical utility for discerning the \"overall structure\"\nof large data files. Typically this is something like a document oriented\ndatabase in JSON format, or a CSV file of a database dump, or a YAML document.\n\n\nUsage\n=====\n\nUse from the command line::\n\n    structa <filename>\n\nThe usual ``--help`` and ``--version`` switches are available for more\ninformation. The full `documentation`_ may also help understanding the myriad\nswitches!\n\n\nExamples\n========\n\nThe `People in Space API`_ shows the number of people currently in space, and\ntheir names and craft name::\n\n    curl -s http://api.open-notify.org/astros.json | structa\n\nOutput::\n\n    {\n        'message': str range=\"success\" pattern=\"success\",\n        'number': int range=10,\n        'people': [\n            {\n                'craft': str range=\"ISS\"..\"Tiangong\",\n                'name': str range=\"Akihiko Hoshide\"..\"Thomas Pesquet\"\n            }\n        ]\n    }\n\n\nThe `Python Package Index`_ (PyPI) provides a JSON API for packages. You can\nfeed the JSON of several packages to ``structa`` to get an idea of the overall\nstructure of these records (when structa is given multiple inputs on the same\ninvocation, it assumes all have a common source)::\n\n    for pkg in numpy scipy pandas matplotlib structa; do\n        curl -s https://pypi.org/pypi/$pkg/json > $pkg.json\n    done\n    structa numpy.json scipy.json pandas.json matplotlib.json structa.json\n\nOutput::\n\n    {\n        'info': { str: value },\n        'last_serial': int range=11.9M..13.1M,\n        'releases': {\n            str range=\"0.1\"..\"3.5.1\": [\n                {\n                    'comment_text': str,\n                    'digests': {\n                        'md5': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n                        'sha256': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n                    },\n                    'downloads': int range=-1,\n                    'filename': str,\n                    'has_sig': bool,\n                    'md5_digest': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n                    'packagetype': str range=\"bdist_wheel\"..\"sdist\",\n                    'python_version': str range=\"2.4\"..\"source\",\n                    'requires_python': value,\n                    'size': int range=39.3K..118.4M,\n                    'upload_time': str of timestamp range=2006-01-09 14:02:01..2022-03-10 16:45:20 pattern=\"%Y-%m-%dT%H:%M:%S\",\n                    'upload_time_iso_8601': str of timestamp range=2009-04-06 06:19:25..2022-03-10 16:45:20 pattern=\"%Y-%m-%dT%H:%M:%S.%f%z\",\n                    'url': URL,\n                    'yanked': bool,\n                    'yanked_reason': value\n                }\n            ]\n        },\n        'urls': [\n            {\n                'comment_text': str range=\"\",\n                'digests': {\n                    'md5': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n                    'sha256': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n                },\n                'downloads': int range=-1,\n                'filename': str,\n                'has_sig': bool,\n                'md5_digest': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n                'packagetype': str range=\"bdist_wheel\"..\"sdist\",\n                'python_version': str range=\"cp310\"..\"source\",\n                'requires_python': value,\n                'size': int range=47.2K..55.6M,\n                'upload_time': str of timestamp range=2021-10-27 23:57:01..2022-03-10 16:45:20 pattern=\"%Y-%m-%dT%H:%M:%S\",\n                'upload_time_iso_8601': str of timestamp range=2021-10-27 23:57:01..2022-03-10 16:45:20 pattern=\"%Y-%m-%dT%H:%M:%S.%f%z\",\n                'url': URL,\n                'yanked': bool,\n                'yanked_reason': value\n            }\n        ],\n        'vulnerabilities': [ empty ]\n    }\n\n\nThe `Ubuntu Security Notices`_ database contains the list of all security\nissues in releases of Ubuntu (warning, this one takes some time to analyze and\neats about a gigabyte of RAM while doing so)::\n\n    curl -s https://usn.ubuntu.com/usn-db/database.json | structa\n\nOutput::\n\n    {\n        str range=\"1430-1\"..\"4630-1\" pattern=\"dddd-d\": {\n            'action'?: str,\n            'cves': [ str ],\n            'description': str,\n            'id': str range=\"1430-1\"..\"4630-1\" pattern=\"dddd-d\",\n            'isummary'?: str,\n            'releases': {\n                str range=\"artful\"..\"zesty\": {\n                    'allbinaries'?: {\n                        str: { 'version': str }\n                    },\n                    'archs'?: {\n                        str range=\"all\"..\"source\": {\n                            'urls': {\n                                URL: {\n                                    'md5': str pattern=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n                                    'size': int range=20..1.2G\n                                }\n                            }\n                        }\n                    },\n                    'binaries': {\n                        str: { 'version': str }\n                    },\n                    'sources': {\n                        str: {\n                            'description': str,\n                            'version': str\n                        }\n                    }\n                }\n            },\n            'summary': str,\n            'timestamp': float of timestamp range=2012-04-27 12:57:41..2020-11-11 18:01:48,\n            'title': str\n        }\n    }\n\n.. _documentation: https://structa.readthedocs.io/\n.. _People in Space API: http://open-notify.org/Open-Notify-API/People-In-Space/\n.. _Python Package Index: https://pypi.org/\n.. _Ubuntu Security Notices: https://usn.ubuntu.com/usn-db/database.json\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Analyzes data files for common structures",
    "version": "0.4",
    "project_urls": {
        "Documentation": "https://structa.readthedocs.io/",
        "Issue Tracker": "https://github.com/waveform80/structa/issues",
        "Source Code": "https://github.com/waveform80/structa"
    },
    "split_keywords": [
        "json",
        "yaml",
        "csv",
        "data",
        "analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a15bc50b5546ed62f17bdd6a266229f2df4d9c72b4fc54ab6d4914d42d600aa",
                "md5": "97f37c8ecd9a6e7b8dbea834af32904f",
                "sha256": "aa90bd7cdf1bb532c1b6be1ba2b2d5c67ed7fd30663d81fca9c681d4d913f0d9"
            },
            "downloads": -1,
            "filename": "structa-0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "97f37c8ecd9a6e7b8dbea834af32904f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 51821,
            "upload_time": "2023-05-04T07:32:31",
            "upload_time_iso_8601": "2023-05-04T07:32:31.455949Z",
            "url": "https://files.pythonhosted.org/packages/4a/15/bc50b5546ed62f17bdd6a266229f2df4d9c72b4fc54ab6d4914d42d600aa/structa-0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "786b642bb4b68695e78716627c24b92c94b0fd2e3ec971b0f4c217b46e46c490",
                "md5": "ab44cb22cd567ff49f7c6c1aaebebc2c",
                "sha256": "df1ecb467729ded61de3e5fa535b9d1e97467e34d0ac8b97b263f2cf3d630956"
            },
            "downloads": -1,
            "filename": "structa-0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ab44cb22cd567ff49f7c6c1aaebebc2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 49623,
            "upload_time": "2023-05-04T07:32:33",
            "upload_time_iso_8601": "2023-05-04T07:32:33.320478Z",
            "url": "https://files.pythonhosted.org/packages/78/6b/642bb4b68695e78716627c24b92c94b0fd2e3ec971b0f4c217b46e46c490/structa-0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-04 07:32:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "waveform80",
    "github_project": "structa",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "structa"
}
        
Elapsed time: 0.12814s