diff --git a/.gitignore b/.gitignore
index 89b1585..c853211 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@
 /build/
 
 /dist/
+/venv/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..f573d1a
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,30 @@
+-   repo: https://github.com/pre-commit/pre-commit-hooks.git
+    sha: v0.7.1
+    hooks:
+    -   id: autopep8-wrapper
+    -   id: check-added-large-files
+    -   id: check-ast
+    -   id: check-byte-order-marker
+    -   id: check-case-conflict
+    -   id: check-docstring-first
+    -   id: check-json
+    -   id: check-merge-conflict
+    -   id: check-yaml
+    -   id: debug-statements
+    -   id: double-quote-string-fixer
+    -   id: end-of-file-fixer
+    -   id: flake8
+    -   id: fix-encoding-pragma
+    -   id: name-tests-test
+    -   id: pretty-format-json
+        args: ['--autofix']
+    -   id: requirements-txt-fixer
+    -   id: trailing-whitespace
+-   repo: https://github.com/asottile/pyupgrade
+    sha: v1.0.4
+    hooks:
+    -   id: pyupgrade
+-   repo: https://github.com/asottile/reorder_python_imports
+    sha: v0.3.2
+    hooks:
+    -   id: reorder-python-imports
diff --git a/flask_graphql/__init__.py b/flask_graphql/__init__.py
index 4c30423..4ab5caa 100644
--- a/flask_graphql/__init__.py
+++ b/flask_graphql/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 from .blueprint import GraphQL
 from .graphqlview import GraphQLView
 
diff --git a/flask_graphql/blueprint.py b/flask_graphql/blueprint.py
index b02266a..5416080 100644
--- a/flask_graphql/blueprint.py
+++ b/flask_graphql/blueprint.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 import warnings
 
 from flask import Blueprint
diff --git a/flask_graphql/graphqlview.py b/flask_graphql/graphqlview.py
index a4e2515..d611efd 100644
--- a/flask_graphql/graphqlview.py
+++ b/flask_graphql/graphqlview.py
@@ -1,16 +1,21 @@
+# -*- coding: utf-8 -*-
 import json
 
 import six
-from flask import Response, request
+from flask import request
+from flask import Response
 from flask.views import View
-from werkzeug.exceptions import BadRequest, MethodNotAllowed
-
-from graphql import Source, execute, parse, validate
+from graphql import execute
+from graphql import parse
+from graphql import Source
+from graphql import validate
 from graphql.error import format_error as format_graphql_error
 from graphql.error import GraphQLError
 from graphql.execution import ExecutionResult
 from graphql.type.schema import GraphQLSchema
 from graphql.utils.get_operation_ast import get_operation_ast
+from werkzeug.exceptions import BadRequest
+from werkzeug.exceptions import MethodNotAllowed
 
 from .render_graphiql import render_graphiql
 
diff --git a/flask_graphql/render_graphiql.py b/flask_graphql/render_graphiql.py
index c3a3374..79c5814 100644
--- a/flask_graphql/render_graphiql.py
+++ b/flask_graphql/render_graphiql.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 from flask import render_template_string
 
 
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..f9c7f0d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+pre-commit==0.13.3
diff --git a/setup.py b/setup.py
index 25e8379..5042917 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,6 @@
-from setuptools import setup, find_packages
+# -*- coding: utf-8 -*-
+from setuptools import find_packages
+from setuptools import setup
 
 required_packages = ['graphql-core>=1.0', 'flask>=0.7.0']
 
diff --git a/tests/app.py b/tests/app.py
index 9f11aee..a079e32 100644
--- a/tests/app.py
+++ b/tests/app.py
@@ -1,6 +1,8 @@
+# -*- coding: utf-8 -*-
 from flask import Flask
-from flask_graphql import GraphQLView
+
 from .schema import Schema
+from flask_graphql import GraphQLView
 
 
 def create_app(path='/graphql', **kwargs):
