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

Commit

Permalink
Bugfix: Fix missing dependencies and add actions (#42)
Browse files Browse the repository at this point in the history
* Add github actions scaffolding

* Add missing dependencies

* Add black check to action

* Add missing openCV dependency

* Feature: Deploy docs (#44)

* Fix unnecessary dotenv remains

* Remove unnecessary imports

* Add license metadata in pyproject

* Add pre-commit dependency

* Add link to docs

Co-authored-by: Oskar Söderberg <[email protected]>
  • Loading branch information
m4reko and OskarSoderberg authored Aug 15, 2022
1 parent 12a6d70 commit 8494241
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 8 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: website

# build the documentation whenever there are new commits on main
on:
push:
branches:
- main

# security: restrict permissions for CI jobs.
permissions:
contents: read

jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3

- run: pip install -e .[doc]
- run: pdoc -o docs/ glasses3

- uses: actions/upload-pages-artifact@v1
with:
path: docs/

# Deploy the artifact to GitHub pages.
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v1
36 changes: 36 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, lint and check formatting
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "main", "dev" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- name: Lint with pyflakes
run: |
pyflakes src tests examples
- name: Black check
run: |
black --check .
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# g3pylib

**This library is still in alpha. It's not yet feature complete.**

A Python client for Glasses3. It handles all the low level details of communication with the Glasses3 websocket API and exposes a Python API which includes all the endpoints in the websocket API of the Glasses3 as well as some extra convenience methods. It also implements streaming with RTSP and service discovery with Zeroconf.

## Installation

For the moment we only support _Python 3.10_.

To install this package, clone it and use either

`flit install`
Expand All @@ -16,7 +20,12 @@ To run examples or tests you need some extra dependencies which are installed by

`pip install '.[test, examples, example-app]'`

## Documentation

The library documentation can be found here: https://tobiipro.github.io/g3pylib/

## Environment

The tests and examples load the glasses hostname, which by default is the serial number, from the `.env` file in the project root folder.
See example content below:

Expand All @@ -27,11 +36,13 @@ G3_HOSTNAME=tg03b-080200045321
You can also specify this variable directly in your environment.

## Examples

The [example folder](examples) contains a few smaller examples showcasing different use cases of the library as well as a larger controller application with a simple GUI.

Run the example app with `python examples/g3pycontroller`.

## Contributing

More information on how to contribute to this project can be found in [CONTRIBUTING.md](CONTRIBUTING.md).

It contains developer guidelines as well as information on how to run tests and enable logging.
5 changes: 0 additions & 5 deletions examples/g3pycontroller/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import asyncio
import logging
import os
from typing import List, Optional, Set, Tuple, cast

import dotenv
from eventkinds import AppEventKind, ControlEventKind
from kivy.app import App
from kivy.core.window import Window
Expand All @@ -24,9 +22,6 @@

logging.basicConfig(level=logging.DEBUG)

dotenv.load_dotenv() # type: ignore
g3_hostname = os.environ["G3_HOSTNAME"]

# fmt: off
Builder.load_string("""
#:import NoTransition kivy.uix.screenmanager.NoTransition
Expand Down
13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ classifiers = [
"Private :: Do Not Upload"
]
requires-python = ">=3.10"
license = {file = "LICENSE.txt"}
dependencies = [
"websockets ~= 10.3",
"zeroconf ~= 0.38.7",
"aiortsp @ git+https://github.com/m4reko/aiortsp@master"
"aiortsp @ git+https://github.com/m4reko/aiortsp@master",
"av ~= 9.2.0"
]
dynamic = ["version", "description"]

Expand All @@ -34,9 +36,14 @@ test = [
doc = ["pdoc"]
dev = [
"isort",
"black"
"black",
"pyflakes",
"pre-commit"
]
examples = [
"python-dotenv",
"opencv-python"
]
examples = ["python-dotenv"]
example-app = ["kivy ~= 2.1.0"]

[project.urls]
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ python-dotenv
pytest
pytest-dotenv
pytest-asyncio
pyflakes
opencv-python
black
isort

0 comments on commit 8494241

Please sign in to comment.