-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update submodules & prepare for pypi distribution (#11)
- update submodules - update docs - use cibuildwheels to only build aarch64 wheels - check type hinting with mypy tool - update stubs - update CI workflows - allow for manually triggering the workflows. - match pylint problems to diff using github annotations. - trim sdist by manually specifying the MANIFEST - update scanner.py - change the version str for non-tagged commits - build CI upload sdist to testPyPi (only from main) - remove ninja from build reqs in toml
- Loading branch information
Showing
24 changed files
with
523 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"""Parse output from clang-tidy's stdout""" | ||
import argparse | ||
import pathlib | ||
import json | ||
from typing import Dict, Union, List | ||
import logging | ||
|
||
log_commander = logging.getLogger("PylintMatcher") | ||
log_commander.setLevel(logging.DEBUG) # be sure that log commands are output | ||
console_handler = logging.StreamHandler() # Create special stdout stream handler | ||
console_handler.setFormatter(logging.Formatter("%(message)s")) # no formatted log cmds | ||
log_commander.addHandler(console_handler) # Use special handler for log_commander | ||
log_commander.propagate = False # prevent duplicate messages in the parent logger obj | ||
|
||
|
||
def annotate_pylint_note(obj: Dict[str, Union[int, str]]) -> str: | ||
"""Translate a 1 notification from pylint to github's checks API. | ||
:param dict obj: The JSON object output by pylint (for 1 notification). | ||
A typical JSON object output from pylint looks like: | ||
.. code-block:: json | ||
{ | ||
"type": "error", | ||
"module": "basic_test", | ||
"obj": "", | ||
"line": 3, | ||
"column": 19, | ||
"path": "tests/basic_test.py", | ||
"symbol": "syntax-error", | ||
"message": "invalid syntax (<unknown>, line 3)", | ||
"message-id": "E0001" | ||
} | ||
:Returns: | ||
A `str` that can be used by github's workflow log commands. | ||
""" | ||
priority = { | ||
"convention": "notice", | ||
"refactor": "notice", | ||
"warning": "warning", | ||
"error": "error", | ||
"fatal": "error", | ||
} | ||
return ( | ||
"::{level} file={path},line={line},title={path}:{line}:{col} {symbol} [{code}]" | ||
"::{msg}".format( | ||
level=priority[obj["type"]], | ||
path=obj["path"], | ||
line=obj["line"], | ||
col=obj["column"], | ||
symbol=obj["symbol"], | ||
code=obj["message-id"], | ||
msg=obj["message"], | ||
) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
arg_parser = argparse.ArgumentParser() | ||
arg_parser.add_argument("json_output", type=pathlib.Path) | ||
args = arg_parser.parse_args() | ||
|
||
pylint_result: List[Dict[str, Union[int, str]]] = json.loads( | ||
pathlib.Path(args.json_output).read_text(encoding="utf-8") | ||
) | ||
for note in pylint_result: | ||
log_commander.info(annotate_pylint_note(note)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
name: Release Actions | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
upload-pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v1 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
python-version: 3.9 | ||
|
||
- name: Checkout Current Repo | ||
uses: actions/checkout@v1 | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
@@ -24,20 +25,38 @@ jobs: | |
sudo apt install python3-dev | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install -r requirements.txt | ||
python3 -m pip install twine | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: aarch64 | ||
|
||
- name: Build wheels with cibuildwheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_LINUX: aarch64 | ||
CIBW_SKIP: cp36* pp* cp311* | ||
|
||
- name: Move cross-compiled wheels to dist folder | ||
run: | | ||
mkdir -p dist | ||
mv ./wheelhouse/*.whl ${{ github.workspace }}/dist/ | ||
- name: build binary distributable wheel | ||
run: python setup.py bdist_wheel | ||
# sdist for non-supprted platforms will serve as a stub lib install | ||
run: python setup.py sdist | ||
|
||
- name: Save distributable wheels as artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: "pyRF24_pkg_dist" | ||
path: ${{ github.workspace }}/dist | ||
|
||
###### We need a self-hosted runner to build distributable wheels for armv7l | ||
# - name: Publish to PyPi | ||
# env: | ||
# TWINE_USERNAME: __token__ | ||
# TWINE_PASSWORD: ${{ secrets.pypi_token }} | ||
# run: | | ||
# twine upload dist/* | ||
- name: Publish to PyPi | ||
# only upload distributions to PyPi when triggered by a published release | ||
if: github.event_name == 'release' | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.pypi_token }} | ||
run: twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
recursive-include RF24* * | ||
recursive-include cmake * | ||
recursive-include src/pyrf24 *.cpp *.typed | ||
recursive-include pybind11 * | ||
recursive-exclude */.github * | ||
recursive-exclude */docs * | ||
recursive-exclude */examples* * | ||
recursive-exclude */images * | ||
recursive-exclude */tests * | ||
recursive-exclude */build * | ||
recursive-exclude */cmake/toolchains *.cmake | ||
recursive-exclude RF24/utility/AT* *.h *.cpp *.c | ||
recursive-exclude RF24/utility/Teensy *.h | ||
recursive-exclude RF24/utility/Template* *.h | ||
recursive-exclude RF24/utility/rp2 *.h *.cpp *.txt | ||
recursive-exclude RF24*/pyRF24* * | ||
recursive-exclude RF24Network/RPi/pyRF24Network * | ||
global-exclude .clang-format .clang-tidy .git* library.json library.properties Doxyfile keywords.txt Makefile* doxygen-custom.css **.yml **.yaml *.pdf .pylintrc | ||
exclude */*.md */README* RF24/utility/includes.h RF24/configure | ||
include pyproject.toml setup.py CMakeLists.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule RF24Mesh
updated
40 files
Submodule RF24Network
updated
43 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,3 @@ Indices and tables | |
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
Oops, something went wrong.