Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
- Fixes #7: CoT Time/Start/Stale timestamps aren't actually ISO-8601.
- Fixes #8: Add readthedocs documentation site.
- Fixes #9: Move setup.py metadata to setup.cfg
- Fixes #10: Add additional test targets: Python 3.11 & 3.12
  • Loading branch information
ampledata committed Jan 10, 2024
1 parent 685d7b8 commit 92ce917
Show file tree
Hide file tree
Showing 14 changed files with 186 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-test_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ redis-server/
__pycache__
.ipynb_checkpoints/
config.ini
.python-version
17 changes: 17 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

mkdocs:
configuration: mkdocs.yml

python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 Sensors & Signals LLC
Copyright Sensors & Signals LLC https://www.snstac.com
Copyright 2020 Delta Bravo-15 <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2023 Sensors & Signals LLC
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
# limitations under the License.
#
# Author:: Greg Albrecht <[email protected]>
# Copyright:: Copyright 2023 Sensors & Signals LLC
# Copyright:: Copyright Sensors & Signals LLC https://www.snstac.com
# License:: Apache License, Version 2.0
#

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Authors

Copyright
=========
* Copyright 2023 Sensors & Signals LLC
* Copyright Sensors & Signals LLC https://www.snstac.com
* Copyright 2020 Delta Bravo-15 <[email protected]>


Expand All @@ -185,7 +185,7 @@ Python Black, otherwise Google, then PEP-8.

License
=======
Copyright 2023 Sensors & Signals LLC
Copyright Sensors & Signals LLC https://www.snstac.com

Copyright 2020 Delta Bravo-15 <[email protected]>

Expand Down
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

![ATAK Screenshot with PyTAK Logo.](atak_screenshot_with_pytak_logo-x25.jpg)

# TAKProto - Python TAK Protocol Module

TAKProto is a Python module for encoding & decoding TAK Protocol Protobuf packets.

23 changes: 23 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
click
ghp-import
griffe
importlib-metadata
jinja2
markdown
markdown-include
markupsafe
mergedeep
mkdocs
mkdocs-autorefs
mkdocs-include-markdown-plugin
mkdocs-material
mkdocstrings-python
mkdocstrings[python]
packaging
pymdown-extensions
pyparsing
python-dateutil
pyyaml
pyyaml-env-tag
six
zipp
29 changes: 29 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
site_name: TAKProto - A Python TAK Protocol Protobuf Module
site_url: https://takproto.rtfd.io/
repo_url: https://github.com/snstac/takproto/
site_description: A Python module to encode & decode 'TAK Protocol Payload - Version 1' Protocol Buffer based Cursor on Target (CoT) messages.
site_author: Greg Albrecht <[email protected]>
copyright: Copyright Sensors & Signals LLC https://www.snstac.com

theme:
name: material
highlightjs: true

plugins:
- include-markdown:
opening_tag: "{!"
closing_tag: "!}"
- search
- mkdocstrings:
handlers:
# See: https://mkdocstrings.github.io/python/usage/
python:
options:
docstring_style: sphinx

markdown_extensions:
- markdown_include.include:
base_path: .
- admonition
- toc:
permalink: True
86 changes: 86 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Setup for the Python TAK Protocol Packet - Version 1 Module.
#
# Copyright Sensors & Signals LLC https://www.snstac.com
# Copyright 2020 Delta Bravo-15
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#


[metadata]
name = takproto
version = attr: takproto.__version__
url = https://github.com/snstac/takproto
project_urls =
CI: GitHub Actions = https://github.com/snstac/takproto/actions
GitHub: issues = https://github.com/snstac/takproto/issues
GitHub: repo = https://github.com/snstac/takproto
description = A Python module to encode & decode 'TAK Protocol Payload - Version 1' Protocol Buffer based Cursor on Target (CoT) messages.
long_description = file: README.rst
long_description_content_type = text/x-rst
maintainer = Greg Albrecht <[email protected]>
maintainer_email = [email protected]
license = MIT License
license_files = LICENSE
classifiers =
License :: OSI Approved :: MIT License
Intended Audience :: Developers
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Development Status :: 5 - Production/Stable
Operating System :: POSIX
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows
Operating System :: OS Independent
keywords =
Cursor on Target
CoT
ATAK
TAK
WinTAK
iTAK
TAK Server
TAKX
Protobuf


