Skip to content

Commit

Permalink
Adopt black code formatting and add Python 3.7 to CI
Browse files Browse the repository at this point in the history
Closes #81
CLoses #82
  • Loading branch information
nicolaiarocci committed Apr 23, 2019
1 parent da8dce1 commit 42d41ec
Show file tree
Hide file tree
Showing 18 changed files with 999 additions and 969 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ _build

.cache
.vscode/
.pytest_cache/
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: flake8
49 changes: 26 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
dist: xenial
sudo: false
language: python
stages:
- linting
- test
cache: pip
script: tox --recreate
python:
- "2.7"
addons:
apt:
sources:
- deadsnakes
packages:
- python3.5
install:
- pip install tox
env:
- TOX_ENV=py27
- TOX_ENV=py35
#- TOX_ENV=pypy
#- TOX_ENV=pypy3
- TOX_ENV=flake8
script:
- tox -e $TOX_ENV
services:
- mongodb
before-script:
# Timer: https://docs.travis-ci.com/user/database-setup/#MongoDB-does-not-immediately-accept-connections
- sleep 15
- mongo eve_swagger_test --eval 'db.addUser("test_user", "test_pw");'
- 2.7
- 3.5
- 3.6
- 3.7
- pypy3.5-6.0
install: travis_retry pip install tox-travis

jobs:
include:
- stage: linting
python: '3.7'
env:
install:
- pip install pre-commit
- pre-commit install-hooks
before_script:
services:
script:
- pre-commit run --all-files
10 changes: 7 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Here you can see the full list of changes between each Eve-Swagger release.
In Development
--------------

- Adopt Black code formatting style (`#82`_)
- Add Python 3.6 and 3.7 to CI matrix (`#81`_)
- Drop Python 2.6, 3.3, and 3.4 support (`#80`_)
- Support for OpenAPI 3 (`#70`_, `#79`_)
- Add support for resource-level ``example`` definition (`#69`_)
- Add a stale-bot to automatically close stale issues and pull requests (`#68`_)

.. _`#80`: https://github.com/pyeve/eve-swagger/pull/80
.. _`#82`: https://github.com/pyeve/eve-swagger/issues/82
.. _`#81`: https://github.com/pyeve/eve-swagger/issues/81
.. _`#80`: https://github.com/pyeve/eve-swagger/issues/80
.. _`#79`: https://github.com/pyeve/eve-swagger/pull/79
.. _`#70`: https://github.com/pyeve/eve-swagger/pull/70
.. _`#69`: https://github.com/pyeve/eve-swagger/issues/69
Expand Down Expand Up @@ -92,7 +96,7 @@ Released on 25 October, 2016
- Fix: README: fix comma that causes a validation error in example script (Luis
Fernando Gomes).

- New: Ability to generate Swagger tags (Stratos Gerakakis).
- New: Ability to generate Swagger tags (Stratos Gerakakis).
- New: add CORS support (otibsa).
- New: Python 2.6 compatibility (otibsa).
- New: Add a proper test suite. Closes #8 (otibsa).
Expand All @@ -105,7 +109,7 @@ Released on 25 October, 2016
- New: Option to disable resource documentation via `disable_documentation` in
`settings.py` (otibsa).
- New: Ability to include description fields. Just add a `description` field in
the schema definitions in `settings.py` (Stratos Gerakakis).
the schema definitions in `settings.py` (Stratos Gerakakis).
- New: Add support for more eve features: `allowed`, `default`, `minlength`,
`maxlength`, `min`, `max` (otibsa).
- New: Enable additional documentation to be injected at runtime (otibsa).
Expand Down
11 changes: 7 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Eve-Swagger |latest-version|
============================

|build-status| |python-support|
|latest-version| |build-status| |python-support| |license| |black-formatting|

Swagger_ extension for Eve_ powered RESTful APIs.

Expand Down Expand Up @@ -102,7 +102,7 @@ As an example:
**NOTE**: If you do use that feature make sure that the ``TRANSPARENT_SCHEMA_RULES``
in your ``settings.py`` is also turned ON, otherwise you will get complains from the
Cerberus library about "unknown field 'description' for field [yourFieldName]", or use
Cerberus library about "unknown field 'description' for field [yourFieldName]", or use
a custom schema validator, as below:

.. code-block:: python
Expand Down Expand Up @@ -194,10 +194,10 @@ The example is shown in the swagger ui in the model and the responses.
.. image:: resources/example_field.png

**NOTE**: As with the description, the field ``TRANSPARENT_SCHEMA_RULES``
must be enabled in your ``settings.py``, otherwise the Cerberus library
must be enabled in your ``settings.py``, otherwise the Cerberus library
will display an error about "unknown field 'example' for field[yourFieldName]".

If you do not want to use this rule for the entire schema, you can also use
If you do not want to use this rule for the entire schema, you can also use
your own validator.

.. code-block:: python
Expand Down Expand Up @@ -259,6 +259,9 @@ See the original LICENSE_ for more information.
.. |license| image:: https://img.shields.io/pypi/l/eve-swagger.svg
:alt: Software license
:target: https://github.com/pyeve/eve-swagger/blob/master/LICENSE
.. |black-formatting| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:alt: Black code formatting
:target: https://github.com/ambv/black

.. _Swagger: http://swagger.io/
.. _Eve: http://python-eve.org/
Expand Down
4 changes: 2 additions & 2 deletions eve_swagger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"""
from .swagger import swagger, add_documentation # noqa

INFO = 'SWAGGER_INFO'
HOST = 'SWAGGER_HOST'
INFO = "SWAGGER_INFO"
HOST = "SWAGGER_HOST"
Loading

0 comments on commit 42d41ec

Please sign in to comment.