Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmrk committed May 15, 2019
2 parents 4b5c250 + 4acccf3 commit 22c6031
Show file tree
Hide file tree
Showing 17 changed files with 692 additions and 351 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
@@ -0,0 +1,4 @@
*
!rabbit_force/
!Pipfile*
**/__pycache__
2 changes: 1 addition & 1 deletion .readthedocs.yml
Expand Up @@ -4,5 +4,5 @@ formats:
build:
image: latest
python:
version: 3.6
version: 3.7
requirements_file: dev_requirements.txt
7 changes: 5 additions & 2 deletions .travis.yml
@@ -1,11 +1,14 @@
dist: xenial
language: python
python:
- "3.6"
- "3.7"
before_install:
- pip install -q coveralls pipenv
- pip install -q pipenv
install:
- pipenv install --dev
script:
- coverage run -m unittest discover tests
- flake8 rabbit_force tests
- pylint rabbit_force
after_success:
- coveralls
8 changes: 8 additions & 0 deletions CHANGELOG.rst
@@ -1,6 +1,14 @@
Changelog
=========

0.1.1 (2019-05-15)
------------------

- Switch to python 3.7
- Update outdated dependencies
- Add docker deployment option


0.1.0 (2018-07-05)
------------------

Expand Down
11 changes: 6 additions & 5 deletions Pipfile
Expand Up @@ -5,25 +5,26 @@ name = "pypi"

[packages]
aiohttp = ">=3.1,<4.0"
aiosfstream = ">=0.2.2,<0.3.0"
aiosfstream = "*"
pyyaml = "*"
aioredis = "*"
aioamqp = "*"
marshmallow = ">=3.0.0b5,<3.1.0"
jsonpath-rw-ext = {git = "https://github.com/sileht/python-jsonpath-rw-ext.git", editable = true, ref = "75beb8a36abc8949c68b7ef9e20992bae9e9eb7a"}
click = ">=6.7,<7.0"
click = "*"
ujson = ">=1.35,<2.0"
uvloop = "*"
jsonpath-rw-ext = ">=1.2.0"

[dev-packages]
sphinx = "*"
asynctest = "*"
coverage = "*"
"flake8" = "*"
pylint = "*"
coveralls = "*"
coverage = "<5.0"

[requires]
python_version = "3.6"
python_version = "3.7"

[pipenv]
allow_prereleases = true
656 changes: 386 additions & 270 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion README.rst
Expand Up @@ -208,7 +208,17 @@ Documentation
Requirements
------------

Python 3.6 and above.
Python 3.7

Docker
------

The `public docker image <https://hub.docker.com/r/robertmrk/rabbit_force>`_ can
be found on docker hub.

.. code-block:: bash
$ docker pull robertmrk/rabbit_force
License
-------
Expand Down
58 changes: 32 additions & 26 deletions dev_requirements.txt
@@ -1,32 +1,38 @@
-i https://pypi.org/simple
alabaster==0.7.11
astroid==2.0.0.dev3
asynctest==0.12.2
alabaster==0.7.12
astroid==2.2.5
asynctest==0.12.4
babel==2.6.0
certifi==2018.4.16
certifi==2019.3.9
chardet==3.0.4
coverage==5.0a1
coverage==5.0a5
docutils==0.14
flake8==3.5.0
idna==2.7
imagesize==1.0.0
isort==4.3.4
jinja2==2.10
lazy-object-proxy==1.3.1
markupsafe==1.0
entrypoints==0.3
flake8==3.7.7
idna==2.8
imagesize==1.1.0
isort==4.3.18
jinja2==2.10.1
lazy-object-proxy==1.4.0
markupsafe==1.1.1
mccabe==0.6.1
packaging==17.1
pycodestyle==2.3.1
pyflakes==1.6.0
pygments==2.2.0
pylint==2.0.0.dev1
pyparsing==2.2.0
pytz==2018.4
requests==2.19.1
six==1.11.0
packaging==19.0
pycodestyle==2.5.0
pyflakes==2.1.1
pygments==2.3.1
pylint==2.3.1
pyparsing==2.4.0
pytz==2019.1
requests==2.21.0
six==1.12.0
snowballstemmer==1.2.1
sphinx==1.7.5
sphinxcontrib-websupport==1.1.0
typed-ast==1.1.0; python_version < '3.7' and implementation_name == 'cpython'
urllib3==1.23
wrapt==1.10.11
sphinx==2.0.1
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
typed-ast==1.3.5 ; implementation_name == 'cpython'
urllib3==1.24.3
wrapt==1.11.1
43 changes: 42 additions & 1 deletion docs/source/installation.rst
Expand Up @@ -6,7 +6,7 @@ or clone it from `github <rabbit_force_github_>`_::

$ git clone https://github.com/robertmrk/rabbit_force.git

rabbit_force requires python 3.6 and `pipenv`_ to be installed.
rabbit_force requires python 3.7 and `pipenv`_ to be installed.

To install pipenv run::

Expand All @@ -22,3 +22,44 @@ then activate the virtual environment::
$ pipenv shell

.. include:: global.rst

Docker
------

The `public docker image <https://hub.docker.com/r/robertmrk/rabbit_force>`_ can
be found on docker hub.

