From c881da5bd471422e132f2a16b1007ed8196ca430 Mon Sep 17 00:00:00 2001 From: Rolf van Kleef Date: Thu, 1 Nov 2018 20:04:10 +0100 Subject: [PATCH] Pypi release --- .gitignore | 3 +++ Pipfile | 1 + Pipfile.lock | 2 +- README.md | 22 +++++++++++++++++ dict_deserializer/__init__.py | 12 ++++++++++ .../annotations.py | 0 .../deserializer.py | 0 setup.py | 24 +++++++++++++++++++ test.py | 6 ++--- 9 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 README.md create mode 100644 dict_deserializer/__init__.py rename {serializer_utils => dict_deserializer}/annotations.py (100%) rename {serializer_utils => dict_deserializer}/deserializer.py (100%) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 74d61dd..7e38721 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /venv/ /.idea/ **/__pycache__/ +/build/ +*.egg-info/ +/dist/ diff --git a/Pipfile b/Pipfile index 860121d..209b976 100644 --- a/Pipfile +++ b/Pipfile @@ -5,6 +5,7 @@ name = "pypi" [packages] typeguard = "*" +setuptools = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index 5fe5bc4..a55f65e 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "712f72994a8ca388f3472a8e311f7ed87dc7a7c6ef243c92a51b11c572d5cdbc" + "sha256": "8140294700f02b0a15d82c0fe7af9c857657387011cb0a5c3f77d2b3bb981eef" }, "pipfile-spec": 6, "requires": { diff --git a/README.md b/README.md new file mode 100644 index 0000000..d103c47 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# Dictionary Deserializer + +Dictionary deserializer is a project built to convert dictionaries into +composite classes in an intuitive way. Special attention was also paid +to being friendly to static type-checkers and IDE autocompletes. + +## Limitations + +This library uses the `typing` module extensively. It does, however, only +support some of its types. This is a list of verified composite types: + +* `Union` (Including `Optional`) +* `List` +* `Any` + +It supports these types as terminal types: + +* `int` +* `float` +* `str` +* `NoneType` +* `bool` diff --git a/dict_deserializer/__init__.py b/dict_deserializer/__init__.py new file mode 100644 index 0000000..5ed86b7 --- /dev/null +++ b/dict_deserializer/__init__.py @@ -0,0 +1,12 @@ +from collections import namedtuple + +name = 'Dictionary deserializer' +version = '0.0.1' +description = "Dictionary deserializer is a package that aides in the " \ + "deserializing of JSON (or other structures) that are " \ + "converted to dicts, into composite classes." + +author = namedtuple('Author', ['name', 'email'])( + name='Rolf van Kleef', + email='pypi@rolfvankleef.nl' +) diff --git a/serializer_utils/annotations.py b/dict_deserializer/annotations.py similarity index 100% rename from serializer_utils/annotations.py rename to dict_deserializer/annotations.py diff --git a/serializer_utils/deserializer.py b/dict_deserializer/deserializer.py similarity index 100% rename from serializer_utils/deserializer.py rename to dict_deserializer/deserializer.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..41e8333 --- /dev/null +++ b/setup.py @@ -0,0 +1,24 @@ +import setuptools +import dict_deserializer + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name=dict_deserializer.name, + version=dict_deserializer.version, + author=dict_deserializer.author.name, + author_email=dict_deserializer.author.email, + description=dict_deserializer.description, + long_description=long_description, + long_description_content_type="text/markdown", + url="https://git.iapc.utwente.nl/rkleef/serializer_utils", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Topic :: Utilities", + "Development Status :: 4 - Beta", + ], +) diff --git a/test.py b/test.py index 27d0a4e..9b30512 100644 --- a/test.py +++ b/test.py @@ -1,8 +1,8 @@ from time import sleep from typing import Optional, List -from serializer_utils.deserializer import Deserializable, Rule -from serializer_utils.annotations import abstract, discriminate +from dict_deserializer.deserializer import Deserializable, Rule +from dict_deserializer.annotations import abstract, discriminate @abstract @@ -45,7 +45,7 @@ if __name__ == '__main__': import sys import traceback - from serializer_utils.deserializer import deserialize + from dict_deserializer.deserializer import deserialize def print_result(function, *args, **kwargs): try: -- GitLab