-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 47d5e4e
Showing
29 changed files
with
2,991 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# 4 space indentation | ||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# 2 space indentation | ||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[bootstrap] | ||
indent_style = space | ||
indent_size = 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
coverage.xml | ||
nosetests.xml | ||
*.egg | ||
*.egg-info | ||
*.pyc | ||
*.pyo | ||
/.coverage | ||
/build/ | ||
/dist/ | ||
/downloads/ | ||
/env/ | ||
/htmlcov/ | ||
env2 | ||
env3 | ||
.idea | ||
docs/_build |
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,21 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- 2.7 | ||
- 3.4 | ||
- 3.5 | ||
install: | ||
- pip install -r requires/testing.txt | ||
script: nosetests --with-coverage | ||
after_success: | ||
- codecov | ||
deploy: | ||
distributions: sdist bdist_wheel | ||
provider: pypi | ||
user: sprockets | ||
on: | ||
python: 3.5 | ||
tags: true | ||
all_branches: true | ||
password: | ||
secure: "Zjz9naroBj+my1r2cokIIbqYIJg/XOx1ooYvnq8ZciEG0782xXTLjOqOzn0H6wNko2sS6GLcltssm56B9azSmLwxBinNGtll4KwUvtQfyo39T0tiaOYjSh5/sAk117q2hOdirWe41kGXHZp4PYJLopTbz94EdyCYTX57gCkFzTIhXwAKEwYBKIcfUfZZNcqdelQM9M8urS7apWAAzIkSN1RG4lnWcC3YmFolxX5RdbW7KCAKsX8/0vXacs1cTCIMeTDDsKMomlfFCHp1NgqsnM+hyLP4fSCYKKQUR+/CsxLgk45wtDGXYAZ7qS7WDdUbX7X1ejJ1fJQ0XDioypMFpGyLxq5VdlLlq6Oyrkunx9X9iUkcqIj4a56bkltQ2FRSfs+ttX1VlU9YuIxdWHf6R72wHM3bJLcDO5p2IxtBWkoUaSHnL9VfbtrlyBMtPKtenCvZ1W7ZWx5cekcqD1GGO5fHgBH4AKYb52aamt9xzWdN34OLnzCjo/c6xGfrbX/wEQhXHunTZ1naNowcicCqC1NdwfaqORc9zSWMw9MvJq8JqAgNeuD4CNcycxrdNOu4qbgHUbmORRO9xqReh3Smyhuxozq6sJK1gWrahnwNUme40JC+7tjdOaeBaY52l0HAvmkGJ3ycECcuu25QpSwqiSQVc63DdUHPJPVgwyj3mjM=" |
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,25 @@ | ||
Copyright (c) 2016 AWeber Communications | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
* Neither the name of Sprockets nor the names of its contributors may be used to | ||
endorse or promote products derived from this software without specific | ||
prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,3 @@ | ||
include LICENSE | ||
graft docs | ||
graft requires |
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,67 @@ | ||
Sprockets DynamoDB | ||
================== | ||
An asynchronous DynamoDB client and mixin for Tornado applications | ||
|
||
|Version| |Downloads| |Status| |Coverage| |License| | ||
|
||
Installation | ||
------------ | ||
``sprockets-dynamodb`` is available on the Python package index and is installable via pip: | ||
|
||
.. code:: bash | ||
pip install sprockets-dynamodb | ||
Documentation | ||
------------- | ||
Documentation is available at `sprockets-dynamodb.readthedocs.io <https://sprockets-dynamodb.readthedocs.io>`_. | ||
|
||
Configuration | ||
------------- | ||
The following table details the environment variable configuration options. | ||
|
||
+--------------------------+--------------------------------------------------------------------+---------+ | ||
| Variable | Definition | Default | | ||
+==========================+====================================================================+=========+ | ||
| ``DYNAMODB_ENDPOINT`` | Override the default DynamoDB HTTP endpoint | | | ||
+--------------------------+--------------------------------------------------------------------+---------+ | ||
| ``DYNAMODB_MAX_CLIENTS`` | Maximum number of concurrent DynamoDB clients/requests per process | ``100`` | | ||
+--------------------------+--------------------------------------------------------------------+---------+ | ||
| ``DYNAMODB_MAX_RETRIES`` | Maximum number retries for transient errors | ``3`` | | ||
+--------------------------+--------------------------------------------------------------------+---------+ | ||
|
||
Mixin Configuration | ||
^^^^^^^^^^^^^^^^^^^ | ||
The ``sprockets_dynamodb.mixins.DynamoDBMixin`` class will automatically raise ``HTTPError`` | ||
responses for different classes of errors coming from DynamoDB. In addition it will attempt to | ||
work with the `Sprockets InfluxDB <https://github.com/sprockets/sprockets-influxdb>`_ client | ||
to instrument all DynamoDB requests, submitting per request measurements to InfluxDB. It will | ||
attempt to automatically tag measurements with the application/service name if the ``SERVICE`` | ||
environment variable is set. It will also tag the measurement if the ``ENVIRONMENT`` environment | ||
variable is set with the environment that the application is running in. Finally, if you are | ||
using the `Sprockets Correlation Mixin <https://github.com/sprockets/sprockets.mixins.correlation>`_, | ||
measurements will automatically be tagged with the correlation ID for a request. | ||
|
||
Requirements | ||
------------ | ||
- `Tornado <https://tornadoweb.org>`_ | ||
- `tornado-aws <https://pypi.python.org/pypi/tornado-aws>`_ | ||
|
||
Version History | ||
--------------- | ||
Available at https://sprockets-dynamodb.readthedocs.org/en/latest/history.html | ||
|
||
.. |Version| image:: https://img.shields.io/pypi/v/sprockets-dynamodb.svg? | ||
:target: http://badge.fury.io/py/sprockets-dynamodb | ||
|
||
.. |Status| image:: https://img.shields.io/travis/sprockets/sprockets-dynamodb.svg? | ||
:target: https://travis-ci.org/sprockets/sprockets-dynamodb | ||
|
||
.. |Coverage| image:: https://img.shields.io/codecov/c/github/sprockets/sprockets-dynamodb.svg? | ||
:target: https://codecov.io/github/sprockets/sprockets-dynamodb?branch=master | ||
|
||
.. |Downloads| image:: https://img.shields.io/pypi/dm/sprockets-dynamodb.svg? | ||
:target: https://pypi.python.org/pypi/sprockets-dynamodb | ||
|
||
.. |License| image:: https://img.shields.io/pypi/l/sprockets-dynamodb.svg? | ||
:target: https://sprockets-dynamodb.readthedocs.org |
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,71 @@ | ||
#!/bin/sh | ||
# | ||
# NAME | ||
# bootstrap -- initialize/update docker environment | ||
# | ||
# SYNOPSIS | ||
# bootstrap | ||
# bootstrap shellinit | ||
# | ||
# DESCRIPTION | ||
# Execute this script without parameters to build the local docker | ||
# environment. Once bootstrapped, dependent services are running | ||
# via docker-compose and the environment variables are written to | ||
# *build/test-environment* for future use. | ||
# | ||
# Running this script with the _shellinit_ command line parameter | ||
# causes it to simply interrogate the running docker environment, | ||
# update *build/test-environment*, and print the environment to | ||
# the standard output stream in a shell executable manner. This | ||
# makes the following pattern for setting environment variables | ||
# in the current shell work. | ||
# | ||
# prompt% $(./bootstrap shellinit) | ||
# | ||
# vim: set ts=2 sts=2 sw=2 et: | ||
PROJECT=sprockets | ||
|
||
if test -e /var/run/docker.sock | ||
then | ||
DOCKER_IP=127.0.0.1 | ||
else | ||
echo "Failed to initialize docker environment" | ||
exit 2 | ||
fi | ||
|
||
COMPOSE_ARGS= | ||
if test -n "${DOCKER_COMPOSE_PREFIX}" | ||
then | ||
COMPOSE_ARGS="-p ${DOCKER_COMPOSE_PREFIX}" | ||
fi | ||
|
||
get_exposed_port() { | ||
docker-compose ${COMPOSE_ARGS} port $1 $2 | cut -d: -f2 | ||
} | ||
|
||
build_env_file() { | ||
DYNAMODB_PORT=$(get_exposed_port dynamodb 7777) | ||
(echo "export DOCKER_COMPOSE_PREFIX=${DOCKER_COMPOSE_PREFIX}" | ||
echo "export DOCKER_TLS_VERIFY=${DOCKER_TLS_VERIFY}" | ||
echo "export DOCKER_HOST=${DOCKER_HOST}" | ||
echo "export DOCKER_CERT_PATH=${DOCKER_CERT_PATH}" | ||
echo "export DOCKER_MACHINE_NAME=${DOCKER_MACHINE_NAME}" | ||
echo "export DYNAMODB_ENDPOINT=http://${DOCKER_IP}:${DYNAMODB_PORT}" | ||
) > $1 | ||
} | ||
|
||
set -e | ||
|
||
mkdir -p build | ||
|
||
if test "$1" = 'shellinit' | ||
then | ||
# just build the environment file from docker containers | ||
build_env_file build/test-environment | ||
else | ||
docker-compose ${COMPOSE_ARGS} stop | ||
docker-compose ${COMPOSE_ARGS} rm --force | ||
docker-compose ${COMPOSE_ARGS} up -d | ||
build_env_file build/test-environment | ||
fi | ||
cat build/test-environment |
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 @@ | ||
%YAML 1.2 | ||
--- | ||
dynamodb: | ||
image: tray/dynamodb-local | ||
command: -inMemory -port 7777 | ||
ports: | ||
- 7777 |
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,5 @@ | ||
API Documentation | ||
================= | ||
|
||
.. autoclass:: sprockets_dynamodb.DynamoDB | ||
:members: |
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,44 @@ | ||
# -*- coding: utf-8 -*- | ||
import alabaster | ||
import sprockets_dynamodb | ||
|
||
project = 'sprockets.clients.dynamodb' | ||
copyright = 'AWeber Communications, Inc.' | ||
version = sprockets_dynamodb.__version__ | ||
release = '.'.join(str(v) for v in sprockets_dynamodb.version_info[0:2]) | ||
|
||
needs_sphinx = '1.0' | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.intersphinx', | ||
'sphinx.ext.viewcode', | ||
] | ||
|
||
templates_path = [] | ||
source_suffix = '.rst' | ||
source_encoding = 'utf-8-sig' | ||
master_doc = 'index' | ||
exclude_patterns = [] | ||
pygments_style = 'sphinx' | ||
html_theme = 'alabaster' | ||
html_style = 'custom.css' | ||
html_static_path = ['static'] | ||
html_theme_path = [alabaster.get_path()] | ||
html_sidebars = { | ||
'**': ['about.html', 'navigation.html'], | ||
} | ||
html_theme_options = { | ||
'github_user': 'sprockets', | ||
'github_repo': 'sprockets_dynamodb', | ||
'description': 'Amazon DynamoDB Connector', | ||
'github_banner': True, | ||
'travis_button': True, | ||
'codecov_button': True, | ||
'sidebar_width': '230px', | ||
} | ||
|
||
intersphinx_mapping = { | ||
'python': ('http://docs.python.org/3/', None), | ||
'tornado': ('http://tornadoweb.org/en/latest/', None), | ||
'tornadoaws': ('https://tornado-aws.readthedocs.org/en/latest/', None), | ||
} |
Oops, something went wrong.