Skip to content

Commit eeaa223

Browse files
authored
Merge branch 'main' into main
2 parents 6928b3f + 52f9921 commit eeaa223

File tree

95 files changed

+1771
-633
lines changed

Some content is hidden

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

95 files changed

+1771
-633
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ a github repo, https://repl.it or similar (you can use this template as a starti
2727

2828

2929
* **Please tell us about your environment:**
30-
31-
- Version:
32-
- Platform:
30+
31+
- Version:
32+
- Platform:
3333

3434
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

.github/workflows/deploy.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python 3.9
15-
uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- name: Set up Python 3.11
15+
uses: actions/setup-python@v4
1616
with:
17-
python-version: 3.9
17+
python-version: '3.11'
1818
- name: Build wheel and source tarball
1919
run: |
2020
pip install wheel
2121
python setup.py sdist bdist_wheel
2222
- name: Publish a Python distribution to PyPI
23-
uses: pypa/gh-action-pypi-publish@v1.1.0
23+
uses: pypa/gh-action-pypi-publish@v1.8.6
2424
with:
2525
user: __token__
2626
password: ${{ secrets.pypi_password }}

.github/workflows/lint.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Set up Python 3.9
12-
uses: actions/setup-python@v2
10+
- uses: actions/checkout@v3
11+
- name: Set up Python 3.11
12+
uses: actions/setup-python@v4
1313
with:
14-
python-version: 3.9
14+
python-version: '3.11'
1515
- name: Install dependencies
1616
run: |
1717
python -m pip install --upgrade pip
1818
pip install tox
19-
- name: Run lint 💅
19+
- name: Run pre-commit 💅
2020
run: tox
2121
env:
22-
TOXENV: flake8
22+
TOXENV: pre-commit

.github/workflows/tests.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ jobs:
88
strategy:
99
max-parallel: 4
1010
matrix:
11-
django: ["2.2", "3.0", "3.1", "3.2"]
12-
python-version: ["3.6", "3.7", "3.8", "3.9"]
13-
11+
django: ["3.2", "4.0", "4.1"]
12+
python-version: ["3.8", "3.9", "3.10"]
13+
include:
14+
- django: "3.2"
15+
python-version: "3.7"
16+
- django: "4.1"
17+
python-version: "3.11"
1418
steps:
15-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
1620
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
1822
with:
1923
python-version: ${{ matrix.python-version }}
2024
- name: Install dependencies

.pre-commit-config.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
default_language_version:
2+
python: python3.11
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.4.0
6+
hooks:
7+
- id: check-merge-conflict
8+
- id: check-json
9+
- id: check-yaml
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
exclude: ^docs/.*$
13+
- id: pretty-format-json
14+
args:
15+
- --autofix
16+
- id: trailing-whitespace
17+
exclude: README.md
18+
- repo: https://github.com/asottile/pyupgrade
19+
rev: v3.3.2
20+
hooks:
21+
- id: pyupgrade
22+
args: [--py37-plus]
23+
- repo: https://github.com/psf/black
24+
rev: 23.3.0
25+
hooks:
26+
- id: black
27+
- repo: https://github.com/PyCQA/flake8
28+
rev: 6.0.0
29+
hooks:
30+
- id: flake8

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ Then to produce a HTML version of the documentation:
5959

6060
```sh
6161
make html
62-
```
62+
```

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ recursive-include graphene_django/templates *
33
recursive-include graphene_django/static *
44

55
include examples/cookbook/cookbook/ingredients/fixtures/ingredients.json
6-
include examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json
6+
include examples/cookbook-plain/cookbook/ingredients/fixtures/ingredients.json

Makefile

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1+
.PHONY: help
2+
help:
3+
@echo "Please use \`make <target>' where <target> is one of"
4+
@grep -E '^\.PHONY: [a-zA-Z_-]+ .*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = "(: |##)"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}'
5+
16
.PHONY: dev-setup ## Install development dependencies
27
dev-setup:
38
pip install -e ".[dev]"
9+
python -m pre_commit install
410

5-
.PHONY: install-dev
6-
install-dev: dev-setup # Alias install-dev -> dev-setup
7-
8-
.PHONY: tests
11+
.PHONY: tests ## Run unit tests
912
tests:
1013
py.test graphene_django --cov=graphene_django -vv
1114

12-
.PHONY: test
13-
test: tests # Alias test -> tests
14-
15-
.PHONY: format
15+
.PHONY: format ## Format code
1616
format:
17-
black --exclude "/migrations/" graphene_django examples setup.py
17+
black graphene_django examples setup.py
1818

19-
.PHONY: lint
19+
.PHONY: lint ## Lint code
2020
lint:
2121
flake8 graphene_django examples
2222

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ from graphene_django.views import GraphQLView
5555

5656
urlpatterns = [
5757
# ...
58-
path('graphql', GraphQLView.as_view(graphiql=True)),
58+
path('graphql/', GraphQLView.as_view(graphiql=True)),
5959
]
6060
```
6161

