Skip to content

Commit

Permalink
Add pyproject.toml, setup.py, .github/workflows/python-publish.yml an…
Browse files Browse the repository at this point in the history
…d setup.cfg
  • Loading branch information
Oskar Enoksson committed Dec 7, 2024
1 parent 331c722 commit 789f68c
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -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/
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

<b>Example</b>: 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:
<b>Example</b>: tracking aircrafts:
```
from adsb import Tracker
tracker = Tracker()
for msg in readline():
m = Adsb.parse(msg.strip().encode())
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
37 changes: 37 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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,
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python

import setuptools

if __name__ == "__main__":
setuptools.setup()

0 comments on commit 789f68c

Please sign in to comment.