From 9b4b548896183ded7e4684c8ea8089af3e775a13 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 15 Nov 2018 07:09:35 +0000 Subject: [PATCH] Packaging --- implementations/python/.gitignore | 3 +++ implementations/python/Makefile | 16 ++++++++----- implementations/python/preserves/__init__.py | 8 +++++++ .../python/{ => preserves}/preserves.py | 0 .../python/{ => preserves}/test_preserves.py | 2 +- implementations/python/setup.py | 24 +++++++++++++++++++ 6 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 implementations/python/preserves/__init__.py rename implementations/python/{ => preserves}/preserves.py (100%) rename implementations/python/{ => preserves}/test_preserves.py (99%) create mode 100644 implementations/python/setup.py diff --git a/implementations/python/.gitignore b/implementations/python/.gitignore index 8aa07c2..b214146 100644 --- a/implementations/python/.gitignore +++ b/implementations/python/.gitignore @@ -1,3 +1,6 @@ *.pyc .coverage htmlcov/ +build/ +dist/ +*.egg-info/ diff --git a/implementations/python/Makefile b/implementations/python/Makefile index f0d4c6d..9481d59 100644 --- a/implementations/python/Makefile +++ b/implementations/python/Makefile @@ -1,14 +1,18 @@ test: - python2 -m unittest test_preserves - python3 -m unittest test_preserves + python2 -m unittest preserves.test_preserves + python3 -m unittest preserves.test_preserves coverage: - python2-coverage run --branch -m unittest test_preserves - python3-coverage run --branch -m unittest test_preserves + python2-coverage run --branch -m unittest preserves.test_preserves + python3-coverage run --branch -m unittest preserves.test_preserves python3-coverage html clean: rm -rf htmlcov - rm -rf __pycache__ - rm -f *.pyc + find . -iname __pycache__ -o -iname '*.pyc' | xargs rm -rf rm -f .coverage + rm -rf preserves.egg-info build dist + +publish: + python3 setup.py sdist bdist_wheel + twine upload dist/* diff --git a/implementations/python/preserves/__init__.py b/implementations/python/preserves/__init__.py new file mode 100644 index 0000000..2d44921 --- /dev/null +++ b/implementations/python/preserves/__init__.py @@ -0,0 +1,8 @@ +from .preserves import Float, Symbol, Record, ImmutableDict + +from .preserves import DecodeError, EncodeError + +from .preserves import Decoder, Encoder + +from .preserves import Stream, ValueStream, SequenceStream, SetStream, DictStream +from .preserves import BinaryStream, StringStream, SymbolStream diff --git a/implementations/python/preserves.py b/implementations/python/preserves/preserves.py similarity index 100% rename from implementations/python/preserves.py rename to implementations/python/preserves/preserves.py diff --git a/implementations/python/test_preserves.py b/implementations/python/preserves/test_preserves.py similarity index 99% rename from implementations/python/test_preserves.py rename to implementations/python/preserves/test_preserves.py index c9415ac..c0e6767 100644 --- a/implementations/python/test_preserves.py +++ b/implementations/python/preserves/test_preserves.py @@ -1,4 +1,4 @@ -from preserves import * +from .preserves import * import unittest if isinstance(chr(123), bytes): diff --git a/implementations/python/setup.py b/implementations/python/setup.py new file mode 100644 index 0000000..922cbf7 --- /dev/null +++ b/implementations/python/setup.py @@ -0,0 +1,24 @@ +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +setup( + name="preserves", + version="0.0.0", + author="Tony Garnock-Jones", + author_email="tonyg@leastfixedpoint.com", + license="GNU General Public License v3 or later (GPLv3+)", + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Programming Language :: Python :: 3", + ], + packages=["preserves"], + url="https://gitlab.com/tonyg/preserves", + description="Experimental data serialization format", + install_requires=[], + python_requires=">=3.6, <4", +)