Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add basic documentation generation using sphinx. * Update travis-ci environment.
- Loading branch information
1 parent
1603c83
commit f5eca84
Showing
15 changed files
with
293 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
sudo: false | ||
dist: focal | ||
os: linux | ||
language: python | ||
cache: pip | ||
|
||
services: | ||
- docker | ||
cache: | ||
directories: | ||
- "$HOME/.cache/pip" | ||
- "$HOME/.pyenv" | ||
|
||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10-dev" | ||
- "pypy3" | ||
- "nightly" # nightly build | ||
- "nightly" | ||
|
||
before_install: | ||
- docker run -d -p 127.0.0.1:4100:4100 pafortin/goaws | ||
|
||
install: | ||
- pip install -U boto3 codecov -r requirements-test.txt | ||
|
||
script: | ||
- coverage run -m pytest | ||
- coverage report -m | ||
|
||
after_success: | ||
- codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
================ | ||
Introduction | ||
================ | ||
|
||
.. image:: https://pyup.io/repos/github/hjpotter92/sqspy/shield.svg | ||
:target: https://pyup.io/repos/github/hjpotter92/sqspy/ | ||
:alt: Updates | ||
.. image:: https://readthedocs.org/projects/sqspy/badge/?version=latest | ||
:target: https://sqspy.docs.hjpotter92.tech/en/latest/?badge=latest | ||
:alt: Documentation Status | ||
.. image:: https://travis-ci.com/hjpotter92/sqspy.svg?branch=master | ||
:target: https://travis-ci.com/hjpotter92/sqspy | ||
:alt: Build status | ||
|
||
A more pythonic approach to SQS producer/consumer utilities. Heavily | ||
inspired from the `the pySqsListener | ||
<https://pypi.org/project/pySqsListener/>`_ package. | ||
|
||
Install | ||
======== | ||
|
||
.. code-block:: shell | ||
pip install sqspy | ||
Usage | ||
======== | ||
|
||
.. code-block:: python | ||
from sqspy import Consumer | ||
class MyWorker(Consumer): | ||
def handle_message(self, body, attributes, message_attributes): | ||
print(body) | ||
listener = MyWorker('Q1', error_queue='EQ1') | ||
listener.listen() | ||
More documentation coming soon. | ||
|
||
Why | ||
======== | ||
|
||
The mentioned project had a few issues which I faced while trying to | ||
implement at my organisation. The local environment testing setup was | ||
very flaky. The signatures for ``sqs_listener`` and ``sqs_producer`` | ||
were very different from each other. | ||
|
||
This rewrite supports **python 3.6+ versions only**, and makes use of | ||
a lot of newer python features. It also makes use of service resources | ||
(for lazy calls) from the boto3 library instead of making calls via | ||
the low level client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
import pathlib | ||
import sys | ||
|
||
sys.path.insert(0, str(pathlib.Path.cwd().parent.absolute())) | ||
sys.path.insert(0, str(pathlib.Path.cwd().absolute())) | ||
from sqspy.about import VERSION | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "sqspy" | ||
copyright = "2021, hjpotter92" | ||
author = "hjpotter92" | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = VERSION | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.autosectionlabel", | ||
"sphinx.ext.autosummary", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.viewcode", | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ["_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "alabaster" | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ["_static"] | ||
|
||
# -- Options for enabled extensions ------------------------------------------ | ||
intersphinx_mapping = { | ||
"python": ("https://docs.python.org/3", None), | ||
"boto3": ("https://boto3.rtfd.io/", None), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.. sqspy documentation master file, created by | ||
sphinx-quickstart on Thu Mar 25 16:11:47 2021. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to sqspy's documentation! | ||
================================= | ||
|
||
.. include:: ../README.rst | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
modules | ||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sqspy | ||
===== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
sqspy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
sqspy package | ||
============= | ||
|
||
Submodules | ||
---------- | ||
|
||
sqspy._base module | ||
------------------ | ||
|
||
.. automodule:: sqspy._base | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
sqspy.consumer module | ||
--------------------- | ||
|
||
.. automodule:: sqspy.consumer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
sqspy.producer module | ||
--------------------- | ||
|
||
.. automodule:: sqspy.producer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: sqspy | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sphinx>=3.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
coverage>=5.3 | ||
pytest>=6.1.1 | ||
Faker>=4.14.0 | ||
coverage>=5.4 | ||
pytest>=6.2.2 | ||
Faker>=6.6.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,50 @@ | ||
from pathlib import Path | ||
|
||
from setuptools import setup, find_packages | ||
from setuptools import find_packages, setup | ||
|
||
import sqspy.about as about | ||
|
||
here = Path.cwd() | ||
readme = here / "README.md" | ||
|
||
|
||
setup( | ||
name=about.NAME, | ||
version=about.VERSION, | ||
description="AWS SQS utility package for producing and consuming messages", | ||
long_description=readme.read_text(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/hjpotter92/sqspy", | ||
author=about.AUTHOR.get("name"), | ||
author_email=about.AUTHOR.get("email"), | ||
license="MIT", | ||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
classifiers=[ | ||
# How mature is this project? Common values are | ||
# 3 - Alpha | ||
# 4 - Beta | ||
# 5 - Production/Stable | ||
"Development Status :: 4 - Beta", | ||
# Indicate who your project is intended for | ||
"Intended Audience :: Developers", | ||
"Topic :: Software Development :: Libraries", | ||
# Pick your license as you wish (should match "license" above) | ||
"License :: OSI Approved :: MIT License", | ||
# Specify the Python versions you support here. In particular, ensure | ||
# that you indicate whether you support Python 2, Python 3 or both. | ||
"Programming Language :: Python :: 3.7", | ||
], | ||
# What does your project relate to? | ||
keywords="aws sqs messages producer/consumer", | ||
packages=find_packages(), | ||
install_requires=["boto3"], | ||
) | ||
if __name__ == "__main__": | ||
setup( | ||
name=about.NAME, | ||
version=about.VERSION, | ||
description="AWS SQS utility package for producing and consuming messages", | ||
long_description=Path("README.rst").read_text(), | ||
url="https://github.com/hjpotter92/sqspy", | ||
author=about.AUTHOR["name"], | ||
author_email=about.AUTHOR["email"], | ||
license="MIT", | ||
include_package_data=True, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"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 :: Only", | ||
"Programming Language :: Python :: Implementation", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
], | ||
python_requires=">=3.6", | ||
project_urls={ | ||
"Documentation": "https://sqspy.rtfd.io/", | ||
"Code coverage": "https://app.codecov.io/gh/hjpotter92/sqspy", | ||
"Builds history": "https://travis-ci.com/hjpotter92/sqspy", | ||
# "Changelog": "https://sqspy.rtfd.io/changelog", | ||
}, | ||
platforms=["any"], | ||
tests_require=( | ||
"codecov>=2.1.11", | ||
"coverage>=5.4", | ||
"pytest>=6.2.2", | ||
), | ||
keywords="aws sqs messages producer consumer", | ||
packages=find_packages(exclude=["docs", "tests", "tests.*"]), | ||
install_requires=["boto3>=1"], | ||
) |
Oops, something went wrong.