From 259d145b912f3672890b4ca770842f7e49e17cca Mon Sep 17 00:00:00 2001 From: Stan Chollet Date: Thu, 6 Dec 2018 09:49:12 +0100 Subject: [PATCH] chore: add integration with pypi --- .gitignore | 6 +++ .travis.yml | 36 +++++++++++++++++ Makefile | 43 ++++++++++++++++++++ pylintrc | 71 +++++++++++++++++++++++++++++++++ setup.py | 7 +--- tartiflette_aiohttp/__init__.py | 2 + tests/__init__.py | 0 tests/functional/__init__.py | 0 tests/functional/test_hello.py | 2 + tests/unit/__init__.py | 0 tests/unit/test_hello.py | 2 + 11 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 Makefile create mode 100644 pylintrc create mode 100644 tartiflette_aiohttp/__init__.py create mode 100644 tests/__init__.py create mode 100644 tests/functional/__init__.py create mode 100644 tests/functional/test_hello.py create mode 100644 tests/unit/__init__.py create mode 100644 tests/unit/test_hello.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d3d96f --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +build/ +dist/ +tartiflette_aiohttp.egg-info/ +__pycache__ +.coverage +reports/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7bc05d4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +language: python +dist: xenial +sudo: true +python: + - "3.6" +# Activate addons when integration tests will be +# implemented with Tartiflette +# addons: +# apt: +# packages: +# - build-essential +# - clang +# - cmake +# - bison +# - flex +# +# Compliant with Gazr Specification +# https://gazr.io +# https://github.com/dailymotion/gazr +# make style | test-unit | test-functional | init +script: + - make test-unit + - make test-functional + - make style + - make complexity +cache: pip +install: +- make init +- pip install -e .[test] +deploy: + provider: pypi + user: dailymotion + password: + secure: "lvwOKPdsFwO9QWpG5Eu423XiYms4hfP8DMhkH2Ku1ivZcES2NZ0FRYrJ0UyCSx9A1k9xfSYjRDe0KxMTPo4HwJjMhl/3JDO7OrI5NqpJiNVG6NQ8djBc+gwj5epugJ6duXe1MPXaNs3Ppo2EOwoslOJDl711YFaBXZsGfQvQ3Z22LyWVQ/QzWth4IzHkI3E0fOg7sPvI83hlhI0Pzfp5DdX6byoQssr65Hs1HvfEbWS3VgA+xZ1lznXMV0Dwl3o8aY2+FbOM8vUvR9HX9Rfm4t1/vOpuKF/9fciJUsCd42FnRayCjt1HsNKW0+EtkaV++oqzB7Dop0BasCc+MGx66iGFIrrAb8HIuIMwR1lMkJr6r9cbQpR7irkuCmMW3O1g52rLM1ky3vBhTzpodk4E9LQ96M9rVxPSez+nXvp94MNk9P6KdqYmgWCKym/kyrXPQrR0vq6URigtGl54HwzvxZfQaLxIPIbPRGqygS282ewzHIEcPm5cJQB1EZb/ZbK1xju7LNzkL933YE0u5kU93/5h15Q0QWo28umo4dhJWH3g47rSqYjnapJwHrj1+yJpjqR3zalLVJbA/H+VmAiG3vy0oJ10nb8SXsFkcN9KcYC84GVR5cvn3UHnYYhMg2x//t8kmY1J4AU8qKk2xipmN2uEAC9ff2SqwnqMIPEQGh4=" + on: + branch: master diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8e6f3e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ + +.PHONY: init +init: + true + +.PHONY: format +format: + black -l 79 --py36 tartiflette_aiohttp setup.py + +.PHONY: check-format +check-format: + black -l 79 --py36 --check tartiflette_aiohttp setup.py + +.PHONY: style +style: check-format + pylint tartiflette_aiohttp --rcfile=pylintrc + +.PHONY: complexity +complexity: + xenon --max-absolute B --max-modules B --max-average A tartiflette_aiohttp + +.PHONY: test-integration +test-integration: clean + true + +.PHONY: test-unit +test-unit: clean + mkdir -p reports + py.test -s tests/unit --junitxml=reports/report_unit_tests.xml --cov . --cov-config .coveragerc --cov-report term-missing --cov-report xml:reports/coverage_func.xml + +.PHONY: test-functional +test-functional: clean + mkdir -p reports + py.test -s tests/functional --junitxml=reports/report_func_tests.xml --cov . --cov-config .coveragerc --cov-report term-missing --cov-report xml:reports/coverage_unit.xml + +.PHONY: test +test: test-integration test-unit test-functional + +.PHONY: clean +clean: + find . -name '*.pyc' -exec rm -fv {} + + find . -name '*.pyo' -exec rm -fv {} + + find . -name '__pycache__' -exec rm -frv {} + diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..6114b94 --- /dev/null +++ b/pylintrc @@ -0,0 +1,71 @@ +# -*- mode: conf -*- +[GENERAL] +init-hook='import sys; sys.path.append("/usr/src/app")' + +[BASIC] +# Good variable names which should always be accepted, separated by a comma +# i,j,k = loop control vars, sq=search query, fn=function/lambda, fh=file handle, ts=timestamp, rx=regular expression +good-names=_,__,___,e,i,j,k,sq,fn,fh,js,ts,rx,logger + +## Bad variable names which should always be refused, separated by a comma +# balls/qballs is specific to one of the guys +bad-names=foo,bar,baz,toto,tata,tutu,coucou + +class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{1,40}|(__.*__))$ +function-rgx=[a-z_][a-z0-9_]{2,50}$ +method-rgx=[a-z_][a-z0-9_]{2,50}$ + +[MESSAGE CONTROL] +# CHANGED: +# C0111: Missing docstring +# E0602: Undefined variable %r +# I0011: Locally disabled messages +# I0012: Locally enabled messages +# R0801: Similar lines in files +# R0903: Too few public methods +# W0141: Bad-builtins +# W0142: Use of * or ** magic +# W0223: Abstract method not overridden +# W0603: Using the global statement +# W1202: Logging with '{}' formating instead of '%' +# C0330: Wrong hanging indentation before block (add 4 spaces). +# "bad-continuation" is currently disabled because of that issue -> https://github.com/PyCQA/pylint/issues/289 +disable=C0111,E0602,I0011,I0012,R0801,R0903,W0141,W0142,W0223,W0603,W1202,C0303,C0330,C0301 + +[DESIGN] +## Maximum number of arguments for function / method +max-args=8 + +## Maximum number of locals for function / method body +max-locals=10 + +## Maximum number of return / yield for function / method body +max-returns=10 + +## Maximum number of branch for function / method body +max-branchs=45 + +## Maximum number of statements in function / method body +max-statements=100 + +## Maximum number of public methods for a class (see R0904). +max-public-methods=30 + +max-attributes=15 + +[FORMAT] +max-line-length=80 + +## Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. We found that two spaces is the best balance for readability, easy typing, etc. +indent-string=' ' + +[MISCELLANEOUS] +# List of note tags to take in consideration, separated by a comma. One of our guys uses qballs when he wants to flag something for himself. +notes=FIXME,NINJA + +[TYPECHECK] +# Ignore some modules which don't work well with rapidjons +ignored-modules=rapidjson diff --git a/setup.py b/setup.py index 6585368..019998e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ "black==18.9b0", ] -_VERSION = "0.1.0" +_VERSION = "0.1.1" _PACKAGES = find_packages(exclude=["tests*"]) @@ -35,10 +35,7 @@ ], keywords="api graphql protocol api rest relay tartiflette dailymotion", packages=_PACKAGES, - install_requires=[ - "aiohttp~=3.4", - "tartiflette~=0.1", - ], + install_requires=["aiohttp~=3.4", "tartiflette~=0.1"], tests_require=_TEST_REQUIRE, extras_require={"test": _TEST_REQUIRE}, include_package_data=True, diff --git a/tartiflette_aiohttp/__init__.py b/tartiflette_aiohttp/__init__.py new file mode 100644 index 0000000..e11c2d0 --- /dev/null +++ b/tartiflette_aiohttp/__init__.py @@ -0,0 +1,2 @@ +def hello(): + return "World" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/functional/test_hello.py b/tests/functional/test_hello.py new file mode 100644 index 0000000..e165844 --- /dev/null +++ b/tests/functional/test_hello.py @@ -0,0 +1,2 @@ +def test_hello(): + assert True == True \ No newline at end of file diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/test_hello.py b/tests/unit/test_hello.py new file mode 100644 index 0000000..e165844 --- /dev/null +++ b/tests/unit/test_hello.py @@ -0,0 +1,2 @@ +def test_hello(): + assert True == True \ No newline at end of file