diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..1475800 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,70 @@ +# This workflow will upload a Python Package to PyPI when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Build release distributions + run: | + # NOTE: put your own distribution build steps here. + python -m pip install build + python -m build + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: release-dists + path: dist/ + + pypi-publish: + runs-on: ubuntu-latest + needs: + - release-build + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + + # Dedicated environments with protections for publishing are strongly recommended. + # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules + environment: + name: pypi + # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: + url: https://pypi.org/p/pyadsb + # + # ALTERNATIVE: if your GitHub Release name is the PyPI project version string + # ALTERNATIVE: exactly, uncomment the following line instead: + # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@v4 + with: + name: release-dists + path: dist/ + + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ diff --git a/README.md b/README.md index 2f8a05e..5e3dcf0 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ # adsb ADSB and Mode-S decoder/encoder -Example usage: decoding messages given either as `bytes` or `int`: +The `Adsb` class provides `parse` and `encode` functions for creating `Adsb` objects from a bytes object, and encoding an object to bytes respectively. + +The `Tracker` class implements a simple aircraft tracker that detects vehicles and collects and updates information about them. The `Tracker` class is meant primarily as an example application. + +Example: decoding messages given either as `bytes` or `int`: ``` from adsb import Adsb + print(Adsb.parse(0x8D40621D58C382D690C8AC2863A7)) print(Adsb.parse(b'\x8D\x48\x40\xD6\x20\x2C\xC3\x71\xC3\x2C\xE0\x57\x60\x98') ``` -Example usage: tracking aircrafts: +Example: tracking aircrafts: ``` from adsb import Tracker + tracker = Tracker() for msg in readline(): m = Adsb.parse(msg.strip().encode()) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5d07588 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,27 @@ +[project] +name = "pyadsb" +version = "0.0.1" +authors = [ + { name="Oskar Enoksson", email="enok@lysator.liu.se" }, +] +description = "Functionality for encoding/decoding ADSB messages written in pure Python 3" +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.8", + "Topic :: Software Development :: Libraries :: Python Modules", +] +license = { file = "LICENSE" } +keywords = [ "adsb", "aircrafts" ] + +[project.urls] +Homepage = "https://github.com/enok71/adsb" +Issues = "https://github.com/enok71/adsb/issues" +Documentation = "https://github.com/enok71/adsb/wiki" + +[build-system] +requires = ["setuptools>=61"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..336fbd7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,37 @@ +[metadata] +name = pyadsb +version = 0.0.1 +author = Oskar Enoksson +author_email = enok@lysator.liu.se +url = https://github.com/enok71/adsb +description = Functionality for encoding/decoding ADSB messages written in pure Python 3 +long_description = file: README.md +long_description_content_type = text/markdown +license_file = LICENSE +keywords = + adsb, aircrafts +project_urls = + Homepage = https://github.com/enok71/adsb + Issues = https://github.com/enok71/adsb/issues + Documentation = https://github.com/enok71/adsb/wiki +classifiers = + Programming Language :: Python :: 3 + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python :: 3.8 + Topic :: Software Development :: Libraries :: Python Modules + +[options] +package_dir = + = src +packages = find: +include_package_data = true +python_requires = >=3.8 + +[bdist_wheel] +universal = 1 + +[pylint] +disable = + missing-module-docstring, + fixme, diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7201448 --- /dev/null +++ b/setup.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +import setuptools + +if __name__ == "__main__": + setuptools.setup() +