You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-13Lines changed: 47 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,7 @@
2
2
3
3
GraphQL for Python.
4
4
5
-
*This library is a port of [graphql-js](https://github.com/graphql/graphql-js) to Python and currently is up-to-date with release [0.6.0](https://github.com/graphql/graphql-js/releases/tag/v0.6.0).*
6
-
5
+
_This library is a port of [graphql-js](https://github.com/graphql/graphql-js) to Python and currently is up-to-date with release [0.6.0](https://github.com/graphql/graphql-js/releases/tag/v0.6.0)._
@@ -17,13 +16,13 @@ For questions, ask [Stack Overflow](http://stackoverflow.com/questions/tagged/gr
17
16
18
17
## Getting Started
19
18
20
-
An overview of the GraphQL language is available in the
19
+
An overview of the GraphQL language is available in the
21
20
[README](https://github.com/facebook/graphql/blob/master/README.md) for the
22
-
[Specification for GraphQL](https://github.com/facebook/graphql).
21
+
[Specification for GraphQL](https://github.com/facebook/graphql).
23
22
24
23
The overview describes a simple set of GraphQL examples that exist as [tests](https://github.com/graphql-python/graphql-core/tree/master/tests/)
25
24
in this repository. A good way to get started is to walk through that README and the corresponding tests
26
-
in parallel.
25
+
in parallel.
27
26
28
27
### Using graphql-core
29
28
@@ -98,11 +97,11 @@ print result.errors
98
97
The graphql query is executed, by default, synchronously (using `SyncExecutor`).
99
98
However the following executors are available if we want to resolve our fields in parallel:
100
99
101
-
*`graphql.execution.executors.asyncio.AsyncioExecutor`: This executor executes the resolvers in the Python asyncio event loop.
102
-
*`graphql.execution.executors.gevent.GeventExecutor`: This executor executes the resolvers in the Gevent event loop.
103
-
*`graphql.execution.executors.process.ProcessExecutor`: This executor executes each resolver as a process.
104
-
*`graphql.execution.executors.thread.ThreadExecutor`: This executor executes each resolver in a Thread.
105
-
*`graphql.execution.executors.sync.SyncExecutor`: This executor executes each resolver synchronusly (default).
100
+
-`graphql.execution.executors.asyncio.AsyncioExecutor`: This executor executes the resolvers in the Python asyncio event loop.
101
+
-`graphql.execution.executors.gevent.GeventExecutor`: This executor executes the resolvers in the Gevent event loop.
102
+
-`graphql.execution.executors.process.ProcessExecutor`: This executor executes each resolver as a process.
103
+
-`graphql.execution.executors.thread.ThreadExecutor`: This executor executes each resolver in a Thread.
104
+
-`graphql.execution.executors.sync.SyncExecutor`: This executor executes each resolver synchronusly (default).
106
105
107
106
#### Usage
108
107
@@ -114,11 +113,46 @@ from graphql.execution.execute import execute
114
113
execute(schema, ast, executor=SyncExecutor())
115
114
```
116
115
116
+
### Contributing
117
+
118
+
After cloning this repo, create a [virtualenv](https://virtualenv.pypa.io/en/stable/) and ensure dependencies are installed by running:
119
+
120
+
```sh
121
+
virtualenv venv
122
+
source venv/bin/activate
123
+
pip install -e ".[test]"
124
+
```
125
+
126
+
Well-written tests and maintaining good test coverage is important to this project. While developing, run new and existing tests with:
127
+
128
+
```sh
129
+
py.test PATH/TO/MY/DIR/test_test.py # Single file
130
+
py.test PATH/TO/MY/DIR/ # All tests in directory
131
+
```
132
+
133
+
Add the `-s` flag if you have introduced breakpoints into the code for debugging.
134
+
Add the `-v` ("verbose") flag to get more detailed test output. For even more detailed output, use `-vv`.
135
+
Check out the [pytest documentation](https://docs.pytest.org/en/latest/) for more options and test running controls.
136
+
137
+
GraphQL-core supports several versions of Python. To make sure that changes do not break compatibility with any of those versions, we use `tox` to create virtualenvs for each python version and run tests with that version. To run against all python versions defined in the `tox.ini` config file, just run:
138
+
139
+
```sh
140
+
tox
141
+
```
142
+
143
+
If you wish to run against a specific version defined in the `tox.ini` file:
144
+
145
+
```sh
146
+
tox -e py36
147
+
```
148
+
149
+
Tox can only use whatever versions of python are installed on your system. When you create a pull request, Travis will also be running the same tests and report the results, so there is no need for potential contributors to try to install every single version of python on their own system ahead of time. We appreciate opening issues and pull requests to make GraphQL-core even more stable & useful!
0 commit comments