docs/authorization.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ For Django 2.2 and above:
198198
199199
urlpatterns = [
200200
# some other urls
201-
path('graphql', PrivateGraphQLView.as_view(graphiql=True, schema=schema)),
201+
path('graphql/', PrivateGraphQLView.as_view(graphiql=True, schema=schema)),
202202
]
203203
204204
.. _LoginRequiredMixin: https://docs.djangoproject.com/en/dev/topics/auth/default/#the-loginrequired-mixin

docs/filtering.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Filtering
22
=========
33

44
Graphene integrates with
5-
`django-filter <https://django-filter.readthedocs.io/en/master/>`__ to provide filtering of results.
6-
See the `usage documentation <https://django-filter.readthedocs.io/en/master/guide/usage.html#the-filter>`__
5+
`django-filter <https://django-filter.readthedocs.io/en/stable/>`__ to provide filtering of results.
6+
See the `usage documentation <https://django-filter.readthedocs.io/en/stable/guide/usage.html#the-filter>`__
77
for details on the format for ``filter_fields``.
88

99
This filtering is automatically available when implementing a ``relay.Node``.
@@ -26,15 +26,15 @@ After installing ``django-filter`` you'll need to add the application in the ``s
2626
]
2727
2828
Note: The techniques below are demoed in the `cookbook example
29-
app <https://github.com/graphql-python/graphene-django/tree/master/examples/cookbook>`__.
29+
app <https://github.com/graphql-python/graphene-django/tree/main/examples/cookbook>`__.
3030

3131
Filterable fields
3232
-----------------
3333

3434
The ``filter_fields`` parameter is used to specify the fields which can
3535
be filtered upon. The value specified here is passed directly to
3636
``django-filter``, so see the `filtering
37-
documentation <https://django-filter.readthedocs.io/en/master/guide/usage.html#the-filter>`__
37+
documentation <https://django-filter.readthedocs.io/en/main/guide/usage.html#the-filter>`__
3838
for full details on the range of options available.
3939

4040
For example:
@@ -192,7 +192,7 @@ in unison with the ``filter_fields`` parameter:
192192
all_animals = DjangoFilterConnectionField(AnimalNode)
193193
194194
195-
The context argument is passed on as the `request argument <http://django-filter.readthedocs.io/en/master/guide/usage.html#request-based-filtering>`__
195+
The context argument is passed on as the `request argument <http://django-filter.readthedocs.io/en/main/guide/usage.html#request-based-filtering>`__
196196
in a ``django_filters.FilterSet`` instance. You can use this to customize your
197197
filters to be context-dependent. We could modify the ``AnimalFilter`` above to
198198
pre-filter animals owned by the authenticated user (set in ``context.user``).

docs/queries.rst

+20-20
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ For example the following ``Model`` and ``DjangoObjectType``:
151151
152152
Results in the following GraphQL schema definition:
153153

154-
.. code::
154+
.. code:: graphql
155155
156156
type Pet {
157157
id: ID!
@@ -178,7 +178,7 @@ You can disable this automatic conversion by setting
178178
fields = ("id", "kind",)
179179
convert_choices_to_enum = False
180180
181-
.. code::
181+
.. code:: graphql
182182
183183
type Pet {
184184
id: ID!
@@ -313,7 +313,7 @@ Additionally, Resolvers will receive **any arguments declared in the field defin
313313
bar=graphene.Int()
314314
)
315315
316-
def resolve_question(root, info, foo, bar):
316+
def resolve_question(root, info, foo=None, bar=None):
317317
# If `foo` or `bar` are declared in the GraphQL query they will be here, else None.
318318
return Question.objects.filter(foo=foo, bar=bar).first()
319319
@@ -336,12 +336,12 @@ of Django's ``HTTPRequest`` in your resolve methods, such as checking for authen
336336
class Query(graphene.ObjectType):
337337
questions = graphene.List(QuestionType)
338338
339-
def resolve_questions(root, info):
340-
# See if a user is authenticated
341-
if info.context.user.is_authenticated():
342-
return Question.objects.all()
343-
else:
344-
return Question.objects.none()
339+
def resolve_questions(root, info):
340+
# See if a user is authenticated
341+
if info.context.user.is_authenticated():
342+
return Question.objects.all()
343+
else:
344+
return Question.objects.none()
345345
346346
347347
DjangoObjectTypes
@@ -418,29 +418,29 @@ the core graphene pages for more information on customizing the Relay experience
418418
You can now execute queries like:
419419

420420

421-
.. code:: python
421+
.. code:: graphql
422422
423423
{
424424
questions (first: 2, after: "YXJyYXljb25uZWN0aW9uOjEwNQ==") {
425425
pageInfo {
426-
startCursor
427-
endCursor
428-
hasNextPage
429-
hasPreviousPage
426+
startCursor
427+
endCursor
428+
hasNextPage
429+
hasPreviousPage
430430
}
431431
edges {
432-
cursor
433-
node {
434-
id
435-
question_text
436-
}
432+
cursor
433+
node {
434+
id
435+
question_text
436+
}
437437
}
438438
}
439439
}
440440
441441
Which returns:
442442

443-
.. code:: python
443+
.. code:: json
444444
445445
{
446446
"data": {

0 commit comments

Comments
 (0)