Skip to content

Commit

Permalink
Import project files
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed Feb 17, 2021
0 parents commit 73d317d
Show file tree
Hide file tree
Showing 14 changed files with 913 additions and 0 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: CI

on:
- push
- pull_request

env:
DEFAULT_PYTHON: 3.9

jobs:
black:
name: Check Black
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install Black
run: |
pip install black
- name: Run Black
run: |
black --check --diff openwrt/ubus
flake8:
name: Check Flake8
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install Flake8
run: |
pip install flake8
- name: Run Flake8
run: |
flake8 openwrt/ubus
isort:
name: Check isort
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install isort
run: |
pip install isort
- name: Run isort
run: |
isort --check-only openwrt/ubus
mypy:
name: Check Mypy
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install Mypy
run: |
pip install mypy
- name: Run mypy
run: |
mypy openwrt/ubus
pylint:
name: Check Pylint (Python ${{ matrix.python-version }})
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8, 3.9]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install Requirements
run: |
pip install -r requirements.txt
- name: Install Pylint
run: |
pip install pylint
- name: Run Pylint
run: |
pylint openwrt/ubus
32 changes: 32 additions & 0 deletions .github/workflows/matchers/pylint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"problemMatcher": [
{
"owner": "pylint-error",
"severity": "error",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
},
{
"owner": "pylint-warning",
"severity": "warning",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.egg-info
*.patch
*.pyc
dist
7 changes: 7 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[MESSAGES CONTROL]
disable =
too-few-public-methods,
too-many-arguments,
too-many-branches,
too-many-instance-attributes,
too-many-statements
24 changes: 24 additions & 0 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
openwrt-ubus-rpc is a Python module implementing an interface to the OpenWrt ubus RPC API.
It allows a user to perform Remote Procedure Calls (RPC) to the OpenWrt micro bus architecture (ubus).

Documentation for the OpenWrt ubus RPC API is available at https://openwrt.org/docs/techref/ubus and https://openwrt.org/docs/guide-developer/ubus.

This package has been developed to be used with https://home-assistant.io/ but it can be used in other contexts.

Disclaimer
----------

openwrt-ubus-rpc was created for my own use, and for others who may wish to experiment with personal Internet of Things systems.

This software is provided without warranty, according to the GNU Public Licence version 2, and should therefore not be used where it may endanger life, financial stakes or cause discomfort and inconvenience to others.

Usage
-----

```
from openwrt.ubus import Ubus
_ubus = Ubus(host="http://openwrt_host/ubus", user="openwrt_user", password="openwrt_password")
_ubus.connect()
_ubus.get_hostapd()
_ubus.get_hostapd_clients("hostapd.wlan0")
```
Loading

0 comments on commit 73d317d

Please sign in to comment.