.. code-block:: bash
$ docker pull robertmrk/rabbit_force
Start a rabbit_force instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If the configuration file is located on the host, then you should bind mount its
directory into the container and you should specify its path inside the
container as a positional argument.

.. code-block:: bash
$ docker run -d --name rabbit_force -v /path/to/config:/config:ro
robertmrk/rabbit_force:latest /config/config.yaml
Use an embedded configuration file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Alternatively, a simple ``Dockerfile`` can be used to generate a new image that
includes the necessary configuration.

.. code-block::
FROM robertmrk/rabbit_force:latest
COPY config.yaml ./
CMD ["config.yaml"]
.. code-block:: bash
$ docker run -d --name rabbit_force configured-rabbit_force
2 changes: 1 addition & 1 deletion rabbit_force/__main__.py
Expand Up @@ -133,7 +133,7 @@ def main(config_file, ignore_replay_storage_errors, ignore_sink_errors,
app.run()

except Exception as error: # pylint: disable=broad-except
logger.error(f"Unexpected error: \n%r", error, exc_info=show_trace)
logger.error("Unexpected error: \n%r", error, exc_info=show_trace)
exit(1)


Expand Down
2 changes: 1 addition & 1 deletion rabbit_force/_metadata.py
Expand Up @@ -4,6 +4,6 @@
KEYWORDS = "salesforce streaming-api rabbitmq amqp redis asyncio " \
"adapter service jsonpath"
URL = "https://github.com/robertmrk/rabbit_force"
VERSION = "0.1.0"
VERSION = "0.1.1"
AUTHOR = "Róbert Márki"
AUTHOR_EMAIL = "gsmiko@gmail.com"
31 changes: 9 additions & 22 deletions rabbit_force/config.py
Expand Up @@ -5,7 +5,7 @@
import logging

from marshmallow import Schema, fields, validates_schema, ValidationError, \
post_load
post_load, RAISE
from marshmallow.validate import Length, Range, OneOf
import yaml

Expand All @@ -18,22 +18,9 @@

class StrictSchema(Schema):
"""Common schema base class which rejects unknown fields"""

# pylint: disable=unused-argument
@validates_schema(pass_original=True)
def check_unknown_fields(self, data, original_data):
"""Check for the presence and reject unknown fields
:raise marshmallow.exceptions.ValidationError: If an unknown field is \
found
"""
# get the difference of the loaded and specified fields
unknown_fields = set(original_data) - set(self.fields)
# raise an error if any surplus fields are present
if unknown_fields:
raise ValidationError('Unknown field', list(unknown_fields))

# pylint: enable=unused-argument
def __init__(self, *args, **kwargs):
kwargs["unknown"] = RAISE
super().__init__(*args, **kwargs)


class PushTopicSchema(StrictSchema):
Expand Down Expand Up @@ -108,11 +95,11 @@ def check_api_version(self, data): # pylint: disable=no-self-use
" for API version 28.0 and earlier.")

# check for the presence of new fields for an older API version
elif (data["ApiVersion"] <= 28.0 and
("NotifyForOperationCreate" in data or
"NotifyForOperationDelete" in data or
"NotifyForOperationUndelete" in data or
"NotifyForOperationUpdate" in data)):
if (data["ApiVersion"] <= 28.0 and
("NotifyForOperationCreate" in data or
"NotifyForOperationDelete" in data or
"NotifyForOperationUndelete" in data or
"NotifyForOperationUpdate" in data)):
raise ValidationError("'NotifyForOperationCreate', "
"'NotifyForOperationDelete', "
"'NotifyForOperationUndelete' and "
Expand Down
39 changes: 19 additions & 20 deletions requirements.txt
@@ -1,25 +1,24 @@
-i https://pypi.org/simple
-e git+https://github.com/sileht/python-jsonpath-rw-ext.git@75beb8a36abc8949c68b7ef9e20992bae9e9eb7a#egg=jsonpath-rw-ext
aioamqp==0.11.0
aiocometd==0.3.1
aiohttp==3.3.2
aioredis==1.1.0
aiosfstream==0.2.2
async-timeout==3.0.0
attrs==18.1.0
aioamqp==0.12.0
aiocometd==0.4.5
aiohttp==3.5.4
aioredis==1.2.0
aiosfstream==0.5.0
async-timeout==3.0.1
attrs==19.1.0
chardet==3.0.4
click==6.7
decorator==4.3.0
hiredis==0.2.0
idna-ssl==1.0.1
idna==2.7
click==7.0
decorator==4.4.0
hiredis==1.0.0
idna==2.8
jsonpath-rw-ext==1.2.0
jsonpath-rw==1.4.0
marshmallow==3.0.0b11
multidict==4.3.1
pbr==4.0.4
marshmallow==3.0.0rc6
multidict==4.5.2
pbr==5.2.0
ply==3.11
pyyaml==3.12
six==1.11.0
pyyaml==5.1
six==1.12.0
ujson==1.35
uvloop==0.10.1
yarl==1.2.6
uvloop==0.13.0rc1
yarl==1.3.0

0 comments on commit 22c6031

Please sign in to comment.