Skip to content

Commit 6e8dce9

Browse files
authored
Update doc setup (#673)
* Expose doc commands in root makefile and add autobuild * Fix some errors * Alias some commands and add PHONY
1 parent 775d2e3 commit 6e8dce9

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1+
.PHONY: dev-setup ## Install development dependencies
12
dev-setup:
23
pip install -e ".[dev]"
34

5+
.PHONY: install-dev
6+
install-dev: dev-setup # Alias install-dev -> dev-setup
7+
8+
.PHONY: tests
49
tests:
510
py.test graphene_django --cov=graphene_django -vv
611

12+
.PHONY: test
13+
test: tests # Alias test -> tests
14+
15+
.PHONY: format
716
format:
817
black --exclude "/migrations/" graphene_django examples
918

19+
.PHONY: lint
1020
lint:
1121
flake8 graphene_django examples
22+
23+
.PHONY: docs ## Generate docs
24+
docs: dev-setup
25+
cd docs && make install && make html
26+
27+
.PHONY: docs-live ## Generate docs with live reloading
28+
docs-live: dev-setup
29+
cd docs && make install && make livehtml

docs/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,20 @@ help:
4848
clean:
4949
rm -rf $(BUILDDIR)/*
5050

51+
.PHONY: install ## to install all documentation related requirements
52+
install:
53+
pip install -r requirements.txt
54+
5155
.PHONY: html
5256
html:
5357
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5458
@echo
5559
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
5660

61+
.PHONY: livehtml ## to build and serve live-reloading documentation
62+
livehtml:
63+
sphinx-autobuild -b html --watch ../graphene_django $(ALLSPHINXOPTS) $(BUILDDIR)/html
64+
5765
.PHONY: dirhtml
5866
dirhtml:
5967
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml

docs/_static/.gitkeep

Whitespace-only changes.

docs/authorization.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ Adding Login Required
154154
To restrict users from accessing the GraphQL API page the standard Django LoginRequiredMixin_ can be used to create your own standard Django Class Based View, which includes the ``LoginRequiredMixin`` and subclasses the ``GraphQLView``.:
155155

156156
.. code:: python
157-
#views.py
157+
158+
# views.py
158159
159160
from django.contrib.auth.mixins import LoginRequiredMixin
160161
from graphene_django.views import GraphQLView

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
sphinx
1+
Sphinx==1.5.3
2+
sphinx-autobuild==0.7.1
23
# Docs template
34
http://graphene-python.org/sphinx_graphene_theme.zip

docs/settings.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Default: ``None``
3030
3131
3232
``SCHEMA_OUTPUT``
33-
----------
33+
-----------------
3434

3535
The name of the file where the GraphQL schema output will go.
3636

@@ -44,7 +44,7 @@ Default: ``schema.json``
4444
4545
4646
``SCHEMA_INDENT``
47-
----------
47+
-----------------
4848

4949
The indentation level of the schema output.
5050

@@ -58,7 +58,7 @@ Default: ``2``
5858
5959
6060
``MIDDLEWARE``
61-
----------
61+
--------------
6262

6363
A tuple of middleware that will be executed for each GraphQL query.
6464

@@ -76,7 +76,7 @@ Default: ``()``
7676
7777
7878
``RELAY_CONNECTION_ENFORCE_FIRST_OR_LAST``
79-
----------
79+
------------------------------------------
8080

8181
Enforces relay queries to have the ``first`` or ``last`` argument.
8282

@@ -90,7 +90,7 @@ Default: ``False``
9090
9191
9292
``RELAY_CONNECTION_MAX_LIMIT``
93-
----------
93+
------------------------------
9494

9595
The maximum size of objects that can be requested through a relay connection.
9696

0 commit comments

Comments
 (0)