Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Feat/multiple backends + rename (#10)
Browse files Browse the repository at this point in the history
install optional deps for workflows

oauth api for offline backend - companion PR to OpenVoiceOS/ovos-personal-backend#36

add oauth, companion PR OpenVoiceOS/ovos-personal-backend#36

split oauth api from device api,

split metrics api from device api

split dataset api from device api

split email api from device api

offline backend support

split backends into their own modules for cleanliness

rename to ovos-backend-client

add database helper + compat with device db personal backend UI

comparison table in readme

optional requirements.txt

handle missing timezone data

rename + AbstractBackend support

api registry concept

signal breaking change in versioning
  • Loading branch information
JarbasAl authored Oct 4, 2022
1 parent db8f6da commit 1fe7f24
Show file tree
Hide file tree
Showing 34 changed files with 2,324 additions and 768 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- dev
paths-ignore:
- 'selene_api/version.py'
- 'ovos_backend_client/version.py'
- 'test/**'
- 'examples/**'
- '.github/**'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notify_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
token: ${{ secrets.MATRIX_TOKEN }}
channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org'
message: |
new selene_api PR merged! https://github.com/OpenVoiceOS/selene_api/pull/${{ github.event.number }}
new ovos_backend_client PR merged! https://github.com/OpenVoiceOS/ovos-backend-client/pull/${{ github.event.number }}
2 changes: 1 addition & 1 deletion .github/workflows/publish_alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- dev
paths-ignore:
- 'selene_api/version.py'
- 'ovos_backend_client/version.py'
- 'test/**'
- 'examples/**'
- '.github/**'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- dev
paths-ignore:
- 'selene_api/version.py'
- 'ovos_backend_client/version.py'
- 'requirements/**'
- 'examples/**'
- '.github/**'
Expand All @@ -20,7 +20,7 @@ on:
branches:
- master
paths-ignore:
- 'selene_api/version.py'
- 'ovos_backend_client/version.py'
- 'requirements/**'
- 'examples/**'
- '.github/**'
Expand Down Expand Up @@ -52,13 +52,13 @@ jobs:
python -m pip install build wheel
- name: Install core repo
run: |
pip install .
pip install .[offline]
- name: Install test dependencies
run: |
pip install pytest pytest-timeout pytest-cov
- name: Run unittests
run: |
pytest --cov=selene_api --cov-report xml test/unittests
pytest --cov=ovos_backend_client --cov-report xml test/unittests
# NOTE: additional pytest invocations should also add the --cov-append flag
# or they will overwrite previous invocations' coverage reports
# (for an example, see OVOS Skill Manager's workflow)
Expand Down
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# Selene Api
# OVOS Backend Api

Unofficial python api for interaction with https://api.mycroft.ai , also compatible
with [ovos-local-backend](https://github.com/OpenVoiceOS/OVOS-local-backend)
Python client library for interaction with several supported backends under a single unified interface

- Personal backend - [self hosted](https://github.com/OpenVoiceOS/OVOS-local-backend)
- Selene - https://api.mycroft.ai
- Offline - support for setting your own api keys and query services directly

## Backend Overview

| API | Offline | Personal | Selene |
|-----------|---------|----------|--------|
| Admin | yes [1] | yes | no |
| Device | yes [2] | yes | yes |
| Metrics | yes [2] | yes | yes |
| Dataset | yes [2] | yes | yes |
| OAuth | yes [2] | yes | yes |
| Wolfram | yes [3] | yes | yes |
| Geolocate | yes | yes | yes |
| STT | yes [3] | yes | yes |
| Weather | yes [3] | yes | yes |
| Email | yes [3] | yes | yes |


[1] will update user level mycroft.conf
[2] shared json database with personal backend for UI compat
[3] needs additional configuration (eg. credentials)

Will only work if running in a device paired with mycroft, a valid identity2.json must exist

## STT

Expand All @@ -12,7 +34,7 @@ a companion stt plugin is available - [ovos-stt-plugin-selene](https://github.co
## Geolocation

```python
from selene_api.api import GeolocationApi
from ovos_backend_client.api import GeolocationApi

geo = GeolocationApi()
data = geo.get_geolocation("Lisbon Portugal")
Expand All @@ -26,7 +48,7 @@ data = geo.get_geolocation("Lisbon Portugal")
## OpenWeatherMap Proxy

```python
from selene_api.api import OpenWeatherMapApi
from ovos_backend_client.api import OpenWeatherMapApi

owm = OpenWeatherMapApi()
data = owm.get_weather()
Expand All @@ -36,7 +58,7 @@ data = owm.get_weather()
## Wolfram Alpha proxy

```python
from selene_api.api import WolframAlphaApi
from ovos_backend_client.api import WolframAlphaApi

wolf = WolframAlphaApi()
answer = wolf.spoken("what is the speed of light")
Expand All @@ -51,7 +73,7 @@ data = wolf.full_results("2+2")
To interact with skill settings on selene

```python
from selene_api.settings import RemoteSkillSettings
from ovos_backend_client.settings import RemoteSkillSettings

# in ovos-core skill_id is deterministic and safe
s = RemoteSkillSettings("skill.author")
Expand All @@ -78,7 +100,7 @@ s.upload()
by hijacking skill settings we allows storing arbitrary data in selene and use it across devices and skills

```python
from selene_api.cloud import SeleneCloud
from ovos_backend_client.cloud import SeleneCloud

cloud = SeleneCloud()
cloud.add_entry("test", {"secret": "NOT ENCRYPTED MAN"})
Expand All @@ -88,7 +110,7 @@ data = cloud.get_entry("test")
an encrypted version is also supported if you dont trust selene!

```python
from selene_api.cloud import SecretSeleneCloud
from ovos_backend_client.cloud import SecretSeleneCloud

k = "D8fmXEP5VqzVw2HE" # you need this to read back the data
cloud = SecretSeleneCloud(k)
Expand All @@ -104,7 +126,7 @@ since local backend does not provide a web ui a [admin api](https://github.com/O
can be used to manage your devices

```python
from selene_api.api import AdminApi
from ovos_backend_client.api import AdminApi

admin = AdminApi("secret_admin_key")
uuid = "..." # check identity2.json in the device you want to manage
Expand Down
5 changes: 5 additions & 0 deletions ovos_backend_client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ovos_backend_client.api import DeviceApi, WolframAlphaApi, OpenWeatherMapApi, STTApi, GeolocationApi
from ovos_backend_client.cloud import SeleneCloud, SecretSeleneCloud
from ovos_backend_client.config import RemoteConfigManager
from ovos_backend_client.pairing import is_paired, has_been_paired, check_remote_pairing, PairingManager
from ovos_backend_client.settings import RemoteSkillSettings
Loading

0 comments on commit 1fe7f24

Please sign in to comment.