-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c6ffb44
Showing
21 changed files
with
1,384 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: detect-private-key | ||
- id: check-merge-conflict | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-builtin-literals | ||
|
||
- repo: https://github.com/asottile/setup-cfg-fmt | ||
rev: v1.16.0 | ||
hooks: | ||
- id: setup-cfg-fmt | ||
|
||
- repo: https://github.com/dizballanze/gray | ||
rev: v0.10.1 | ||
hooks: | ||
- id: gray |
Large diffs are not rendered by default.
Oops, something went wrong.
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,65 @@ | ||
REQUIREMENTS_TXT ?= requirements.txt requirements-dev.txt | ||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: help dev test | ||
include Makefile.venv | ||
Makefile.venv: | ||
curl \ | ||
-o Makefile.fetched \ | ||
-L "https://github.com/sio/Makefile.venv/raw/v2020.08.14/Makefile.venv" | ||
echo "5afbcf51a82f629cd65ff23185acde90ebe4dec889ef80bbdc12562fbd0b2611 *Makefile.fetched" \ | ||
| sha256sum --check - \ | ||
&& mv Makefile.fetched Makefile.venv | ||
|
||
help: # Help for the Makefile | ||
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
|
||
dev: venv ## Create the virtualenv with all the requirements installed | ||
|
||
docs: build | ||
cp README.rst docs/readme.rst | ||
cp Changelog docs/changelog.rst | ||
tox -edocs | ||
|
||
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts | ||
|
||
clean-build: ## remove build artifacts | ||
rm -fr build/ | ||
rm -fr dist/ | ||
rm -fr .eggs/ | ||
find . -name '*.egg-info' -exec rm -fr {} + | ||
find . -name '*.egg' -exec rm -f {} + | ||
|
||
clean-pyc: ## remove Python file artifacts | ||
find . -name '*.pyc' -exec rm -f {} + | ||
find . -name '*.pyo' -exec rm -f {} + | ||
find . -name '*~' -exec rm -f {} + | ||
find . -name '__pycache__' -exec rm -fr {} + | ||
|
||
clean-test: ## remove test and coverage artifacts | ||
rm -fr .tox/ | ||
rm -f .coverage | ||
rm -fr htmlcov/ | ||
rm -fr .pytest_cache | ||
|
||
coverage: ## check code coverage quickly with the default Python | ||
coverage run --source aprsd_weewx_plugin setup.py test | ||
coverage report -m | ||
coverage html | ||
$(BROWSER) htmlcov/index.html | ||
|
||
test: dev ## Run all the tox tests | ||
tox -p all | ||
|
||
build: test ## Make the build artifact prior to doing an upload | ||
$(VENV)/python3 setup.py sdist bdist_wheel | ||
$(VENV)/twine check dist/* | ||
|
||
upload: build ## Upload a new version of the plugin | ||
$(VENV)/twine upload dist/* | ||
|
||
check: dev ## Code format check with tox and pep8 | ||
tox -epep8 | ||
|
||
fix: dev ## fixes code formatting with gray | ||
tox -efmt |
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,99 @@ | ||
APRSD Weewx Plugin | ||
=================== | ||
|
||
|PyPI| |Status| |Python Version| |License| | ||
|
||
|Read the Docs| |Tests| |Codecov| | ||
|
||
|pre-commit| | ||
|
||
.. |PyPI| image:: https://img.shields.io/pypi/v/aprsd-weewx-plugin.svg | ||
:target: https://pypi.org/project/aprsd-weewx-plugin/ | ||
:alt: PyPI | ||
.. |Status| image:: https://img.shields.io/pypi/status/aprsd-weewx-plugin.svg | ||
:target: https://pypi.org/project/aprsd-weewx-plugin/ | ||
:alt: Status | ||
.. |Python Version| image:: https://img.shields.io/pypi/pyversions/aprsd-weewx-plugin | ||
:target: https://pypi.org/project/aprsd-weewx-plugin | ||
:alt: Python Version | ||
.. |License| image:: https://img.shields.io/pypi/l/aprsd-weewx-plugin | ||
:target: https://opensource.org/licenses/GNU GPL v3.0 | ||
:alt: License | ||
.. |Read the Docs| image:: https://img.shields.io/readthedocs/aprsd-weewx-plugin/latest.svg?label=Read%20the%20Docs | ||
:target: https://aprsd-weewx-plugin.readthedocs.io/ | ||
:alt: Read the documentation at https://aprsd-weewx-plugin.readthedocs.io/ | ||
.. |Tests| image:: https://github.com/hemna/aprsd-weewx-plugin/workflows/Tests/badge.svg | ||
:target: https://github.com/hemna/aprsd-weewx-plugin/actions?workflow=Tests | ||
:alt: Tests | ||
.. |Codecov| image:: https://codecov.io/gh/hemna/aprsd-weewx-plugin/branch/main/graph/badge.svg | ||
:target: https://codecov.io/gh/hemna/aprsd-weewx-plugin | ||
:alt: Codecov | ||
.. |pre-commit| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white | ||
:target: https://github.com/pre-commit/pre-commit | ||
:alt: pre-commit | ||
|
||
|
||
Features | ||
-------- | ||
|
||
* TODO | ||
|
||
|
||
Requirements | ||
------------ | ||
|
||
* TODO | ||
|
||
|
||
Installation | ||
------------ | ||
|
||
You can install *APRSD Weewx Plugin * via pip_ from PyPI_: | ||
.. code:: console | ||
$ pip install aprsd-weewx-plugin | ||
Usage | ||
----- | ||
|
||
Please see the `Command-line Reference <Usage_>`_ for details. | ||
|
||
|
||
Contributing | ||
------------ | ||
|
||
Contributions are very welcome. | ||
To learn more, see the `Contributor Guide`_. | ||
|
||
|
||
License | ||
------- | ||
|
||
Distributed under the terms of the `GNU GPL v3.0 license`_, | ||
*APRSD Weewx Plugin * is free and open source software. | ||
|
||
Issues | ||
------ | ||
|
||
If you encounter any problems, | ||
please `file an issue`_ along with a detailed description. | ||
|
||
|
||
Credits | ||
------- | ||
|
||
This project was generated from `@hemna`_'s `APRSD Plugin Python Cookiecutter`_ template. | ||
|
||
.. _@hemna: https://github.com/hemna | ||
.. _Cookiecutter: https://github.com/audreyr/cookiecutter | ||
.. _GNU GPL v3.0 license: https://opensource.org/licenses/GNU GPL v3.0 | ||
.. _PyPI: https://pypi.org/ | ||
.. _APRSD Plugin Python Cookiecutter: https://github.com/hemna/cookiecutter-aprsd-plugin | ||
.. _file an issue: https://github.com/hemna/aprsd-weewx-plugin/issues | ||
.. _pip: https://pip.pypa.io/ | ||
.. github-only | ||
.. _Contributor Guide: CONTRIBUTING.rst | ||
.. _Usage: https://aprsd-weewx-plugin.readthedocs.io/en/latest/usage.html |
Empty file.
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,54 @@ | ||
import logging | ||
|
||
from aprsd import messaging, plugin, trace | ||
|
||
|
||
LOG = logging.getLogger("APRSD") | ||
|
||
|
||
class WeewxMQTTPlugin(plugin.APRSDRegexCommandPluginBase): | ||
|
||
version = "1.0" | ||
# Look for any command that starts with w or W | ||
command_regex = "^[wW]" | ||
# the command is for ? | ||
command_name = "weather" | ||
|
||
enabled = False | ||
|
||
def setup(self): | ||
# Do some checks here? | ||
self.enabled = True | ||
|
||
def create_threads(self): | ||
"""This allows you to create and return a custom APRSDThread object. | ||
Create a child of the aprsd.threads.APRSDThread object and return it | ||
It will automatically get started. | ||
You can see an example of one here: | ||
https://github.com/craigerl/aprsd/blob/master/aprsd/threads.py#L141 | ||
""" | ||
if self.enabled: | ||
# You can create a background APRSDThread object here | ||
# Just return it for example: | ||
# https://github.com/hemna/aprsd-weewx-plugin/blob/master/aprsd_weewx_plugin/aprsd_weewx_plugin.py#L42-L50 | ||
# | ||
return [] | ||
|
||
@trace.trace | ||
def process(self, packet): | ||
|
||
"""This is called when a received packet matches self.command_regex.""" | ||
|
||
LOG.info("WeewxMQTTPlugin Plugin") | ||
|
||
packet.get("from") | ||
packet.get("message_text", None) | ||
|
||
if self.enabled: | ||
# Now we can process | ||
return "some reply message" | ||
else: | ||
LOG.warning("WeewxMQTTPlugin is disabled.") | ||
return messaging.NULL |
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 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = python -msphinx | ||
SPHINXPROJ = aprsd_weewx_plugin | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
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 @@ | ||
.. include:: ../AUTHORS.rst |
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,22 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Removes temporary Sphinx build artifacts to ensure a clean build. | ||
This is needed if the Python source being documented changes significantly. Old sphinx-apidoc | ||
RST files can be left behind. | ||
""" | ||
|
||
import shutil | ||
from pathlib import Path | ||
|
||
|
||
def main() -> None: | ||
docs_dir = Path(__file__).resolve().parent | ||
for folder in ("_build", "apidoc"): | ||
delete_dir = docs_dir / folder | ||
if delete_dir.exists(): | ||
shutil.rmtree(delete_dir) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.