semvec/pypi-packages huggingface dataset:
hubaxle 0.1.8
Control interface for the GL Hub
License: MIT
Requires Python: <4.0,>=3.11

# HubAxle - control interface for the GL Hub

Exposes an HTTP API for controlling the GL Hub.

There are several primary functions:

- Update the configuration files which the GL Runtime is consuming
- Monitor status of the GL Runtime
- Discover and set up cameras that are accessible to the hub

# Command-line tools

- `poetry run discover-cameras` - discover cameras on the local network
- `poetry run launch-service` - start the hubaxle service


# Using it.

1. Set up a user by setting the `HUB_LOGINS` env var to `username:password`
   Either do this through the balena dashboard, or by running
```
docker compose up -e HUB_LOGINS="username:password" hubaxle
```

2. Open the port on the hubaxle container.  (port 8000 inside the container, port 80 on the host)

3. Open `/admin/` page, and authenticate with your login

4. Create a config entry called `runtime.yaml`
5. Watch as the glruntime container does what you tell it to!

## Testing

```
poetry run pytest
```

## Development:

If it's awkward to set the `HUB_LOGINS` env var, you can also run

```
./src/manage.py createsuperuser
```

from the hubaxle container, and then you can log in with the credentials you set.

### API Development
Using DRF-spectacular, we completely auto-generate the Open-api spec and then in turn use that to autogenerate a client library using Openapi-generator. We then provide a thin wrapper around the client library to make it easier to use.

To generate the api-spec and the client library, inside the src directory run:

```
make generate-api
```

A couple of notes:
- This means that schema.yaml should NEVER be manually edited.
- Inside the autogenerated client library, we generate classes with the exact same name as the the Django models, and, by default, the exact same fields. Note this if there are any fields that you want to keep private.
However, this model provides increased clarity, the data that you send in as a request maps extremely directly onto the model that the backend deals with