jsonschema-lexer


Namejsonschema-lexer JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryA Pygments lexer for JSON Schema
upload_time2024-03-11 13:45:47
maintainer
docs_urlNone
author
requires_python>=3.10
license
keywords json jsonschema
VCS
bugtrack_url
requirements pygments
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =======================
``jsonschema-lexer``
=======================

|PyPI| |Pythons| |CI|

.. |PyPI| image:: https://img.shields.io/pypi/v/jsonschema-lexer.svg
  :alt: PyPI version
  :target: https://pypi.org/project/jsonschema-lexer/

.. |Pythons| image:: https://img.shields.io/pypi/pyversions/jsonschema-lexer.svg
  :alt: Supported Python versions
  :target: https://pypi.org/project/jsonschema-lexer/

.. |CI| image:: https://github.com/python-jsonschema/jsonschema-lexer/workflows/CI/badge.svg
  :alt: Build status
  :target: https://github.com/python-jsonschema/jsonschema-lexer/actions?query=workflow%3ACI

Introduction
------------

`jsonschema-lexer` provides a lexer for syntax highlighting JSON Schema documents via `Pygments <https://pygments.org/>`_.

Usage
-----

Once installed, you can use it in your Python code to highlight JSON Schema documents.

Here's a simple example:

.. code-block:: python

  from jsonschema_lexer import JSONSchemaLexer

  from rich.console import Console
  from rich.syntax import Syntax

  console = Console()

  code = """
  {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://example.com/product.schema.json",
    "title": "Product",
    "description": "A product from Acme's catalog",
    "type": "object",
    "properties": {
      "productId": {
        "description": "The unique identifier for a product",
        "type": "integer"
      },
      "productName": {
        "description": "Name of the product",
        "type": "string"
      }
    }
  }
  """

  syntax = Syntax(code, lexer=JSONSchemaLexer(), background_color="default", word_wrap=True)
  console.print(syntax)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jsonschema-lexer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "json,jsonschema",
    "author": "",
    "author_email": "Julian Berman <Julian+jsonschema-lexer@GrayVines.com>",
    "download_url": "https://files.pythonhosted.org/packages/7d/eb/ca0d9d49bdeb7e53dd0da0336a915caf41c3fa17a2e354217d9d5fa0252d/jsonschema_lexer-0.2.1.tar.gz",
    "platform": null,
    "description": "=======================\n``jsonschema-lexer``\n=======================\n\n|PyPI| |Pythons| |CI|\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/jsonschema-lexer.svg\n  :alt: PyPI version\n  :target: https://pypi.org/project/jsonschema-lexer/\n\n.. |Pythons| image:: https://img.shields.io/pypi/pyversions/jsonschema-lexer.svg\n  :alt: Supported Python versions\n  :target: https://pypi.org/project/jsonschema-lexer/\n\n.. |CI| image:: https://github.com/python-jsonschema/jsonschema-lexer/workflows/CI/badge.svg\n  :alt: Build status\n  :target: https://github.com/python-jsonschema/jsonschema-lexer/actions?query=workflow%3ACI\n\nIntroduction\n------------\n\n`jsonschema-lexer` provides a lexer for syntax highlighting JSON Schema documents via `Pygments <https://pygments.org/>`_.\n\nUsage\n-----\n\nOnce installed, you can use it in your Python code to highlight JSON Schema documents.\n\nHere's a simple example:\n\n.. code-block:: python\n\n  from jsonschema_lexer import JSONSchemaLexer\n\n  from rich.console import Console\n  from rich.syntax import Syntax\n\n  console = Console()\n\n  code = \"\"\"\n  {\n    \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n    \"$id\": \"https://example.com/product.schema.json\",\n    \"title\": \"Product\",\n    \"description\": \"A product from Acme's catalog\",\n    \"type\": \"object\",\n    \"properties\": {\n      \"productId\": {\n        \"description\": \"The unique identifier for a product\",\n        \"type\": \"integer\"\n      },\n      \"productName\": {\n        \"description\": \"Name of the product\",\n        \"type\": \"string\"\n      }\n    }\n  }\n  \"\"\"\n\n  syntax = Syntax(code, lexer=JSONSchemaLexer(), background_color=\"default\", word_wrap=True)\n  console.print(syntax)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Pygments lexer for JSON Schema",
    "version": "0.2.1",
    "project_urls": {
        "Issues": "https://github.com/python-jsonschema/jsonschema-lexer/issues/",
        "Source": "https://github.com/python-jsonschema/jsonschema-lexer"
    },
    "split_keywords": [
        "json",
        "jsonschema"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7608ab7d5a1e1388bfd425ac95f1ff1e3a4d1c82a0214419a7648654d081ab63",
                "md5": "3fb9bec53c6490b7742484373215b117",
                "sha256": "c46fd6a4a707fe1ca45d0704f7df090c53a312e5a345a7739996586f55ea8971"
            },
            "downloads": -1,
            "filename": "jsonschema_lexer-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3fb9bec53c6490b7742484373215b117",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 9722,
            "upload_time": "2024-03-11T13:45:45",
            "upload_time_iso_8601": "2024-03-11T13:45:45.940094Z",
            "url": "https://files.pythonhosted.org/packages/76/08/ab7d5a1e1388bfd425ac95f1ff1e3a4d1c82a0214419a7648654d081ab63/jsonschema_lexer-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7debca0d9d49bdeb7e53dd0da0336a915caf41c3fa17a2e354217d9d5fa0252d",
                "md5": "d72c4a7f6157050f5902c63c77591861",
                "sha256": "45eb765bd428d849907e24ef989f421a4ca63447d10ab1b4f4171471d558939b"
            },
            "downloads": -1,
            "filename": "jsonschema_lexer-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d72c4a7f6157050f5902c63c77591861",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 11304,
            "upload_time": "2024-03-11T13:45:47",
            "upload_time_iso_8601": "2024-03-11T13:45:47.599054Z",
            "url": "https://files.pythonhosted.org/packages/7d/eb/ca0d9d49bdeb7e53dd0da0336a915caf41c3fa17a2e354217d9d5fa0252d/jsonschema_lexer-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-11 13:45:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "python-jsonschema",
    "github_project": "jsonschema-lexer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pygments",
            "specs": [
                [
                    "==",
                    "2.17.2"
                ]
            ]
        }
    ],
    "lcname": "jsonschema-lexer"
}
        
Elapsed time: 0.22123s