From 1b386747e70672c8fba5f99910eae83fcb341453 Mon Sep 17 00:00:00 2001 From: "timothy.mugayi" Date: Sat, 16 Nov 2019 15:48:49 +0800 Subject: [PATCH] package re-structure --- .travis.yml | 2 +- CONTRIBUTING.md | 35 +++++++++++++++++++ README.md | 4 +-- .../SQSClientExtended.py | 0 pysqs_extended_client/__init__.py | 2 ++ .../config.py | 0 setup.py | 27 ++++++++++---- sqs_client/__init__.py | 2 -- ...lient.py => test_pysqs_extended_client.py} | 4 +-- 9 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 CONTRIBUTING.md rename {sqs_client => pysqs_extended_client}/SQSClientExtended.py (100%) create mode 100644 pysqs_extended_client/__init__.py rename {sqs_client => pysqs_extended_client}/config.py (100%) delete mode 100644 sqs_client/__init__.py rename tests/{test_sqs_client.py => test_pysqs_extended_client.py} (82%) diff --git a/.travis.yml b/.travis.yml index 44cb623..d2be2f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - pip install codecov script: - - pytest -s --cov=sqs_client + - pytest -s --cov=pysqs_extended_client after_success: - codecov # submit coverage \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a8441ab --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing + +pysqs-extended-client uses GitHub to manage reviews of pull requests. + +* If you have a trivial fix or improvement, go ahead and create a pull request, + addressing (with `@...`) the maintainer of this repository (see + [MAINTAINERS](https://github.com/timothymugayi/boto3-sqs-extended-client-lib/graphs/contributors)). + +* If you plan to do something more involved, first discuss your ideas on + [by creating an issue]. This will avoid unnecessary work and surely give you and + us a good deal of inspiration. + +## Testing + +Submitted changes should pass the current tests, and be covered by new test +cases when adding functionality. + +* Run the tests locally using [tox] which executes the full suite on all + supported Python versions installed. + +* Each pull request is gated using [Travis CI] with the results linked on the + github page. This must pass before the change can land, note pushing a new + change will trigger a retest. + +## Style + +* Code style should follow [PEP 8] generally, and can be checked by running: + ``tox -e flake8``. + +* Import statements can be automatically formatted using [isort]. + +[isort]: https://pypi.org/project/isort/ +[PEP 8]: https://www.python.org/dev/peps/pep-0008/ +[tox]: https://tox.readthedocs.io/en/latest/ +[Travis CI]: https://docs.travis-ci.com/ diff --git a/README.md b/README.md index 83ace16..647d144 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,12 @@ The **Amazon SQS Extended Client Library for Python has been modelled after the ``` import base64 - from sqs_client.SQSClientExtended import SQSClientExtended + from pysqs_extended_client.SQSClientExtended import SQSClientExtended # from string import ascii_letters, digits # from random import choice - from sqs_client.config import (AWS_SQS_QUEUE_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) + from pysqs_extended_client.config import (AWS_SQS_QUEUE_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) if __name__ == '__main__': diff --git a/sqs_client/SQSClientExtended.py b/pysqs_extended_client/SQSClientExtended.py similarity index 100% rename from sqs_client/SQSClientExtended.py rename to pysqs_extended_client/SQSClientExtended.py diff --git a/pysqs_extended_client/__init__.py b/pysqs_extended_client/__init__.py new file mode 100644 index 0000000..40263c3 --- /dev/null +++ b/pysqs_extended_client/__init__.py @@ -0,0 +1,2 @@ +__title__ = "pysqs_client_extended" +__version__ = "0.0.1" \ No newline at end of file diff --git a/sqs_client/config.py b/pysqs_extended_client/config.py similarity index 100% rename from sqs_client/config.py rename to pysqs_extended_client/config.py diff --git a/setup.py b/setup.py index 1e4cc2e..99025ac 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,26 @@ import os +import re +from io import open as io_open from setuptools import setup, find_packages, Command with open("README.md", "r") as fh: long_description = fh.read() - base_path = os.path.abspath(os.path.dirname(__file__)) + +def readall(*args): + with io_open(os.path.join(base_path, *args), encoding="utf-8") as fp: + return fp.read() + + +metadata = dict( + re.findall(r"""__([a-z]+)__ = "([^"]+)""", readall("pysqs_extended_client", "__init__.py")) +) + + # What packages are required for this module to be executed? try: with open(os.path.join(base_path, "requirements.txt"), encoding="utf-8") as f: @@ -20,17 +32,20 @@ class CleanCommand(Command): """Custom clean command to tidy up the project root.""" user_options = [] + def initialize_options(self): pass + def finalize_options(self): pass + def run(self): - os.system('rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info') + os.system("rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info") setup( - name="boto3-sqs-extended-client", - version="0.0.1", + name="pysqs-extended-client", + version=metadata["version"], author="timothy.mugayi", author_email="django.course@gmail.com", description="Amazon SQS Extended Client Library for Python for sending large payloads that exceed sqs limitations via S3", @@ -58,8 +73,8 @@ def run(self): ], zip_safe=True, install_requires=required_packages, - keywords='Amazon SQS Extended Client Library for Python', + keywords = ['SQS client python', 'SQS client', 'sqs extended client', 'aws sqs client', 'boto sqs client', 'large message sqs', 'sqs s3', 'sqs'], cmdclass={ 'clean': CleanCommand, } -) \ No newline at end of file +) diff --git a/sqs_client/__init__.py b/sqs_client/__init__.py deleted file mode 100644 index af1d809..0000000 --- a/sqs_client/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__title__ = 'sqs_client' -__version__ = '0.0.1' \ No newline at end of file diff --git a/tests/test_sqs_client.py b/tests/test_pysqs_extended_client.py similarity index 82% rename from tests/test_sqs_client.py rename to tests/test_pysqs_extended_client.py index 4572315..ea23775 100644 --- a/tests/test_sqs_client.py +++ b/tests/test_pysqs_extended_client.py @@ -1,12 +1,12 @@ import pytest import base64 -from sqs_client.SQSClientExtended import SQSClientExtended +from pysqs_extended_client.SQSClientExtended import SQSClientExtended # from string import ascii_letters, digits # from random import choice -from sqs_client.config import (AWS_SQS_QUEUE_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) +from pysqs_extended_client.config import (AWS_SQS_QUEUE_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) try: FileNotFoundError