Skip to content

Commit 56bee18

Browse files
author
nicholascar
committed
Merge branch 'master' into default_prefixes
2 parents f9a2617 + 03c5e79 commit 56bee18

File tree

112 files changed

+798
-192
lines changed

Some content is hidden

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

112 files changed

+798
-192
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!--
2+
Thank you for your contribution to this project. This project has no formal
3+
funding or full-time maintainers and relies entirely on independent
4+
contributors to keep it alive and relevant.
5+
6+
This pull request template includes some guidelines intended to help
7+
contributors, not to deter contributions. While we prefer that PRs follow our
8+
guidelines, we will not reject PRs solely on the basis that they do not, though
9+
we may take longer to process them as in most cases the remaining work will
10+
have to be done by someone else.
11+
12+
If you have any questions regarding our guidelines, submit the PR as is
13+
and ask.
14+
15+
More detailed guidelines for pull requests are provided in our [developers
16+
guide](https://github.com/RDFLib/rdflib/blob/master/docs/developers.rst).
17+
18+
As a reminder, PRs that are smaller in size and scope will be reviewed and
19+
merged quicker, so please consider if your PR could be split up into more than
20+
one independent part before submitting it, no PR is too small. The maintainers
21+
of this project may also split up larger PRs into smaller more manageable PRs
22+
if they deem it necessary.
23+
24+
PRs should be reviewed and approved by at least two people other than the
25+
author using GitHub's review system before being merged. Reviews are open to
26+
anyone, so please consider reviewing other open pull requests as this will also
27+
free up the capacity required for your PR to be reviewed.
28+
-->
29+
30+
# Summary of changes
31+
32+
<!--
33+
Briefly explain what changes the pull request is making and why. Ideally this
34+
should cover all changes in the pull request as the changes will be reviewed
35+
against this summary to ensure that the PR does not include unintended changes.
36+
37+
Please also explicitly state if the PR makes any changes that are not backwards
38+
compatible.
39+
-->
40+
41+
# Checklist
42+
43+
<!--
44+
If an item on this list doesn't apply to your pull request, just remove it.
45+
46+
If, for some reason, you can't check some items on the checklist, or you are
47+
unsure about them, submit your PR as is and ask for help.
48+
-->
49+
50+
- [ ] Checked that there aren't other open pull requests for
51+
the same change.
52+
- [ ] Added tests for any changes that have a runtime impact.
53+
- [ ] Checked that all tests and type checking passes.
54+
- For changes that have a potential impact on users of this project:
55+
- [ ] Updated relevant documentation to avoid inaccuracies.
56+
- [ ] Considered adding additional documentation.
57+
- [ ] Considered adding an example in `./examples` for new features.
58+
- [ ] Considered updating our changelog (`CHANGELOG.md`).
59+
- [ ] Considered granting [push permissions to the PR branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork),
60+
so maintainers can fix minor issues and keep your PR up to date.
61+

.github/workflows/validate.yaml

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,39 @@ jobs:
2020
python-version: ["3.7", "3.8", "3.9", "3.10"]
2121
os: [ubuntu-latest, macos-latest, windows-latest]
2222
include:
23-
- {
24-
python-version: "3.7",
25-
os: ubuntu-latest,
26-
extensive-tests: true,
27-
}
23+
- python-version: "3.7"
24+
os: ubuntu-latest
25+
extensive-tests: true
26+
- python-version: "3.8"
27+
os: ubuntu-latest
28+
TOX_EXTRA_COMMAND: "- isort --check-only --diff ."
29+
- python-version: "3.9"
30+
os: ubuntu-latest
31+
TOX_EXTRA_COMMAND: "- black --check --diff ./rdflib"
32+
- python-version: "3.10"
33+
os: ubuntu-latest
34+
TOX_EXTRA_COMMAND: "flake8 --exit-zero rdflib"
2835
steps:
2936
- uses: actions/checkout@v2
3037
- name: Set up Python ${{ matrix.python-version }}
3138
uses: actions/setup-python@v2
3239
with:
3340
python-version: ${{ matrix.python-version }}
34-
3541
- uses: actions/setup-java@v2
3642
if: ${{ matrix.extensive-tests }}
3743
with:
3844
distribution: "temurin"
3945
java-version: "17"
40-
46+
- name: Setup env
47+
shell: bash
48+
run: |
49+
MATRIX_PYTHON_VERSION=${{ matrix.python-version }}
50+
echo "TOX_PYENV=py${MATRIX_PYTHON_VERSION//./}" >> ${GITHUB_ENV}
4151
- name: Get pip cache dir
4252
id: pip-cache
4353
shell: bash
4454
run: |
45-
python -m ensurepip --upgrade
55+
python -m ensurepip
4656
echo "::set-output name=dir::$(pip cache dir)"
4757
- name: Cache pip
4858
uses: actions/cache@v2
@@ -59,13 +69,15 @@ jobs:
5969
key: ${{ matrix.os }}-xdg-v1-${{ hashFiles('**/with-fuseki.sh') }}
6070
restore-keys: |
6171
${{ matrix.os }}-xdg-v1-
62-
- name: Install dependencies
72+
- name: Install python dependencies
6373
shell: bash
74+
# Installing tox-gh-actions to get some enhancement to output rendering
75+
# in github actions. Eventually we can maybe collapse the tox-envs job
76+
# into this one but there are some limitations of tox-gh-actions which
77+
# preclude doing that at the moment.
6478
run: |
65-
pip install --default-timeout 60 -r requirements.txt
66-
pip install --default-timeout 60 -r requirements.dev.txt
67-
python setup.py install
68-
- name: Install extra dev dependencies
79+
python -m pip install tox tox-gh-actions
80+
- name: Install system depdendencies for extensive tests
6981
if: ${{ matrix.extensive-tests }}
7082
shell: bash
7183
run: |
@@ -77,7 +89,6 @@ jobs:
7789
brew install berkeley-db@4
7890
export BERKELEYDB_DIR=$(brew --prefix berkeley-db@4)
7991
fi
80-
pip install --default-timeout 60 -r requirements.dev-extra.txt
8192
- name: Validate
8293
shell: bash
8394
run: |
@@ -86,14 +97,19 @@ jobs:
8697
then
8798
1>&2 echo "Running with fuseki"
8899
test_harness+="./with-fuseki.sh"
100+
TOX_PYENV_SUFFIX=-extensive
89101
fi
90-
black --config pyproject.toml --check --diff ./rdflib || true
91-
isort --check-only --diff . || true
92-
flake8 --exit-zero rdflib
93-
mypy --show-error-context --show-error-codes
94-
"${test_harness[@]}" pytest -ra --cov
102+
TOXENV="${{ matrix.TOXENV }}"
103+
TOXENV="${TOX_PYENV}${TOX_PYENV_SUFFIX}${TOXENV:+,${TOXENV}}"
104+
export TOXENV
105+
export TOX_EXTRA_COMMAND="${{ matrix.TOX_EXTRA_COMMAND }}"
106+
"${test_harness[@]}" python -m tox
95107
docs:
96108
runs-on: ubuntu-latest
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
tox-env: ["docs"]
97113
steps:
98114
- uses: actions/checkout@v2
99115
- name: Set up Python ${{env.DEFAULT_PYTHON}}
@@ -110,15 +126,15 @@ jobs:
110126
uses: actions/cache@v2
111127
with:
112128
path: ${{ steps.pip-cache.outputs.dir }}
113-
key: docs-pip-v1-${{
129+
key: tox-${{ matrix.tox-env }}-pip-v1-${{
114130
hashFiles('**/setup.py', '**/requirements*.txt') }}
115131
restore-keys: |
116-
docs-pip-v1-
132+
tox-${{ matrix.tox-env }}-pip-v1-
117133
- name: Install dependencies
118134
shell: bash
119135
run: |
120-
python -m pip install tox
121-
- name: Build docs
136+
python -m pip install tox tox-gh-actions
137+
- name: Run ${{ matrix.tox-env }}
122138
shell: bash
123139
run: |
124-
python -m tox -e docs
140+
python -m tox -e ${{ matrix.tox-env }}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ repos:
2525
description: "Black: The uncompromising Python code formatter"
2626
entry: black
2727
language: python
28-
# WARNING: version should be the same as in `pyproject.toml`.
29-
additional_dependencies: [black==21.9b0]
28+
# WARNING: version should be the same as in `pyproject.toml` and `requirements.dev.txt`.
29+
additional_dependencies: ["black>=22.0,<23"]
3030
# This is here to defer file selection to black which will do it based on
3131
# black config.
3232
pass_filenames: false

.readthedocs.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# https://docs.readthedocs.io/en/stable/config-file/v2.html
3+
version: 2
4+
formats: all
5+
6+
build:
7+
os: ubuntu-20.04
8+
tools:
9+
python: "3.7"
10+
11+
python:
12+
install:
13+
- method: pip
14+
path: .
15+
extra_requirements:
16+
- docs

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
apidoc_module_dir = "../rdflib"
4444
apidoc_output_dir = "apidocs"
4545
autodoc_default_options = {"special-members": True}
46+
autodoc_typehints = "both"
4647

4748
autosummary_generate = True
4849

docs/developers.rst

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,63 @@ This document describes the process and conventions to follow when
1010
developing RDFLib code.
1111

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

1918
If you add a new cool feature, consider also adding an example in ``./examples``
2019

20+
Pull Requests Guidelines
21+
------------------------
22+
23+
Contributions to RDFLib are made through pull requests (PRs).
24+
25+
In general, maintainers will only merge PRs if the following conditions are
26+
met:
27+
28+
* The PR has been sufficiently reviewed.
29+
30+
Each PR should be reviewed and approved by at least two people other than the
31+
author of the PR before it is merged and PRs will be processed faster if
32+
they are easier to review and approve of.
33+
34+
Reviews are open to everyone, but the weight assigned to any particular
35+
review is at the discretion of maintainers.
36+
37+
* Changes that have a runtime impact are covered by unit tests.
38+
39+
There should either be existing tests that cover the changed code and
40+
behaviour, or the PR should include tests. For more information about what is
41+
considered adequate testing see the :ref:`Tests section <Tests>`.
42+
43+
* Documentation that covers something that changed has been updated.
44+
45+
* Type checks and unit tests that are part of our continuous integration
46+
workflow pass.
47+
48+
In addition to these conditions, PRs that are easier to review and approve will
49+
be processed quicker. The primary factors that determine this is the scope and
50+
size of a PR. If there are few changes and the scope is limited then there is
51+
less that a reviewer has to understand and less that they can disagree with. It
52+
is thus important to try and split up your changes into multiple independent
53+
PRs if possible. No PR is too small.
54+
55+
For PRs that introduce breaking changes, it is even more critical that they are
56+
limited in size and scope, as they will likely have to be kept up to date with
57+
the master branch of this project for some time before they are merged.
58+
59+
It is also critical that your PR is understandable both in what it does and why
60+
it does it, and how the change will impact the users of this project, for this
61+
reason it is essential that your PR's description explains the nature of the
62+
PR, what the PR intends to do, why this is desirable, and how this will affect
63+
the users of this project.
64+
65+
Please note that while we would like all PRs to follow the guidelines given
66+
here, we will not reject a PR just because it does not.
67+
68+
.. Tests:
69+
2170
Tests
2271
-----
2372
Any new functionality being added to RDFLib _must_ have unit tests and
@@ -156,21 +205,26 @@ makes it easier to run validation on all supported python versions.
156205

157206
.. code-block:: bash
158207
159-
# install tox
208+
# Install tox.
160209
pip install tox
161210
162-
# list tox environments that run by default
211+
# List the tox environments that run by default.
163212
tox -e
164213
165-
# list all tox environments
166-
tox -a
167-
168-
# run default environment for all python versions
214+
# Run the default environments.
169215
tox
170216
171-
# run a specific environment
217+
# List all tox environments, including ones that don't run by default.
218+
tox -a
219+
220+
# Run a specific environment.
172221
tox -e py37 # default environment with py37
173-
tox -e py39-mypy # mypy environment with py39
222+
tox -e py39-extra # extra tests with py39
223+
224+
# Override the test command.
225+
# the below command will run `pytest test/test_translate_algebra.py`
226+
# instead of the default pytest command.
227+
tox -e py37,py39 -- pytest test/test_translate_algebra.py
174228
175229
Writing documentation
176230
---------------------

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ For developers
8787
CODE_OF_CONDUCT
8888
docs
8989
persisting_n3_terms
90+
type_hints
9091

9192
Source Code
9293
-----------

docs/sphinx-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
sphinx==4.4.0
2-
sphinxcontrib-apidoc
31
git+https://github.com/gniezen/n3pygments.git
42
myst-parser
3+
sphinx<5
4+
sphinxcontrib-apidoc
55
sphinxcontrib-kroki

0 commit comments

Comments
 (0)