Skip to content

Commit 628c88a

Browse files
authored
[Python SDK] Improve network configurability and add observable type (#749)
* Major refactor to support any combination of network interfaces for WirelessGoPro * Add observable / observer base type and use for asynchronous push notification operations * Maintain database of COHN credentials * Remove Python 3.10 and add 3.13 support
1 parent ffa42d4 commit 628c88a

File tree

124 files changed

+4082
-1850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4082
-1850
lines changed

.github/workflows/github-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ jobs:
121121
shell: bash
122122
run: sudo apt-get update && sudo apt install -y graphviz
123123

124-
- name: Set up Python 3.12.8
124+
- name: Set up Python 3.13.3
125125
uses: actions/setup-python@v5
126126
with:
127-
python-version: 3.12.8
127+
python-version: 3.13.3
128128

129129
- name: Restore cached pip environment
130130
uses: actions/cache@v4
131131
with:
132132
path: ${{ matrix.path }}
133-
key: ${{ runner.os }}-3.12.8-pip-${{ hashFiles('demos/python/sdk_wireless_camera_control/poetry.lock') }}
133+
key: ${{ runner.os }}-3.13.3-pip-${{ hashFiles('demos/python/sdk_wireless_camera_control/poetry.lock') }}
134134
restore-keys: |
135135
${{ runner.os }}-pip-
136136

.github/workflows/publish_python_sdk.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
- name: Checkout repository
1515
uses: actions/checkout@v4
1616

17-
- name: Set up Python 3.12.8
17+
- name: Set up Python 3.13.3
1818
uses: actions/setup-python@v5
1919
with:
20-
python-version: 3.12.8
20+
python-version: 3.13.3
2121

2222
- name: Install poetry
2323
uses: abatilo/actions-poetry@v4

.github/workflows/python_sdk_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
os: [windows-latest, macos-latest, ubuntu-latest]
24-
python-version: ['3.10', '3.11', '3.12']
24+
python-version: ['3.11', '3.12', '3.13']
2525
include:
2626
- os: ubuntu-latest
2727
path: ~/.cache/pip
@@ -65,9 +65,9 @@ jobs:
6565

6666
# Only test docs with latest Python on ubuntu since we need graphviz
6767
- name: Full linting only on ubuntu with latest python
68-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
68+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
6969
working-directory: ./demos/python/sdk_wireless_camera_control/
70-
run: nox -p 3.12 -s format lint docstrings docs
70+
run: nox -p 3.13 -s format lint docstrings docs
7171

7272
- name: Archive test report on failure
7373
uses: actions/upload-artifact@v4

demos/python/sdk_wireless_camera_control/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
**/*db.json
12
**/*.crt
23
**/*.jpg
34
**/*.mp4
5+
**/*.gpmf
46
**/temp
57

68
# Docs output
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12.8
1+
3.13.3

demos/python/sdk_wireless_camera_control/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Complete documentation can be found on [Open GoPro](https://gopro.github.io/Ope
4242

4343
## Installation
4444

45-
> Note! This package requires Python >= 3.10 and < 3.13 and only supports GoPros that
45+
> Note! This package requires Python >= 3.11 and < 3.14 and only supports GoPros that
4646
> [implement the OGP API](https://gopro.github.io/OpenGoPro/ble/#supported-cameras)
4747
4848
The minimal install to use the Open GoPro library and the CLI demos is:
Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
2-
# TODO
3-
4-
## General
5-
6-
- [ ] Generate BLE and HTTP API from specs (OpenAPI, protobuf, etc.)
7-
- [ ] Better handle kwargs that match base dict args in command as_dict methods
8-
- [ ] More test coverage
9-
- [ ] Clean up artifacts after testing. Or use temp directory.
10-
- [ ] Make scalable for multiple simultaneous cameras
11-
- [ ] Allow encoding = False for Set Livestream Mode. Requires tracking livestream state to not pend on encoding started after sending Set Shutter On
12-
- [ ] Add textual TUI
13-
14-
## Documentation
15-
16-
- [ ] Figure out autodoc type alias in `conf.py`
17-
- [ ] Make graphviz requirement optional for local builds
18-
19-
## BLE
20-
21-
- [ ] Add services view to GattDB
22-
- [ ] Make bleak wrapper write with / without response configurable
23-
- [ ] Add option to read values during service discovery
24-
25-
## WiFi
26-
27-
- [ ] Investigate MacOS delay after connecting WiFi
28-
- [ ] More Linux testing
29-
- [ ] Use descriptors for main driver access to OS-driver implementation
30-
- [ ] Move to program language (C?) instead of EN-US
31-
32-
1+
# TODO
2+
3+
## Rearchitecture
4+
5+
- One GoPro object; not wired and wireless
6+
- Connections can be added / removed at any time; not just configured at instantiation
7+
- all constants, protos, settings, etc. should come from one import
8+
- create per-endpoint, etc operations that mux between BLE and HTTP
9+
- same for settings. HTTP should be able to get an individual setting.
10+
- Inject database interface to remove TinyDB dependency

demos/python/sdk_wireless_camera_control/docs/api.rst

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,24 @@ These should not be imported directly and instead should be accessed using the r
7373
.. autoclass:: open_gopro.api.http_settings.HttpSettings
7474
:show-inheritance:
7575

76+
Abstracted Features
77+
-------------------
78+
79+
.. automodule:: open_gopro.features.cohn_feature
80+
81+
.. automodule:: open_gopro.features.access_point_feature
82+
7683
Base Types
7784
----------
7885

79-
.. automodule:: open_gopro.types
86+
.. automodule:: open_gopro.domain.types
8087

8188
GoPro Enum
8289
^^^^^^^^^^
8390

84-
.. autoclass:: open_gopro.enum.GoProEnum
91+
.. autoclass:: open_gopro.domain.enum.GoProEnum
8592

86-
.. autoclass:: open_gopro.enum.GoProIntEnum
93+
.. autoclass:: open_gopro.domain.enum.GoProIntEnum
8794

8895
BLE Setting
8996
^^^^^^^^^^^
@@ -121,25 +128,38 @@ Message Bases
121128
These are the base types that are used to implement version-specific API's. These are published for reference
122129
but the end user should never need to use these directly.
123130

124-
.. autoclass:: open_gopro.communicator_interface.Message
131+
.. autoclass:: open_gopro.domain.communicator_interface.Message
125132
:show-inheritance:
126133

127-
.. autoclass:: open_gopro.communicator_interface.HttpMessage
134+
.. autoclass:: open_gopro.domain.communicator_interface.HttpMessage
128135
:show-inheritance:
129136

130-
.. autoclass:: open_gopro.communicator_interface.BleMessage
137+
.. autoclass:: open_gopro.domain.communicator_interface.BleMessage
131138
:show-inheritance:
132139

133-
.. autoclass:: open_gopro.communicator_interface.Messages
140+
.. autoclass:: open_gopro.domain.communicator_interface.Messages
134141
:show-inheritance:
135142

136-
.. autoclass:: open_gopro.communicator_interface.BleMessages
143+
.. autoclass:: open_gopro.domain.communicator_interface.BleMessages
137144
:show-inheritance:
138145

139-
.. autoclass:: open_gopro.communicator_interface.HttpMessages
146+
.. autoclass:: open_gopro.domain.communicator_interface.HttpMessages
140147
:show-inheritance:
141148

142-
.. autoclass:: open_gopro.communicator_interface.MessageRules
149+
.. autoclass:: open_gopro.domain.communicator_interface.MessageRules
150+
151+
Observables
152+
^^^^^^^^^^^
153+
154+
.. automodule:: open_gopro.domain.observable
155+
:show-inheritance:
156+
157+
.. autoclass:: open_gopro.domain.gopro_observable.GoproObserverDistinctInitial
158+
:show-inheritance:
159+
160+
.. autoclass:: open_gopro.domain.gopro_observable.GoProObservable
161+
:show-inheritance:
162+
:inherited-members:
143163

144164
Responses
145165
=========
@@ -190,6 +210,8 @@ These are the various models that are returned in responses, used in commands, e
190210

191211
.. autopydantic_model:: open_gopro.models.general.SupportedOption
192212

213+
.. autopydantic_model:: open_gopro.models.general.CohnInfo
214+
193215
.. autoclass:: open_gopro.models.general.ScheduledCapture
194216

195217
Constants
@@ -201,60 +223,60 @@ These can be imported as:
201223
202224
from open_gopro import constants
203225
204-
.. automodule:: open_gopro.constants
226+
.. automodule:: open_gopro.models.constants
205227
:undoc-members:
206228
:exclude-members: CmdType, GoProEnumMeta, GoProFlagEnum, ProducerType, ResponseType, enum_factory
207229

208-
.. automodule:: open_gopro.constants.constants
230+
.. automodule:: open_gopro.models.constants.constants
209231
:undoc-members:
210232

211-
.. automodule:: open_gopro.constants.settings
233+
.. automodule:: open_gopro.models.constants.settings
212234
:undoc-members:
213235

214-
.. automodule:: open_gopro.constants.statuses
236+
.. automodule:: open_gopro.models.constants.statuses
215237
:undoc-members:
216238

217239
Exceptions
218240
==========
219241

220-
.. automodule:: open_gopro.exceptions
242+
.. automodule:: open_gopro.domain.exceptions
221243
:undoc-members:
222244

223245
Common Interface
224246
================
225247

226-
.. automodule:: open_gopro.parser_interface
248+
.. automodule:: open_gopro.domain.parser_interface
227249

228250
.. autoclass:: open_gopro.gopro_base.GoProBase
229251

230-
.. autoclass:: open_gopro.communicator_interface.GoProBle
252+
.. autoclass:: open_gopro.domain.communicator_interface.GoProBle
231253

232-
.. autoclass:: open_gopro.communicator_interface.GoProHttp
254+
.. autoclass:: open_gopro.domain.communicator_interface.GoProHttp
233255

234-
.. autoclass:: open_gopro.communicator_interface.GoProWifi
256+
.. autoclass:: open_gopro.domain.communicator_interface.GoProWifi
235257

236-
.. autoclass:: open_gopro.communicator_interface.GoProWiredInterface
258+
.. autoclass:: open_gopro.domain.communicator_interface.GoProWiredInterface
237259

238-
.. autoclass:: open_gopro.communicator_interface.GoProWirelessInterface
260+
.. autoclass:: open_gopro.domain.communicator_interface.GoProWirelessInterface
239261

240-
.. autoclass:: open_gopro.communicator_interface.BaseGoProCommunicator
262+
.. autoclass:: open_gopro.domain.communicator_interface.BaseGoProCommunicator
241263

242264

243265
BLE Interface
244266
=============
245267

246-
.. automodule:: open_gopro.ble.controller
268+
.. automodule:: open_gopro.network.ble.controller
247269

248-
.. automodule:: open_gopro.ble.client
270+
.. automodule:: open_gopro.network.ble.client
249271

250272
BLEServices
251273
-----------
252274

253-
.. automodule:: open_gopro.ble.services
275+
.. automodule:: open_gopro.network.ble.services
254276

255277
WiFi Interface
256278
==============
257279

258-
.. automodule:: open_gopro.wifi.controller
280+
.. automodule:: open_gopro.network.wifi.controller
259281

260-
.. automodule:: open_gopro.wifi.client
282+
.. automodule:: open_gopro.network.wifi.client

demos/python/sdk_wireless_camera_control/docs/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ All notable changes to this project will be documented in this file.
99
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
1010
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
1111

12+
0.20.0 (May-12-2025)
13+
--------------------
14+
* NOTE! This is a major update and includes breaking API changes
15+
* Major refactor to support any combination of network interfaces for WirelessGoPro
16+
* Add observable / observer base type and use for asynchronous push notification operations
17+
* Maintain database of COHN credentials
18+
* Remove Python 3.10 and add 3.13 support
19+
1220
0.19.8 (April-30-2025)
1321
----------------------
1422
* Default ainput printer arg to None to support non-terminal applications without access to stdout

0 commit comments

Comments
 (0)