amazon-braket-schemas


Nameamazon-braket-schemas JSON
Version 1.21.4 PyPI version JSON
download
home_pagehttps://github.com/amazon-braket/amazon-braket-schemas-python
SummaryAn open source library that contains the schemas for Amazon Braket
upload_time2024-04-15 16:17:51
maintainerNone
docs_urlNone
authorAmazon Web Services
requires_python>=3.9
licenseApache License 2.0
keywords amazon aws quantum
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # Amazon Braket Python Schemas

[![Latest Version](https://img.shields.io/pypi/v/amazon-braket-schemas.svg)](https://pypi.python.org/pypi/amazon-braket-schemas)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/amazon-braket-schemas.svg)](https://pypi.python.org/pypi/amazon-braket-schemas)
[![Build status](https://github.com/amazon-braket/amazon-braket-schemas-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/amazon-braket/amazon-braket-schemas-python/actions/workflows/python-package.yml)
[![codecov](https://codecov.io/gh/amazon-braket/amazon-braket-schemas-python/branch/main/graph/badge.svg?token=XV9R0dUbr1)](https://codecov.io/gh/amazon-braket/amazon-braket-schemas-python)
[![Documentation Status](https://img.shields.io/readthedocs/amazon-braket-schemas-python.svg?logo=read-the-docs)](https://amazon-braket-schemas-python.readthedocs.io/en/latest/?badge=latest)

Amazon Braket Python Schemas is an open source library that contains the schemas for Braket, including:
* intermediate representations (IR) for Amazon Braket quantum tasks and offers serialization and deserialization of those IR payloads. Think of the IR as the contract between the Amazon Braket SDK and Amazon Braket API for quantum programs.
* schemas for the S3 results of each quantum task
* schemas for the device capabilities of each device

## Installation

### Prerequisites
- Python 3.9+

### Steps

The preferred way to get Amazon Braket Python Schemas is by installing the [Amazon Braket Python SDK](https://github.com/amazon-braket/amazon-braket-sdk-python), which will pull in the schemas.
Follow the instructions in the [README](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/README.md) for setup.

However, if you only want to use the schemas, it can be installed on its own as follows:

```shell
pip install amazon-braket-schemas
```

You can install from source by cloning this repository and running a pip install command in the root directory of the repository:

```shell
git clone https://github.com/amazon-braket/amazon-braket-schemas-python.git
cd amazon-braket-schemas-python
pip install .
```

You can check your currently installed version of `amazon-braket-schemas` with `pip show`:

```shell
pip show amazon-braket-schemas
```

or alternatively from within Python:

```
>>> import braket._schemas as braket_schemas
>>> braket_schemas.__version__
```

## Usage
OpenQASM (Open Quantum Assembly Language) is one type of IR. See below for its usage.

**Serializing python structures**
```python
from braket.ir.openqasm import Program as OpenQASMProgram

program = OpenQASMProgram(source="OPENQASM 3.0; cnot $0, $1;")
print(program.json(indent=2))

"""
{
  "braketSchemaHeader": {
    "name": "braket.ir.openqasm.program",
    "version": "1"
  },
  "source": "OPENQASM 3.0; cnot $0, $1;",
  "inputs": null
}
"""
```

**Deserializing into python structures**
```python
from braket.ir.openqasm import Program as OpenQASMProgram

openqasm_string = """
{
  "braketSchemaHeader": {
    "name": "braket.ir.openqasm.program",
    "version": "1"
  },
  "source": "OPENQASM 3.0; cnot $0, $1;"
}"""

program = OpenQASMProgram.parse_raw(openqasm_string)
print(program)

"""
braketSchemaHeader=BraketSchemaHeader(name='braket.ir.openqasm.program', version='1') source='OPENQASM 3.0; cnot $0, $1;' inputs=None
"""

```

## Documentation

Detailed documentation, including the API reference, can be found on [Read the Docs](https://amazon-braket-schemas-python.readthedocs.io/en/latest/).

You can also generate the docs from source. First, install tox:

```shell
pip install tox
```

To build the Sphinx docs, run the following command in the root repo directory:

```shell
tox -e docs
```

You can then find the generated HTML files in `build/documentation/html`.

## Testing

Make sure to install test dependencies first:

```shell
pip install -e "amazon-braket-schemas-python[test]"
```

To run the unit tests:
```bash
tox -e unit-tests
```

You can also pass in various pytest arguments to run selected tests:

```bash
tox -e unit-tests -- your-arguments
```

To run linters and doc generators and unit tests:
```bash
tox
```

For more information, please see [pytest usage](https://docs.pytest.org/en/stable/usage.html).

## License

This project is licensed under the Apache-2.0 License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/amazon-braket/amazon-braket-schemas-python",
    "name": "amazon-braket-schemas",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "Amazon AWS Quantum",
    "author": "Amazon Web Services",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/42/4b/cf57a1f5f59ecf1f143cf6da9ed06ea9997acf688e3e7b65d6238e704f74/amazon_braket_schemas-1.21.4.tar.gz",
    "platform": null,
    "description": "# Amazon Braket Python Schemas\n\n[![Latest Version](https://img.shields.io/pypi/v/amazon-braket-schemas.svg)](https://pypi.python.org/pypi/amazon-braket-schemas)\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/amazon-braket-schemas.svg)](https://pypi.python.org/pypi/amazon-braket-schemas)\n[![Build status](https://github.com/amazon-braket/amazon-braket-schemas-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/amazon-braket/amazon-braket-schemas-python/actions/workflows/python-package.yml)\n[![codecov](https://codecov.io/gh/amazon-braket/amazon-braket-schemas-python/branch/main/graph/badge.svg?token=XV9R0dUbr1)](https://codecov.io/gh/amazon-braket/amazon-braket-schemas-python)\n[![Documentation Status](https://img.shields.io/readthedocs/amazon-braket-schemas-python.svg?logo=read-the-docs)](https://amazon-braket-schemas-python.readthedocs.io/en/latest/?badge=latest)\n\nAmazon Braket Python Schemas is an open source library that contains the schemas for Braket, including:\n* intermediate representations (IR) for Amazon Braket quantum tasks and offers serialization and deserialization of those IR payloads. Think of the IR as the contract between the Amazon Braket SDK and Amazon Braket API for quantum programs.\n* schemas for the S3 results of each quantum task\n* schemas for the device capabilities of each device\n\n## Installation\n\n### Prerequisites\n- Python 3.9+\n\n### Steps\n\nThe preferred way to get Amazon Braket Python Schemas is by installing the [Amazon Braket Python SDK](https://github.com/amazon-braket/amazon-braket-sdk-python), which will pull in the schemas.\nFollow the instructions in the [README](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/README.md) for setup.\n\nHowever, if you only want to use the schemas, it can be installed on its own as follows:\n\n```shell\npip install amazon-braket-schemas\n```\n\nYou can install from source by cloning this repository and running a pip install command in the root directory of the repository:\n\n```shell\ngit clone https://github.com/amazon-braket/amazon-braket-schemas-python.git\ncd amazon-braket-schemas-python\npip install .\n```\n\nYou can check your currently installed version of `amazon-braket-schemas` with `pip show`:\n\n```shell\npip show amazon-braket-schemas\n```\n\nor alternatively from within Python:\n\n```\n>>> import braket._schemas as braket_schemas\n>>> braket_schemas.__version__\n```\n\n## Usage\nOpenQASM (Open Quantum Assembly Language) is one type of IR. See below for its usage.\n\n**Serializing python structures**\n```python\nfrom braket.ir.openqasm import Program as OpenQASMProgram\n\nprogram = OpenQASMProgram(source=\"OPENQASM 3.0; cnot $0, $1;\")\nprint(program.json(indent=2))\n\n\"\"\"\n{\n  \"braketSchemaHeader\": {\n    \"name\": \"braket.ir.openqasm.program\",\n    \"version\": \"1\"\n  },\n  \"source\": \"OPENQASM 3.0; cnot $0, $1;\",\n  \"inputs\": null\n}\n\"\"\"\n```\n\n**Deserializing into python structures**\n```python\nfrom braket.ir.openqasm import Program as OpenQASMProgram\n\nopenqasm_string = \"\"\"\n{\n  \"braketSchemaHeader\": {\n    \"name\": \"braket.ir.openqasm.program\",\n    \"version\": \"1\"\n  },\n  \"source\": \"OPENQASM 3.0; cnot $0, $1;\"\n}\"\"\"\n\nprogram = OpenQASMProgram.parse_raw(openqasm_string)\nprint(program)\n\n\"\"\"\nbraketSchemaHeader=BraketSchemaHeader(name='braket.ir.openqasm.program', version='1') source='OPENQASM 3.0; cnot $0, $1;' inputs=None\n\"\"\"\n\n```\n\n## Documentation\n\nDetailed documentation, including the API reference, can be found on [Read the Docs](https://amazon-braket-schemas-python.readthedocs.io/en/latest/).\n\nYou can also generate the docs from source. First, install tox:\n\n```shell\npip install tox\n```\n\nTo build the Sphinx docs, run the following command in the root repo directory:\n\n```shell\ntox -e docs\n```\n\nYou can then find the generated HTML files in `build/documentation/html`.\n\n## Testing\n\nMake sure to install test dependencies first:\n\n```shell\npip install -e \"amazon-braket-schemas-python[test]\"\n```\n\nTo run the unit tests:\n```bash\ntox -e unit-tests\n```\n\nYou can also pass in various pytest arguments to run selected tests:\n\n```bash\ntox -e unit-tests -- your-arguments\n```\n\nTo run linters and doc generators and unit tests:\n```bash\ntox\n```\n\nFor more information, please see [pytest usage](https://docs.pytest.org/en/stable/usage.html).\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "An open source library that contains the schemas for Amazon Braket",
    "version": "1.21.4",
    "project_urls": {
        "Homepage": "https://github.com/amazon-braket/amazon-braket-schemas-python"
    },
    "split_keywords": [
        "amazon",
        "aws",
        "quantum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0953b487c2cf40f9b01edb88f7f136180aa04cfa81dbe76a9a0ccea44f86f8e0",
                "md5": "8f9a8d2d57bdb2fd1591d32669155d88",
                "sha256": "347c8ac0b9e69fcd767db09d9b17eecfdd9eb4a3509a751d1c4018d5408da3bb"
            },
            "downloads": -1,
            "filename": "amazon_braket_schemas-1.21.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8f9a8d2d57bdb2fd1591d32669155d88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 121122,
            "upload_time": "2024-04-15T16:17:50",
            "upload_time_iso_8601": "2024-04-15T16:17:50.053427Z",
            "url": "https://files.pythonhosted.org/packages/09/53/b487c2cf40f9b01edb88f7f136180aa04cfa81dbe76a9a0ccea44f86f8e0/amazon_braket_schemas-1.21.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "424bcf57a1f5f59ecf1f143cf6da9ed06ea9997acf688e3e7b65d6238e704f74",
                "md5": "c6ba6221dfc4418911a416539e0d4837",
                "sha256": "39cce4c6ffd6a4672bed2235fa59273473b4d66c40a3ee8de8fdf149f004ce08"
            },
            "downloads": -1,
            "filename": "amazon_braket_schemas-1.21.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c6ba6221dfc4418911a416539e0d4837",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 50465,
            "upload_time": "2024-04-15T16:17:51",
            "upload_time_iso_8601": "2024-04-15T16:17:51.888790Z",
            "url": "https://files.pythonhosted.org/packages/42/4b/cf57a1f5f59ecf1f143cf6da9ed06ea9997acf688e3e7b65d6238e704f74/amazon_braket_schemas-1.21.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 16:17:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "amazon-braket",
    "github_project": "amazon-braket-schemas-python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "amazon-braket-schemas"
}
        
Elapsed time: 0.23900s