Skip to content

Commit 8e7d76b

Browse files
authored
Graphene v3 following v3 graphql-core (#1048)
* v3.0 - remove Python 2.x from build (#983) * Change travis to only compile for p3.6+ * Changed tox to only run Python 3.6+ * Changed library classifiers to reflect support in Python 3.6+ * Changed version to 3.0.0 development In [15]: get_version((3, 0, 0, "alpha", 0)) Out[15]: '3.0.dev20190601212304' * Reorganize Tests (#985) We no longer need a dedicated folder for Python3.6+ tests We no longer need to check six.PY3 in tests * Upgrade black to 19.3b0 (#987) * Remove six dependency (#986) * No one is using func_name * Remove six simple usages * Remove six requirement * Remove `six.with_metaclass` calls * pytest-asyncio should be a regular dependency now with Py3 move * Change dependency to graphql-core-next (#988) * Changed dependencies to core-next * Converted Scalars * ResolveInfo name change * Ignore .venv * Make Schema compatible with GraphQL-core-next * Ignore more venv names and mypy and pytest caches * Remove print statements for debugging in schema test * core-next now provides out_type and out_name * Adapt date and time scalar types to core-next * Ignore the non-standard result.invalid flag * Results are named tuples in core-next (immutable) * Enum values are returned as dict in core-next * Fix mutation tests with promises * Make all 345 tests pass with graphql-core-next * Remove the compat module which was only needed for older Py version * Remove object as base class (not needed in Py 3) * We can assume that dicts are ordered in Py 3.6+ * Make use of the fact that dicts are iterable * Use consistent style of importing from pytest * Restore compatibility with graphql-relay-py v3 Add adpaters for the PageInfo and Connection args. * Avoid various deprecation warnings * Use graphql-core 3 instead of graphql-core-next * Update dependencies, reformat changes with black * Update graphene/relay/connection.py Co-Authored-By: Jonathan Kim <[email protected]> * Run black on setup.py * Remove trailing whitespace
1 parent 3d0e460 commit 8e7d76b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1117
-2036
lines changed

.gitignore

+10-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ __pycache__/
1010

1111
# Distribution / packaging
1212
.Python
13-
env/
14-
venv/
15-
.venv/
1613
build/
1714
develop-eggs/
1815
dist/
@@ -47,7 +44,8 @@ htmlcov/
4744
.pytest_cache
4845
nosetests.xml
4946
coverage.xml
50-
*,cover
47+
*.cover
48+
.pytest_cache/
5149

5250
# Translations
5351
*.mo
@@ -62,6 +60,14 @@ docs/_build/
6260
# PyBuilder
6361
target/
6462

63+
# VirtualEnv
64+
.env
65+
.venv
66+
env/
67+
venv/
68+
69+
# Typing
70+
.mypy_cache/
6571

6672
/tests/django.sqlite
6773

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ repos:
1818
hooks:
1919
- id: pyupgrade
2020
- repo: https://github.com/ambv/black
21-
rev: 18.9b0
21+
rev: 19.3b0
2222
hooks:
2323
- id: black
2424
language_version: python3
2525
- repo: https://github.com/PyCQA/flake8
26-
rev: 3.7.7
26+
rev: 3.7.8
2727
hooks:
2828
- id: flake8

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ language: python
22
dist: xenial
33

44
python:
5-
- "2.7"
6-
- "3.5"
75
- "3.6"
86
- "3.7"
97

examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py

+34-8
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,22 @@
3030

3131
snapshots[
3232
"test_str_schema 1"
33-
] = """schema {
34-
query: Query
35-
mutation: Mutation
36-
}
37-
33+
] = '''"""A faction in the Star Wars saga"""
3834
type Faction implements Node {
35+
"""The ID of the object"""
3936
id: ID!
37+
38+
"""The name of the faction."""
4039
name: String
41-
ships(before: String, after: String, first: Int, last: Int): ShipConnection
40+
41+
"""The ships used by the faction."""
42+
ships(before: String = null, after: String = null, first: Int = null, last: Int = null): ShipConnection
4243
}
4344
4445
input IntroduceShipInput {
4546
shipName: String!
4647
factionId: String!
47-
clientMutationId: String
48+
clientMutationId: String = null
4849
}
4950
5051
type IntroduceShipPayload {
@@ -57,35 +58,60 @@
5758
introduceShip(input: IntroduceShipInput!): IntroduceShipPayload
5859
}
5960
61+
"""An object with an ID"""
6062
interface Node {
63+
"""The ID of the object"""
6164
id: ID!
6265
}
6366
67+
"""
68+
The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
69+
"""
6470
type PageInfo {
71+
"""When paginating forwards, are there more items?"""
6572
hasNextPage: Boolean!
73+
74+
"""When paginating backwards, are there more items?"""
6675
hasPreviousPage: Boolean!
76+
77+
"""When paginating backwards, the cursor to continue."""
6778
startCursor: String
79+
80+
"""When paginating forwards, the cursor to continue."""
6881
endCursor: String
6982
}
7083
7184
type Query {
7285
rebels: Faction
7386
empire: Faction
87+
88+
"""The ID of the object"""
7489
node(id: ID!): Node
7590
}
7691
92+
"""A ship in the Star Wars saga"""
7793
type Ship implements Node {
94+
"""The ID of the object"""
7895
id: ID!
96+
97+
"""The name of the ship."""
7998
name: String
8099
}
81100
82101
type ShipConnection {
102+
"""Pagination data for this connection."""
83103
pageInfo: PageInfo!
104+
105+
"""Contains the nodes in this connection."""
84106
edges: [ShipEdge]!
85107
}
86108
109+
"""A Relay edge containing a `Ship` and its cursor."""
87110
type ShipEdge {
111+
"""The item at the end of the edge"""
88112
node: Ship
113+
114+
"""A cursor for use in pagination"""
89115
cursor: String!
90116
}
91-
"""
117+
'''

graphene/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
from .utils.module_loading import lazy_import
4444

4545

46-
VERSION = (2, 1, 8, "final", 0)
46+
VERSION = (3, 0, 0, "alpha", 0)
47+
4748

4849
__version__ = get_version(VERSION)
4950

graphene/pyutils/compat.py

-21
This file was deleted.

0 commit comments

Comments
 (0)