From 89410522896bcf149abefb820d679dfbc5f1402e Mon Sep 17 00:00:00 2001 From: pdesai-crest Date: Sun, 5 Jun 2022 04:15:10 +0530 Subject: [PATCH 1/2] bumped up for py 3.9 --- examples/basic.py | 7 ++++--- examples/jwt_in_header.py | 2 +- examples/user_claims.py | 2 +- requirements.txt | 17 ----------------- requirements_test.txt | 3 --- setup.py | 23 ++++++++++++++++++++++- tests/conftest.py | 5 +++-- 7 files changed, 31 insertions(+), 28 deletions(-) delete mode 100644 requirements.txt delete mode 100644 requirements_test.txt diff --git a/examples/basic.py b/examples/basic.py index 8dc0a8d..4e10a7a 100644 --- a/examples/basic.py +++ b/examples/basic.py @@ -11,15 +11,16 @@ mutation_jwt_refresh_token_required, mutation_jwt_required, ) -from flask_graphql import GraphQLView +from graphql_server.flask.graphqlview import GraphQLView app = Flask(__name__) -auth = GraphQLAuth(app) app.config["JWT_SECRET_KEY"] = "something" # change this! app.config["JWT_ACCESS_TOKEN_EXPIRES"] = 10 # 10 minutes app.config["JWT_REFRESH_TOKEN_EXPIRES"] = 30 # 30 days +auth = GraphQLAuth(app) + class MessageField(graphene.ObjectType): message = graphene.String() @@ -86,7 +87,7 @@ class Mutation(graphene.ObjectType): class Query(graphene.ObjectType): - protected = graphene.Field(type=ProtectedUnion, token=graphene.String()) + protected = graphene.Field(type_=ProtectedUnion, token=graphene.String()) @query_jwt_required def resolve_protected(self, info): diff --git a/examples/jwt_in_header.py b/examples/jwt_in_header.py index 6198107..93d13a0 100644 --- a/examples/jwt_in_header.py +++ b/examples/jwt_in_header.py @@ -10,7 +10,7 @@ mutation_header_jwt_refresh_token_required, mutation_header_jwt_required, ) -from flask_graphql import GraphQLView +from graphql_server.flask.graphqlview import GraphQLView app = Flask(__name__) auth = GraphQLAuth(app) diff --git a/examples/user_claims.py b/examples/user_claims.py index 7bccd44..1e60bbd 100644 --- a/examples/user_claims.py +++ b/examples/user_claims.py @@ -11,7 +11,7 @@ mutation_jwt_required, mutation_jwt_refresh_token_required, ) -from flask_graphql import GraphQLView +from graphql_server.flask.graphqlview import GraphQLView app = Flask(__name__) auth = GraphQLAuth(app) diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 0f5ba3c..0000000 --- a/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -aniso8601==7.0.0 -click==7.1.2 -Flask==1.1.2 -Flask-GraphQL==2.0.1 -Flask-GraphQL-Auth==1.3.2 -graphene==2.1.8 -graphql-core==2.3.2 -graphql-relay==2.0.1 -graphql-server-core==1.2.0 -itsdangerous==1.1.0 -Jinja2==2.11.3 -MarkupSafe==1.1.1 -promise==2.3 -PyJWT==2.0.1 -Rx==1.6.1 -six==1.15.0 -Werkzeug==1.0.1 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index bc38417..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest==4.4.2 -pytest-cov==2.7.1 -coverage==4.5.3 diff --git a/setup.py b/setup.py index 7a3d2f0..5500444 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,22 @@ except IndexError: raise RuntimeError("Unable to determine version.") +install_requires = [ + "flask", + "graphene", + "PyJWT==2.0.1" +] + +tests_requires = [ + "pytest==4.4.2", + "pytest-cov==2.7.1", + "coverage==4.5.3", + "pytest", + "graphql_server==3.0.0b5" +] + +dev_requires = [] + tests_requires + setup( name="Flask-GraphQL-Auth", @@ -25,7 +41,12 @@ long_description=long_description, long_description_content_type="text/markdown", packages=["flask_graphql_auth"], - install_requires=["PyJWT==2.0.1", "Flask-GraphQL", "graphene", "flask"], + install_requires=install_requires, + tests_requires=tests_requires, + extras_require={ + 'test': tests_requires, + 'dev': dev_requires, + }, classifiers=[ "Development Status :: 3 - Alpha", "Environment :: Web Environment", diff --git a/tests/conftest.py b/tests/conftest.py index 9dae997..815428d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,7 +3,7 @@ from flask import Flask import graphene from flask_graphql_auth import GraphQLAuth -from flask_graphql import GraphQLView +from graphql_server.flask.graphqlview import GraphQLView from examples.basic import Mutation, Query @@ -11,12 +11,13 @@ @pytest.fixture(scope="function") def flask_app(): app = Flask(__name__) - auth = GraphQLAuth(app) app.config["JWT_SECRET_KEY"] = "something" app.config["JWT_ACCESS_TOKEN_EXPIRES"] = 10 app.config["JWT_REFRESH_TOKEN_EXPIRES"] = 30 + auth = GraphQLAuth(app) + schema = graphene.Schema(query=Query, mutation=Mutation) app.add_url_rule( From ef9b0cecb9c530da884161ba78f4cff299db6d7c Mon Sep 17 00:00:00 2001 From: desaiparv5 Date: Sun, 5 Jun 2022 04:39:33 +0530 Subject: [PATCH 2/2] bumped pyjwt --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5500444..5731509 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ install_requires = [ "flask", "graphene", - "PyJWT==2.0.1" + "PyJWT==2.4.0" ] tests_requires = [