Metadata-Version: 2.4
Name: sr.comp.http
Version: 1.11.0
Summary: HTTP API for Student Robotics Competition Software
Home-page: https://github.com/PeterJCLaw/srcomp-http
Author: Student Robotics Competition Software SIG
Author-email: srobo-devel@googlegroups.com
Project-URL: Documentation, https://srcomp-http.readthedocs.org/
Project-URL: Code, https://github.com/PeterJCLaw/srcomp-http
Project-URL: Issue tracker, https://github.com/PeterJCLaw/srcomp-http/issues
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Requires-Python: >=3.10
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: sr.comp<2,>=1.14
Requires-Dist: Flask>=2.2
Requires-Dist: Werkzeug<4,>=2
Requires-Dist: simplejson<4,>=3.6
Requires-Dist: python-dateutil<3,>=2.2
Requires-Dist: typing-extensions<5,>=3.7.4.2
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

SR Comp HTTP
============

|Build Status| |Docs Status|

A HTTP interface around `SRComp <https://github.com/PeterJCLaw/srcomp/wiki/SRComp>`__,
the fifth round of `Student Robotics <https://studentrobotics.org>`__ competition
software.

This repository provides a JSON API to accessing information about the
state of the competition. It is a lightweight
`Flask <https://palletsprojects.com/p/flask/>`__ application wrapping the
`SRComp <https://github.com/PeterJCLaw/srcomp>`__ python
APIs to the competition state.

Usage
-----

**Install**:

.. code:: shell

    pip install sr.comp.http

**Configuration**

In deployment you should configure the app by setting the ``COMPSTATE`` key of
the app's config to the absolute path of the compstate which the server intends
to serve.

.. code:: python

    from sr.comp.http import app
    app.config['COMPSTATE'] = '/path/to/compstate'

Development
-----------

**Clone**:

For tests to work, you will need to clone the `tests/dummy` submodule too:

``git submodule update --init``

**Install**:

.. code:: shell

    pip install -e .

**Run**:
``./run $COMPSTATE``.

**Test**:
``./run-tests``

Developers may wish to use the `SRComp Dev`_ repo to setup a dev instance.

State Caching
~~~~~~~~~~~~~

Since loading a given state repo takes a non-trivial amount of time,
this is cached within the Flask application. Updates to the state repo
are not tracked directly, and must be signalled by running the
``./update`` script provided.


.. |Build Status| image:: https://circleci.com/gh/PeterJCLaw/srcomp-http.svg?style=svg
   :target: https://circleci.com/gh/PeterJCLaw/srcomp-http

.. |Docs Status| image:: https://readthedocs.org/projects/srcomp-http/badge/?version=latest
   :target: https://srcomp-http.readthedocs.org/

.. _`SRComp Dev`: https://github.com/PeterJCLaw/srcomp-dev
