Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile docs in GitHub Actions CI #1620

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/validate.yaml
Expand Up @@ -9,6 +9,7 @@ on:
env:
FORCE_COLOR: 1
XDG_CACHE_HOME: ${{ github.workspace }}/cache
DEFAULT_PYTHON: "3.7"

jobs:
validate:
Expand Down Expand Up @@ -90,3 +91,33 @@ jobs:
flake8 --exit-zero rdflib
mypy --show-error-context --show-error-codes
"${test_harness[@]}" pytest -ra --cov
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{env.DEFAULT_PYTHON}}
uses: actions/setup-python@v2
with:
python-version: ${{env.DEFAULT_PYTHON}}
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
python -m ensurepip --upgrade
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: docs-pip-v1-${{
hashFiles('**/setup.py', '**/requirements*.txt') }}
restore-keys: |
docs-pip-v1-
- name: Install dependencies
shell: bash
run: |
python -m pip install tox
- name: Build docs
shell: bash
run: |
python -m tox -e docs
4 changes: 2 additions & 2 deletions docs/developers.rst
Expand Up @@ -11,9 +11,9 @@ developing RDFLib code.

* Please be as Pythonic as possible (:pep:`8`).
* Code should be formatted using `black <https://github.com/psf/black>`_
and we use Black v21.9b0, with the black.toml config file provided.
and we use Black v21.9b0, with the black.toml config file provided.
* Code should also pass `flake8 <https://github.com/psf/black>`_ linting
and `mypy <http://mypy-lang.org/>`_ type checking.
and `mypy <http://mypy-lang.org/>`_ type checking.
* You must supply tests for new code

If you add a new cool feature, consider also adding an example in ``./examples``
Expand Down
10 changes: 5 additions & 5 deletions docs/intro_to_parsing.rst
Expand Up @@ -104,13 +104,13 @@ The following table lists the RDF formats you can serialize data to with rdflib,

"Turtle", "turtle, ttl or turtle2", "turtle2 is just turtle with more spacing & linebreaks"
"RDF/XML", "xml or pretty-xml", "Was the default format, rdflib < 6.0.0"
"JSON-LD", "json-ld", "There are further options for compact syntax and other JSON-LD variants"
"JSON-LD", "json-ld", "There are further options for compact syntax and other JSON-LD variants"
"N-Triples", "ntriples, nt or nt11", "nt11 is exactly like nt, only utf8 encoded"
"Notation-3","n3", "N3 is a superset of Turtle that also caters for rules and a few other things"
"Trig", "trig", "Turtle-like format for RDF triples + context (RDF quads) and thus multiple graphs"
"Trix", "trix", "RDF/XML-like format for RDF quads"
"N-Quads", "nquads", "N-Triples-like format for RDF quads"

"Trig", "trig", "Turtle-like format for RDF triples + context (RDF quads) and thus multiple graphs"
"Trix", "trix", "RDF/XML-like format for RDF quads"
"N-Quads", "nquads", "N-Triples-like format for RDF quads"

Working with multi-graphs
-------------------------
Expand Down
1 change: 1 addition & 0 deletions rdflib/namespace/__init__.py
Expand Up @@ -74,6 +74,7 @@
* XSD

.. code-block:: pycon

>>> from rdflib.namespace import RDFS
>>> RDFS.seeAlso
rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#seeAlso')
Expand Down
24 changes: 12 additions & 12 deletions rdflib/plugins/stores/sparqlstore.py
Expand Up @@ -208,6 +208,7 @@ def triples(self, spo, context=None):

**context** may include three parameter
to refine the underlying query:

* LIMIT: an integer to limit the number of results
* OFFSET: an integer to enable paging of results
* ORDERBY: an instance of Variable('s'), Variable('o') or Variable('p') or, by default, the first 'None' from the given triple
Expand All @@ -219,17 +220,15 @@ def triples(self, spo, context=None):
the walking path on the graph)
- Using OFFSET without defining LIMIT will discard the first OFFSET - 1 results

``
a_graph.LIMIT = limit
a_graph.OFFSET = offset
triple_generator = a_graph.triples(mytriple):
# do something
# Removes LIMIT and OFFSET if not required for the next triple() calls
del a_graph.LIMIT
del a_graph.OFFSET
``

.. code-block:: python

a_graph.LIMIT = limit
a_graph.OFFSET = offset
triple_generator = a_graph.triples(mytriple):
# do something
# Removes LIMIT and OFFSET if not required for the next triple() calls
del a_graph.LIMIT
del a_graph.OFFSET
"""

s, p, o = spo
Expand Down Expand Up @@ -536,9 +535,9 @@ def __init__(
self._updates = 0

def open(self, configuration: Union[str, Tuple[str, str]], create=False):
"""This method is included so that calls to this Store via Graph, e.g.
"""
This method is included so that calls to this Store via Graph, e.g.
Graph("SPARQLStore"), can set the required parameters

"""
if type(configuration) == str:
self.query_endpoint = configuration # type: ignore[assignment]
Expand Down Expand Up @@ -575,6 +574,7 @@ def __len__(self, *args, **kwargs):
def open(self, configuration, create=False): # type: ignore[no-redef]
"""
sets the endpoint URLs for this SPARQLStore

:param configuration: either a tuple of (query_endpoint, update_endpoint),
or a string with the endpoint which is configured as query and update endpoint
:param create: if True an exception is thrown.
Expand Down
12 changes: 12 additions & 0 deletions tox.ini
Expand Up @@ -33,3 +33,15 @@ commands =
deps =
-rrequirements.txt
-rrequirements.dev.txt

[testenv:docs]
basepython =
python3.7
deps =
extras =
docs
passenv = TERM
setenv =
PYTHONHASHSEED = 0
commands =
sphinx-build -n -T -b html -d {envtmpdir}/doctrees docs docs/_build/html