diff --git a/tests/schema.py b/tests/schema.py
index 742ca09..06c2d6a 100644
--- a/tests/schema.py
+++ b/tests/schema.py
@@ -1,10 +1,14 @@
-from graphql.type.definition import GraphQLArgument, GraphQLField, GraphQLNonNull, GraphQLObjectType
+# -*- coding: utf-8 -*-
+from graphql.type.definition import GraphQLArgument
+from graphql.type.definition import GraphQLField
+from graphql.type.definition import GraphQLNonNull
+from graphql.type.definition import GraphQLObjectType
 from graphql.type.scalars import GraphQLString
 from graphql.type.schema import GraphQLSchema
 
 
 def resolve_raises(*_):
-    raise Exception("Throws!")
+    raise Exception('Throws!')
 
 
 QueryRootType = GraphQLObjectType(
diff --git a/tests/test_graphiqlview.py b/tests/test_graphiqlview.py
index 4a468e2..41bb583 100644
--- a/tests/test_graphiqlview.py
+++ b/tests/test_graphiqlview.py
@@ -1,7 +1,8 @@
+# -*- coding: utf-8 -*-
 import pytest
+from flask import url_for
 
 from .app import create_app
-from flask import url_for
 
 
 @pytest.fixture
@@ -23,6 +24,6 @@ def test_graphiql_renders_pretty(client):
         '    "test": "Hello World"\n'
         '  }\n'
         '}'
-    ).replace("\"","\\\"").replace("\n","\\n")
+    ).replace("\"", "\\\"").replace('\n', '\\n')
 
     assert pretty_response in response.data.decode('utf-8')
diff --git a/tests/test_graphqlview.py b/tests/test_graphqlview.py
index 1efcfbc..3c08e59 100644
--- a/tests/test_graphqlview.py
+++ b/tests/test_graphqlview.py
@@ -1,6 +1,8 @@
-import pytest
+# -*- coding: utf-8 -*-
 import json
 
+import pytest
+
 try:
     from StringIO import StringIO
 except ImportError:
@@ -19,6 +21,7 @@
 def app():
     return create_app()
 
+
 def url_string(**url_params):
     string = url_for('graphql')
 
@@ -41,19 +44,19 @@ def test_allows_get_with_query_param(client):
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello World"}
+        'data': {'test': 'Hello World'}
     }
 
 
 def test_allows_get_with_variable_values(client):
     response = client.get(url_string(
         query='query helloWho($who: String){ test(who: $who) }',
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     ))
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
@@ -163,7 +166,7 @@ def test_allows_mutation_to_exist_within_a_get(client):
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello World"}
+        'data': {'test': 'Hello World'}
     }
 
 
@@ -172,12 +175,16 @@ def test_allows_post_with_json_encoding(client):
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello World"}
+        'data': {'test': 'Hello World'}
     }
 
 
 def test_allows_sending_a_mutation_via_post(client):
