Metadata-Version: 2.1
Name: sr.comp.http
Version: 1.7.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
License: UNKNOWN
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
Platform: UNKNOWN
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.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Requires-Python: >=3.7
Requires-Dist: sr.comp (<2,>=1.2)
Requires-Dist: Flask (<2.3,>=1)
Requires-Dist: Werkzeug (<3,>=2)
Requires-Dist: simplejson (<4,>=3.6)
Requires-Dist: python-dateutil (<3,>=2.2)
Requires-Dist: typing-extensions (<5,>=3.7.4.2)

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 <http://srobo.org>`__ competition
software.

This repository provides a JSON API to accessing information about the
state of the competition. It is a lightweight
`Flask <http://flask.pocoo.org/>`__ 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