[options]
python_requires = >=3.6, <4
packages = takproto
package_dir =
adsbcot = takproto
install_requires =
protobuf >= 4.21.0
delimited-protobuf >= 1.0.0


[options.extras_require]
test =
pytest-cov
pylint
flake8
black
61 changes: 4 additions & 57 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2023 Sensors & Signals LLC
# Copyright Sensors & Signals LLC https://www.snstac.com
# Copyright 2020 Delta Bravo-15
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -26,63 +26,10 @@

"""Setup for the Python TAK Protocol Packet - Version 1 Module.
:license: MIT License
:source: <https://github.com/snstac/takproto>
"""

import os
import sys
from setuptools import setup

import setuptools

__title__ = "takproto"
__version__ = "2.0.0"
__license__ = "MIT License"


def publish():
"""Publish this package to pypi."""
if sys.argv[-1] == "publish":
os.system("python setup.py sdist")
os.system("twine upload dist/*")
sys.exit()


publish()


def read_readme(readme_file="README.rst") -> str:
"""Read the contents of the README file for use as a long_description."""
readme: str = ""
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, readme_file), encoding="UTF-8") as rmf:
readme = rmf.read()
return readme


setuptools.setup(
version=__version__,
name=__title__,
packages=[__title__, f"{__title__}.proto"],
package_dir={__title__: __title__, f"{__title__}.proto":f"{__title__}/proto"},
url=f"https://github.com/snstac/{__title__}",
description=(
"A Python module to encode & decode 'TAK Protocol Payload - Version 1'"
" Protocol Buffer based Cursor on Target (CoT) messages."
),
author="Greg Albrecht",
author_email="[email protected]",
package_data={"": ["LICENSE"]},
license="MIT License",
long_description=read_readme(),
long_description_content_type="text/x-rst",
zip_safe=False,
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
keywords=["Cursor on Target", "ATAK", "TAK", "CoT", "WinTAK", "iTAK"],
install_requires=["protobuf >= 4.21.0", "delimited-protobuf >= 1.0.0"],
)
if __name__ == "__main__":
setup()
10 changes: 6 additions & 4 deletions takproto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2023 Sensors & Signals LLC
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,14 +22,16 @@
# SOFTWARE.
#

"""TAKProto Module.
"""A Python module to encode & decode 'TAK Protocol Payload - Version 1' Protocol Buffer based Cursor on Target (CoT) messages.
:author: Greg Albrecht <[email protected]>
:copyright: Copyright 2023 Sensors & Signals LLC
:copyright: Copyright Sensors & Signals LLC https://www.snstac.com
:license: MIT License
:source: <https://github.com/snstac/takproto>
"""

__version__ = "2.1.0-beta1"

from .functions import ( # NOQA
xml2proto,
parse_proto,
Expand All @@ -40,6 +42,6 @@
from .constants import TAKProtoVer # NOQA

__author__ = "Greg Albrecht <[email protected]>"
__copyright__ = "Copyright 2023 Sensors & Signals LLC"
__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com"
__license__ = "MIT License"
__source__ = "https://github.com/snstac/takproto"
10 changes: 6 additions & 4 deletions takproto/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2023 Sensors & Signals LLC
# Copyright Sensors & Signals LLC https://www.snstac.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,18 +27,20 @@
from enum import Enum

__author__ = "Greg Albrecht <[email protected]>"
__copyright__ = "Copyright 2023 Sensors & Signals LLC"
__copyright__ = "Copyright Sensors & Signals LLC https://www.snstac.com"
__license__ = "Apache License, Version 2.0"


DEFAULT_PROTO_HEADER = bytearray(b"\xbf")
DEFAULT_MESH_HEADER = bytearray(b"\xbf\x01\xbf")
ISO_8601_UTC = "%Y-%m-%dT%H:%M:%S.%fZ"

W3C_XML_DATETIME: str = "%Y-%m-%dT%H:%M:%S.%fZ"
ISO_8601_UTC = W3C_XML_DATETIME # Issue 7: Not technically correct.


class TAKProtoVer(Enum):
"""Enumerator for TAK Protocol Versions."""

XML = 0
MESH = 1
STREAM = 2
2 changes: 1 addition & 1 deletion takproto/functions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2023 Sensors & Signals LLC
# Copyright Sensors & Signals LLC https://www.snstac.com
# Copyright 2020 Delta Bravo-15 <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down

0 comments on commit 92ce917

Please sign in to comment.