From 89f23917720aa5802139052c1f7b83bd37501237 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Tue, 16 Jul 2024 11:01:58 +0200 Subject: [PATCH] Rename package to `commons-codec` --- README.md | 43 ++++++++++++------- pyproject.toml | 10 ++--- setup.py | 2 +- src/{data_x => commons_codec}/__init__.py | 0 .../decode/__init__.py | 0 .../decode/airrohr.py | 2 +- .../decode/tasmota.py | 0 .../decode/tts_ttn.py | 0 .../transform/__init__.py | 0 .../transform/dynamodb.py | 2 +- .../util/__init__.py | 0 src/{data_x => commons_codec}/util/data.py | 0 src/{data_x => commons_codec}/util/io.py | 0 .../vendor/__init__.py | 0 .../vendor/boto3/__init__.py | 0 .../vendor/boto3/dynamodb/__init__.py | 0 .../vendor/boto3/dynamodb/types.py | 0 tests/decode/test_airrohr.py | 4 +- tests/decode/test_tasmota.py | 4 +- tests/decode/test_tts_ttn.py | 6 +-- tests/transform/test_dynamodb.py | 2 +- tests/transform/test_dynamodb_types.py | 2 +- tests/util/test_data.py | 2 +- 23 files changed, 46 insertions(+), 33 deletions(-) rename src/{data_x => commons_codec}/__init__.py (100%) rename src/{data_x => commons_codec}/decode/__init__.py (100%) rename src/{data_x => commons_codec}/decode/airrohr.py (97%) rename src/{data_x => commons_codec}/decode/tasmota.py (100%) rename src/{data_x => commons_codec}/decode/tts_ttn.py (100%) rename src/{data_x => commons_codec}/transform/__init__.py (100%) rename src/{data_x => commons_codec}/transform/dynamodb.py (98%) rename src/{data_x => commons_codec}/util/__init__.py (100%) rename src/{data_x => commons_codec}/util/data.py (100%) rename src/{data_x => commons_codec}/util/io.py (100%) rename src/{data_x => commons_codec}/vendor/__init__.py (100%) rename src/{data_x => commons_codec}/vendor/boto3/__init__.py (100%) rename src/{data_x => commons_codec}/vendor/boto3/dynamodb/__init__.py (100%) rename src/{data_x => commons_codec}/vendor/boto3/dynamodb/types.py (100%) diff --git a/README.md b/README.md index 7939966..ee86aa1 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,35 @@ -# Data-X +# commons-codec -[![Tests](https://github.com/daq-tools/data-x/actions/workflows/tests.yml/badge.svg)](https://github.com/daq-tools/data-x/actions/workflows/tests.yml) -[![Coverage](https://codecov.io/gh/daq-tools/data-x/branch/main/graph/badge.svg)](https://app.codecov.io/gh/daq-tools/data-x) -[![Build status (documentation)](https://readthedocs.org/projects/data-x/badge/)](https://cratedb.com/docs/data-x/) -[![PyPI Version](https://img.shields.io/pypi/v/data-x.svg)](https://pypi.org/project/data-x/) -[![Python Version](https://img.shields.io/pypi/pyversions/data-x.svg)](https://pypi.org/project/data-x/) -[![PyPI Downloads](https://pepy.tech/badge/data-x/month)](https://pepy.tech/project/data-x/) -[![Status](https://img.shields.io/pypi/status/data-x.svg)](https://pypi.org/project/data-x/) -[![License](https://img.shields.io/pypi/l/data-x.svg)](https://pypi.org/project/data-x/) +[![Tests](https://github.com/daq-tools/commons-codec/actions/workflows/tests.yml/badge.svg)](https://github.com/daq-tools/commons-codec/actions/workflows/tests.yml) +[![Coverage](https://codecov.io/gh/daq-tools/commons-codec/branch/main/graph/badge.svg)](https://app.codecov.io/gh/daq-tools/commons-codec) +[![Build status (documentation)](https://readthedocs.org/projects/commons-codec/badge/)](https://cratedb.com/docs/commons-codec/) +[![PyPI Version](https://img.shields.io/pypi/v/commons-codec.svg)](https://pypi.org/project/commons-codec/) +[![Python Version](https://img.shields.io/pypi/pyversions/commons-codec.svg)](https://pypi.org/project/commons-codec/) +[![PyPI Downloads](https://pepy.tech/badge/commons-codec/month)](https://pepy.tech/project/commons-codec/) +[![Status](https://img.shields.io/pypi/status/commons-codec.svg)](https://pypi.org/project/commons-codec/) +[![License](https://img.shields.io/pypi/l/commons-codec.svg)](https://pypi.org/project/commons-codec/) ## About Data decoding, encoding, conversion, and translation utilities. +> A codec is a device or computer program that encodes or decodes a data stream or signal. +> Codec is a portmanteau of coder/decoder. +> +> A coder or encoder encodes a data stream or a signal for transmission or storage, +> [...], and the decoder function reverses the encoding for playback or editing. +> +> -- https://en.wikipedia.org/wiki/Codec + ## Details A collection of reusable utilities with minimal dependencies for transcoding purposes, mostly collected from other projects like [Kotori] and [LorryStream], -in order to provide them per standalone package. +in order to provide them per standalone package for broader use cases. ## Installation -The package is available from [PyPI] at [data-x]. +The package is available from [PyPI] at [commons-codec]. To install the most recent version, run: ```shell -pip install --upgrade data-x +pip install --upgrade commons-codec ``` ## License @@ -31,12 +39,17 @@ deviating licenses may apply. Please check for detailed license information within the header sections of relevant files. ## Contributing -The `data-x` package is an open source project, and is -[managed on GitHub](https://github.com/daq-tools/data-x). +The `commons-codec` package is an open source project, and is +[managed on GitHub](https://github.com/daq-tools/commons-codec). We appreciate contributions of any kind. +## Etymology +The [Apache Commons Codec] library was the inspiration for the name. Otherwise, +both libraries' ingredients don't have anything in common, yet. + -[data-x]: https://pypi.org/project/data-x/ +[Apache Commons Codec]: https://commons.apache.org/proper/commons-codec/ +[commons-codec]: https://pypi.org/project/commons-codec/ [Kotori]: https://github.com/daq-tools/kotori [LorryStream]: https://github.com/daq-tools/lorrystream/ [PyPI]: https://pypi.org/ diff --git a/pyproject.toml b/pyproject.toml index 9d74a2c..7198098 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ ] [project] -name = "data-x" +name = "commons-codec" description = "Data decoding, encoding, conversion, and translation utilities." readme = "README.md" keywords = [ @@ -114,8 +114,8 @@ optional-dependencies.test = [ "pytest-cov<6", "pytest-mock<4", ] -urls.changelog = "https://github.com/daq-tools/data-x/blob/main/CHANGES.md" -urls.repository = "https://github.com/daq-tools/data-x" +urls.changelog = "https://github.com/daq-tools/commons-codec/blob/main/CHANGES.md" +urls.repository = "https://github.com/daq-tools/commons-codec" [tool.black] line-length = 120 @@ -192,7 +192,7 @@ pythonpath = [ ] testpaths = [ "examples", - "data_x", + "commons_codec", "tests", ] python_files = [ @@ -226,7 +226,7 @@ exclude_lines = [ [tool.mypy] mypy_path = "src" -packages = [ "data_x" ] +packages = [ "commons_codec" ] exclude = [ ] check_untyped_defs = true diff --git a/setup.py b/setup.py index 3d35cf6..1190055 100644 --- a/setup.py +++ b/setup.py @@ -3,4 +3,4 @@ import setuptools if __name__ == "__main__": - setuptools.setup(name="data-x") + setuptools.setup(name="commons-codec") diff --git a/src/data_x/__init__.py b/src/commons_codec/__init__.py similarity index 100% rename from src/data_x/__init__.py rename to src/commons_codec/__init__.py diff --git a/src/data_x/decode/__init__.py b/src/commons_codec/decode/__init__.py similarity index 100% rename from src/data_x/decode/__init__.py rename to src/commons_codec/decode/__init__.py diff --git a/src/data_x/decode/airrohr.py b/src/commons_codec/decode/airrohr.py similarity index 97% rename from src/data_x/decode/airrohr.py rename to src/commons_codec/decode/airrohr.py index 3f8c83b..1b61bfd 100644 --- a/src/data_x/decode/airrohr.py +++ b/src/commons_codec/decode/airrohr.py @@ -3,7 +3,7 @@ import json from collections import OrderedDict -from data_x.util.data import is_number +from commons_codec.util.data import is_number class AirrohrDecoder: diff --git a/src/data_x/decode/tasmota.py b/src/commons_codec/decode/tasmota.py similarity index 100% rename from src/data_x/decode/tasmota.py rename to src/commons_codec/decode/tasmota.py diff --git a/src/data_x/decode/tts_ttn.py b/src/commons_codec/decode/tts_ttn.py similarity index 100% rename from src/data_x/decode/tts_ttn.py rename to src/commons_codec/decode/tts_ttn.py diff --git a/src/data_x/transform/__init__.py b/src/commons_codec/transform/__init__.py similarity index 100% rename from src/data_x/transform/__init__.py rename to src/commons_codec/transform/__init__.py diff --git a/src/data_x/transform/dynamodb.py b/src/commons_codec/transform/dynamodb.py similarity index 98% rename from src/data_x/transform/dynamodb.py rename to src/commons_codec/transform/dynamodb.py index 7669d0b..63be726 100644 --- a/src/data_x/transform/dynamodb.py +++ b/src/commons_codec/transform/dynamodb.py @@ -9,7 +9,7 @@ import simplejson as json import toolz -from data_x.vendor.boto3.dynamodb.types import TypeDeserializer +from commons_codec.vendor.boto3.dynamodb.types import TypeDeserializer logger = logging.getLogger(__name__) diff --git a/src/data_x/util/__init__.py b/src/commons_codec/util/__init__.py similarity index 100% rename from src/data_x/util/__init__.py rename to src/commons_codec/util/__init__.py diff --git a/src/data_x/util/data.py b/src/commons_codec/util/data.py similarity index 100% rename from src/data_x/util/data.py rename to src/commons_codec/util/data.py diff --git a/src/data_x/util/io.py b/src/commons_codec/util/io.py similarity index 100% rename from src/data_x/util/io.py rename to src/commons_codec/util/io.py diff --git a/src/data_x/vendor/__init__.py b/src/commons_codec/vendor/__init__.py similarity index 100% rename from src/data_x/vendor/__init__.py rename to src/commons_codec/vendor/__init__.py diff --git a/src/data_x/vendor/boto3/__init__.py b/src/commons_codec/vendor/boto3/__init__.py similarity index 100% rename from src/data_x/vendor/boto3/__init__.py rename to src/commons_codec/vendor/boto3/__init__.py diff --git a/src/data_x/vendor/boto3/dynamodb/__init__.py b/src/commons_codec/vendor/boto3/dynamodb/__init__.py similarity index 100% rename from src/data_x/vendor/boto3/dynamodb/__init__.py rename to src/commons_codec/vendor/boto3/dynamodb/__init__.py diff --git a/src/data_x/vendor/boto3/dynamodb/types.py b/src/commons_codec/vendor/boto3/dynamodb/types.py similarity index 100% rename from src/data_x/vendor/boto3/dynamodb/types.py rename to src/commons_codec/vendor/boto3/dynamodb/types.py diff --git a/tests/decode/test_airrohr.py b/tests/decode/test_airrohr.py index 7e37e4e..59801ba 100644 --- a/tests/decode/test_airrohr.py +++ b/tests/decode/test_airrohr.py @@ -3,8 +3,8 @@ import logging import typing as t -from data_x.decode.airrohr import AirrohrDecoder -from data_x.util.data import jd +from commons_codec.decode.airrohr import AirrohrDecoder +from commons_codec.util.data import jd logger = logging.getLogger(__name__) diff --git a/tests/decode/test_tasmota.py b/tests/decode/test_tasmota.py index 7f4802d..a09a329 100644 --- a/tests/decode/test_tasmota.py +++ b/tests/decode/test_tasmota.py @@ -3,8 +3,8 @@ import logging import pytest -from data_x.decode.tasmota import TasmotaSensorDecoder, TasmotaStateDecoder -from data_x.util.data import jd +from commons_codec.decode.tasmota import TasmotaSensorDecoder, TasmotaStateDecoder +from commons_codec.util.data import jd logger = logging.getLogger(__name__) diff --git a/tests/decode/test_tts_ttn.py b/tests/decode/test_tts_ttn.py index d56d208..88eaa83 100644 --- a/tests/decode/test_tts_ttn.py +++ b/tests/decode/test_tts_ttn.py @@ -21,9 +21,9 @@ import logging -from data_x.decode.tts_ttn import TheThingsStackDecoder -from data_x.util.data import jd -from data_x.util.io import read_jsonfile +from commons_codec.decode.tts_ttn import TheThingsStackDecoder +from commons_codec.util.data import jd +from commons_codec.util.io import read_jsonfile logger = logging.getLogger(__name__) diff --git a/tests/transform/test_dynamodb.py b/tests/transform/test_dynamodb.py index 4975625..949ce3b 100644 --- a/tests/transform/test_dynamodb.py +++ b/tests/transform/test_dynamodb.py @@ -1,7 +1,7 @@ import decimal import pytest -from data_x.transform.dynamodb import DynamoCDCTranslatorCrateDB +from commons_codec.transform.dynamodb import DynamoCDCTranslatorCrateDB READING_BASIC = {"device": "foo", "temperature": 42.42, "humidity": 84.84} diff --git a/tests/transform/test_dynamodb_types.py b/tests/transform/test_dynamodb_types.py index c818fd9..9260527 100644 --- a/tests/transform/test_dynamodb_types.py +++ b/tests/transform/test_dynamodb_types.py @@ -14,7 +14,7 @@ from decimal import Decimal import pytest -from data_x.vendor.boto3.dynamodb.types import Binary, TypeDeserializer +from commons_codec.vendor.boto3.dynamodb.types import Binary, TypeDeserializer class TestBinary(unittest.TestCase): diff --git a/tests/util/test_data.py b/tests/util/test_data.py index a0ed7e7..15b46d8 100644 --- a/tests/util/test_data.py +++ b/tests/util/test_data.py @@ -1,6 +1,6 @@ from decimal import Decimal -from data_x.util.data import is_number +from commons_codec.util.data import is_number def test_is_number_numeric():