Metadata-Version: 2.4
Name: ophyd-service
Version: 0.0.1
Summary: REST API Server for Ophyd Objects.
Author: Brookhaven National Laboratory
License: BSD 3-Clause License
        
        Copyright (c) 2019-2021, Brookhaven National Laboratory
        All rights reserved.
        
        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.
        
Project-URL: GitHub, https://github.com/dmgav/ophyd-service
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: alembic
Requires-Dist: bluesky-queueserver
Requires-Dist: cachetools
Requires-Dist: fastapi
Requires-Dist: httpx
Requires-Dist: ldap3
Requires-Dist: orjson
Requires-Dist: pamela
Requires-Dist: pydantic<3,>=2
Requires-Dist: pydantic-settings>=2
Requires-Dist: python-jose
Requires-Dist: pyzmq
Requires-Dist: sqlalchemy>=2
Requires-Dist: starlette
Requires-Dist: uvicorn
Provides-Extra: dev
Requires-Dist: codecov; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: cryptography; extra == "dev"
Requires-Dist: fastapi[all]; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-xprocess; extra == "dev"
Requires-Dist: pytest-split; extra == "dev"
Requires-Dist: py; extra == "dev"
Requires-Dist: respx; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: ipython; extra == "dev"
Requires-Dist: numpydoc; extra == "dev"
Requires-Dist: matplotlib; extra == "dev"
Requires-Dist: pandas; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: sphinx_rtd_theme; extra == "dev"
Requires-Dist: requests; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

=============
ophyd-service
=============

Prototype for REST API Server for Ophyd devices


Starting the server::

    uvicorn --host localhost --port 60620 ophyd_service.server:app

Starting the server with config file::

    OPHYD_SERVICE_CONFIG=config.yml uvicorn --host localhost --port 60620 ophyd_service.server:app

Minimum config file::

    authentication:
        single_user_api_key: a

Starting with single user API key::

    OPHYD_SERVICE_SINGLE_USER_API_KEY=a uvicorn --host localhost --port 60620 ophyd_service.server:app


The API can be accessed as following:: 

    http GET http://localhost:60620/api/ping 'Authorization: ApiKey a'

The API that reads a device::    

    http GET http://localhost:60620/api/device/read/sim_periodic_device/sine 'Authorization: ApiKey a'


Running helper script for monitoring status::

    python status_monitor.py --api-key a

Running helper script for monitoring devices (devices are available in the demo profile)::

    python stream_monitor.py --api-key a --devices sim_periodic_device.noise sim_periodic_device.sine
    python stream_monitor.py --api-key a --devices rand_async_device2.value
    python stream_monitor.py --api-key a --devices rand_async_device1.value rand_async_device2.value