-    response = client.post(url_string(), data=j(query='mutation TestMutation { writeTest { test } }'), content_type='application/json')
+    response = client.post(
+        url_string(),
+        data=j(query='mutation TestMutation { writeTest { test } }'),
+        content_type='application/json'
+    )
 
     assert response.status_code == 200
     assert response_json(response) == {
@@ -186,79 +193,83 @@ def test_allows_sending_a_mutation_via_post(client):
 
 
 def test_allows_post_with_url_encoding(client):
-    response = client.post(url_string(), data=urlencode(dict(query='{test}')), content_type='application/x-www-form-urlencoded')
+    response = client.post(
+        url_string(),
+        data=urlencode(dict(query='{test}')),
+        content_type='application/x-www-form-urlencoded'
+    )
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello World"}
+        'data': {'test': 'Hello World'}
     }
 
 
 def test_supports_post_json_query_with_string_variables(client):
     response = client.post(url_string(), data=j(
         query='query helloWho($who: String){ test(who: $who) }',
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     ), content_type='application/json')
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
 def test_supports_post_json_query_with_json_variables(client):
     response = client.post(url_string(), data=j(
         query='query helloWho($who: String){ test(who: $who) }',
-        variables={'who': "Dolly"}
+        variables={'who': 'Dolly'}
     ), content_type='application/json')
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
 def test_supports_post_url_encoded_query_with_string_variables(client):
     response = client.post(url_string(), data=urlencode(dict(
         query='query helloWho($who: String){ test(who: $who) }',
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     )), content_type='application/x-www-form-urlencoded')
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
 def test_supports_post_json_quey_with_get_variable_values(client):
     response = client.post(url_string(
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     ), data=j(
         query='query helloWho($who: String){ test(who: $who) }',
     ), content_type='application/json')
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
 def test_post_url_encoded_query_with_get_variable_values(client):
     response = client.post(url_string(
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     ), data=urlencode(dict(
         query='query helloWho($who: String){ test(who: $who) }',
     )), content_type='application/x-www-form-urlencoded')
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
 def test_supports_post_raw_text_query_with_get_variable_values(client):
     response = client.post(url_string(
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     ),
         data='query helloWho($who: String){ test(who: $who) }',
         content_type='application/graphql'
@@ -266,7 +277,7 @@ def test_supports_post_raw_text_query_with_get_variable_values(client):
 
     assert response.status_code == 200
     assert response_json(response) == {
-        'data': {'test': "Hello Dolly"}
+        'data': {'test': 'Hello Dolly'}
     }
 
 
@@ -396,7 +407,7 @@ def test_handles_incomplete_json_bodies(client):
 
 def test_handles_plain_post_text(client):
     response = client.post(url_string(
-        variables=json.dumps({'who': "Dolly"})
+        variables=json.dumps({'who': 'Dolly'})
     ),
         data='query helloWho($who: String){ test(who: $who) }',
         content_type='text/plain'
@@ -438,11 +449,10 @@ def test_passes_request_into_request_context(client):
     }
 
 
-@pytest.mark.parametrize('app', [create_app(context="CUSTOM CONTEXT")])
+@pytest.mark.parametrize('app', [create_app(context='CUSTOM CONTEXT')])
 def test_supports_pretty_printing(client):
     response = client.get(url_string(query='{context}'))
 
-
     assert response.status_code == 200
     assert response_json(response) == {
         'data': {
@@ -455,7 +465,7 @@ def test_post_multipart_data(client):
     query = 'mutation TestMutation { writeTest { test } }'
     response = client.post(
         url_string(),
-        data= {
+        data={
             'query': query,
             'file': (StringIO(), 'text1.txt'),
         },
@@ -477,7 +487,7 @@ def test_batch_allows_post_with_json_encoding(client):
     assert response.status_code == 200
     assert response_json(response) == [{
         'id': 1,
-        'payload': { 'data': {'test': "Hello World"} },
+        'payload': {'data': {'test': 'Hello World'}},
         'status': 200,
     }]
 
@@ -489,7 +499,7 @@ def test_batch_supports_post_json_query_with_json_variables(client):
         data=jl(
             id=1,
             query='query helloWho($who: String){ test(who: $who) }',
-            variables={'who': "Dolly"}
+            variables={'who': 'Dolly'}
         ),
         content_type='application/json'
     )
@@ -497,11 +507,11 @@ def test_batch_supports_post_json_query_with_json_variables(client):
     assert response.status_code == 200
     assert response_json(response) == [{
         'id': 1,
-        'payload': { 'data': {'test': "Hello Dolly"} },
+        'payload': {'data': {'test': 'Hello Dolly'}},
         'status': 200,
     }]
- 
-          
+
+
 @pytest.mark.parametrize('app', [create_app(batch=True)])
 def test_batch_allows_post_with_operation_name(client):
     response = client.post(
diff --git a/tox.ini b/tox.ini
index 9d79799..4ae4ccc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -28,3 +28,6 @@ deps =
     Flask>=0.10.0
 commands =
     isort --check-only flask_graphql/ -rc
+
+[pep8]
+max-line-length=120