Metadata-Version: 2.4
Name: aas-client3.2
Version: 1.0.0rc1
Summary: Interact with AAS V3.2 servers over HTTP using Python.
Author-email: Marko Ristin <marko@ristin.ch>
License-Expression: MIT
Project-URL: Homepage, https://github.com/eclipse-aascw/aas-client3.2-python
Project-URL: Documentation, https://eclipse-aascw.github.io/aas-client3.2-python/
Project-URL: Repository, https://github.com/eclipse-aascw/aas-client3.2-python
Project-URL: Issues, https://github.com/eclipse-aascw/aas-client3.2-python/issues
Keywords: asset administration shell,sdk,industry 4.0,industrie,i4.0,industry,iot,iiot
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: aas-core3.2<2,>=1.0.0rc3
Provides-Extra: requests
Requires-Dist: requests<3,>=2.28; extra == "requests"
Dynamic: license-file

****************************
Eclipse aas-client3.2-python
****************************

.. image:: https://github.com/eclipse-aascw/aas-client3.2-python/actions/workflows/ci.yml/badge.svg
    :target: https://github.com/eclipse-aascw/aas-client3.2-python/actions/workflows/ci.yml
    :alt: Continuous integration

.. image:: https://coveralls.io/repos/github/eclipse-aascw/aas-client3.2-python/badge.svg?branch=main
    :target: https://coveralls.io/github/eclipse-aascw/aas-client3.2-python?branch=main
    :alt: Test coverage

.. image:: https://badge.fury.io/py/aas-client3.2.svg
    :target: https://badge.fury.io/py/aas-client3.2
    :alt: PyPI - version

.. image:: https://img.shields.io/pypi/pyversions/aas-client3.2.svg
    :alt: PyPI - Python Version

.. image:: https://github.com/eclipse-aascw/aas-client3.2-python/actions/workflows/build-test-docs.yml/badge.svg
    :target: https://eclipse-aascw.github.io/aas-client3.2-python/
    :alt: Documentation

This is a client to interact with servers of Asset Administration Shells (AAS) over the HTTP/REST API, version 3.2, in Python.

The client works with the types of `aas-core3.2`_, so you can directly send and receive the AAS models you create, verify and de/serialize with it.
It implements all the operations of the specification, one function per operation, and does not depend on any particular HTTP library: you bring your own transport, or use the ready-made one based on `requests`_.

.. _aas-core3.2: https://github.com/eclipse-aascw/aas-core3.2-python

.. _requests: https://pypi.org/project/requests/

Appetizer
=========

Create a submodel in a Submodel Repository, read one of its values, and list all the submodels page by page:

.. code-block:: python

    import requests

    import aas_core3_2.types as aas_types

    from aas_client3_2 import http
    from aas_client3_2 import pagination
    from aas_client3_2 import requests_transport
    from aas_client3_2 import submodel_repository

    server = http.Server(
        transport=requests_transport.RequestsTransport(requests.Session()),
        base_url="http://localhost:5005",
    )

    submodel = aas_types.Submodel(
        id="https://example.com/ids/sm/appetizer",
        id_short="Appetizer",
        submodel_elements=[
            aas_types.Property(
                id_short="MaxRotationSpeed",
                value_type=aas_types.DataTypeDefXSD.INT,
                value="5000",
            )
        ],
    )
    submodel_repository.post_submodel(server, submodel)

    print(
        submodel_repository.get_submodel_element_by_path_value_only(
            server, submodel.id, "MaxRotationSpeed"
        )
    )
    # Prints: 5000.0

    for a_submodel in pagination.iterate(
        lambda cursor: submodel_repository.get_all_submodels(server, cursor=cursor)
    ):
        print(a_submodel.id)

Installation
============

Install the client together with the ready-made transport:

.. code-block::

    pip3 install aas-client3.2[requests]

To check servers against the specification, also install the testing client, `aas-testing-client3.2`_, which mirrors the client with contracts on the requests and the responses.

.. _aas-testing-client3.2: https://pypi.org/project/aas-testing-client3.2/

Documentation
=============

The documentation is available on: https://eclipse-aascw.github.io/aas-client3.2-python/

* `Getting started`_: the installation, a tutorial which creates and changes a shell with its submodels, and the errors, the pagination, the files, the transports and the authentication with OAuth 2 and OIDC,
* `Modules`_: a chapter with examples for every API, such as the repositories, the registries and the discovery,
* `API reference`_: all the functions, generated from the source code, and
* `Design`_: the architecture and the design decisions.

.. _Getting started: https://eclipse-aascw.github.io/aas-client3.2-python/getting_started/index.html

.. _Modules: https://eclipse-aascw.github.io/aas-client3.2-python/getting_started/modules/index.html

.. _API reference: https://eclipse-aascw.github.io/aas-client3.2-python/api/index.html

.. _Design: https://eclipse-aascw.github.io/aas-client3.2-python/design.html

Specification
=============

The client is based on the OpenAPI definitions of the HTTP/REST API from the `Specification of the Asset Administration Shell, Part 2: API (IDTA-01002) version 3.2`_, available in `admin-shell-io/aas-specs-api at v3.2.0`_.
In particular:

* `Entire-API-Collection/V3.2.yaml`_ -- all the API operations in one file, and
* `Part2-API-Schemas/openapi.yaml`_ -- the payload schemas.

.. _Specification of the Asset Administration Shell, Part 2\: API (IDTA-01002) version 3.2: https://industrialdigitaltwin.io/aas-specifications/IDTA-01002/v3.2/index.html

.. _admin-shell-io/aas-specs-api at v3.2.0: https://github.com/admin-shell-io/aas-specs-api/tree/v3.2.0

.. _Entire-API-Collection/V3.2.yaml: https://github.com/admin-shell-io/aas-specs-api/blob/v3.2.0/Entire-API-Collection/V3.2.yaml

.. _Part2-API-Schemas/openapi.yaml: https://github.com/admin-shell-io/aas-specs-api/blob/v3.2.0/Part2-API-Schemas/openapi.yaml

Contributing
============

If you want to contribute, see our `contributing guide`_.

.. _contributing guide: https://eclipse-aascw.github.io/aas-client3.2-python/contributing.html
