Skip to content

Commit 43de2c6

Browse files
committed
rewrite for new pytak
1 parent a588542 commit 43de2c6

13 files changed

+329
-352
lines changed

.github/workflows/debian.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ jobs:
3030
3131
- name: Build Debian/Apt bdist_deb
3232
run: |
33+
export REPO_NAME=$(echo ${github.repository} | awk -F"/" '{print $2}')
3334
python3 setup.py --command-packages=stdeb.command bdist_deb
3435
ls -al deb_dist/
35-
cp deb_dist/python3-aprscot_*_all.deb deb_dist/python3-aprscot_latest_all.deb
36+
cp deb_dist/python3-${REPO_NAME}_*_all.deb deb_dist/python3-${REPO_NAME}_latest_all.deb
3637
3738
- uses: actions/upload-artifact@master
3839
with:

.github/workflows/python-publish.yml renamed to .github/workflows/python-publish_to_pypi.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
2+
name: Publish package to PyPI
33

4-
name: Publish package to PYPI
5-
6-
on: push
4+
on:
5+
push:
6+
tags:
7+
- '*'
78

89
jobs:
910
deploy:
@@ -12,23 +13,18 @@ jobs:
1213

1314
steps:
1415
- uses: actions/checkout@v2
15-
1616
- name: Set up Python
1717
uses: actions/setup-python@v2
1818
with:
1919
python-version: '3.x'
20-
2120
- name: Install dependencies
2221
run: |
23-
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
22+
python3 -m pip install --upgrade pip
23+
python3 -m pip install setuptools wheel twine
2624
- name: Build
2725
run: |
28-
python setup.py sdist bdist_wheel
29-
26+
python3 setup.py sdist bdist_wheel
3027
- name: Publish package
31-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
3228
uses: pypa/gh-action-pypi-publish@release/v1
3329
with:
3430
user: __token__

.github/workflows/python-test.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint & Test Code
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: [3.6, 3.7, 3.8, 3.9]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install test requirements
25+
run: |
26+
make install_test_requirements
27+
- name: Install package itself (editable)
28+
run: |
29+
make editable
30+
- name: Lint with pylint
31+
run: |
32+
make pylint
33+
- name: Lint with flake8
34+
run: |
35+
make flake8
36+
- name: Test with pytest-cov
37+
run: |
38+
make test_cov

Makefile

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
1-
# Makefile for Python APRS Cursor-on-Target Gateway.
21
#
3-
# Source:: https://github.com/ampledata/aprscot
2+
# Copyright 2022 Greg Albrecht <oss@undef.net>
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
416
# Author:: Greg Albrecht W2GMD <oss@undef.net>
517
# Copyright:: Copyright 2022 Greg Albrecht
618
# License:: Apache License, Version 2.0
719
#
820

9-
21+
this_app = aprscot
1022
.DEFAULT_GOAL := all
1123

24+
all: editable
1225

13-
all: develop
14-
15-
install_requirements:
16-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
26+
develop:
27+
python3 setup.py develop
1728

18-
install_requirements_test:
19-
pip install -r requirements_test.txt
29+
editable:
30+
python3 -m pip install -e .
2031

21-
develop:
22-
pip install -e .
32+
install_test_requirements:
33+
python3 -m pip install -r requirements_test.txt
2334

2435
install:
25-
python setup.py install
36+
python3 setup.py install
2637

2738
uninstall:
28-
pip uninstall -y aprscot
39+
python3 -m pip uninstall -y $(this_app)
2940

3041
reinstall: uninstall install
3142

32-
remember_test:
33-
@echo
34-
@echo "Hello from the Makefile..."
35-
@echo "Don't forget to run: 'make install_requirements_test'"
36-
@echo
43+
publish:
44+
python3 setup.py publish
3745

3846
clean:
3947
@rm -rf *.egg* build dist *.py[oc] */*.py[co] cover doctest_pypi.cfg \
4048
nosetests.xml pylint.log output.xml flake8.log tests.log \
41-
test-result.xml htmlcov fab.log .coverage */__pycache__/
42-
43-
# Publishing:
49+
test-result.xml htmlcov fab.log .coverage __pycache__ \
50+
*/__pycache__
4451

45-
build: remember_test
46-
python3 -m build --sdist --wheel
47-
48-
twine_check: remember_test build
49-
twine check dist/*
50-
51-
upload: remember_test build
52-
twine upload dist/*
53-
54-
publish: build twine_check upload
55-
56-
# Tests:
57-
58-
pep8: remember_test
59-
# flake8 --max-complexity 12 --exit-zero *.py */*.py
60-
# stop the build if there are Python syntax errors or undefined names
61-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
62-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
63-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
52+
pep8:
53+
flake8 --max-line-length=88 --extend-ignore=E203 --exit-zero $(this_app)/*.py
6454

6555
flake8: pep8
6656

67-
lint: remember_test
57+
lint:
6858
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
69-
-r n *.py */*.py || exit 0
59+
--max-line-length=88 -r n $(this_app)/*.py || exit 0
7060

7161
pylint: lint
7262

73-
pytest: remember_test
63+
checkmetadata:
64+
python3 setup.py check -s --restructuredtext
65+
66+
mypy:
67+
mypy --strict .
68+
69+
pytest:
7470
pytest
7571

76-
test: lint pep8 pytest
72+
test: editable install_test_requirements pytest
73+
74+
test_cov:
75+
pytest --cov=$(this_app)
76+
77+
black:
78+
black .

aprscot/__init__.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3-
4-
# APRS Cursor-on-Target Gateway.
3+
#
4+
# Copyright 2022 Greg Albrecht <oss@undef.net>
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Author:: Greg Albrecht W2GMD <oss@undef.net>
17+
#
518

619
"""
720
APRS Cursor-on-Target Gateway.
821
~~~~
922
10-
1123
:author: Greg Albrecht W2GMD <oss@undef.net>
1224
:copyright: Copyright 2022 Greg Albrecht
1325
:license: Apache License, Version 2.0
1426
:source: <https://github.com/ampledata/aprscot>
15-
1627
"""
1728

18-
from .constants import (LOG_FORMAT, LOG_LEVEL, DEFAULT_APRSIS_PORT, # NOQA
19-
DEFAULT_COT_TYPE, DEFAULT_COT_STALE,
20-
DEFAULT_APRSIS_HOST, DEFAULT_APRSIS_CALLSIGN,
21-
DEFAULT_APRSIS_FILTER)
22-
23-
from .functions import aprs_to_cot # NOQA
29+
from .constants import ( # NOQA
30+
LOG_FORMAT,
31+
LOG_LEVEL,
32+
DEFAULT_APRSIS_PORT,
33+
DEFAULT_COT_TYPE,
34+
DEFAULT_COT_STALE,
35+
DEFAULT_APRSIS_HOST,
36+
DEFAULT_APRSIS_CALLSIGN,
37+
DEFAULT_APRSIS_FILTER,
38+
)
39+
40+
from .functions import aprs_to_cot, create_tasks # NOQA
2441

2542
from .classes import APRSWorker # NOQA
2643

0 commit comments

Comments
 (0)