feat: add type hints for rdflib.store
and rdflib.plugins.stores
by aucampia · Pull Request #2057 · RDFLib/rdflib (original) (raw)
Summary of changes
Add type hints and aliases for rdflib.store
andrdflib.plugins.stores
and also add a couple of more type hints and
aliases to rdflib.graph
.
This PR contains no runtime changes.
Other changes:
- Changed some imports to be more specific (e.g.
import from rdflib.graph
instead ofimport from rdflib
). This is to reduce
the probability of circular imports. - Ignore
E231
(missing whitespace after ',') in flake8 as black is
managing the whitespaces and seems to be bumping heads with flake8
with spaces after,
sometimes. - Install
berkeleydb-stubs
when doing extensive testing with tox. - Added
devtools/diffrtpy.py
which is a script that can be used withgit difftool
to generate compact diffs for python code. This should
make it a lot easier to review PRs that change type hints to verify
that they don't have a runtime impact.
Compact diff: https://gist.github.com/aucampia/3f380070fbd8f0e8a99aea2df6cc1f06
Checklist
- Checked that there aren't other open pull requests for
the same change. - Added tests for any changes that have a runtime impact.
- Checked that all tests and type checking passes.
- For changes that have a potential impact on users of this project:
- Considered updating our changelog (
CHANGELOG.md
).
- Considered updating our changelog (
- Considered granting push permissions to the PR branch,
so maintainers can fix minor issues and keep your PR up to date.
Coverage decreased (-0.05%) to 90.439% when pulling 16d9618 on aucampia:iwana-20220728T1941-store_typing into ff41218 on RDFLib:master.
I will publish this tomorrow, I'm writing a script to diff python source code with type hints and comments removed, so it is easier to review these PRs.
aucampia marked this pull request as ready for review
@aucampia : I don't really have experience with this area in the code, so I don't have cogent feedback aside from noticing a documentation typo.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, will be v. useful for ADR
Add type hints and aliases for rdflib.store
and
rdflib.plugins.stores
and also add a couple of more type hints and
aliases to rdflib.graph
.
This PR contains no runtime changes.
Other changes:
- Changed some imports to be more specific (e.g.
import from rdflib.graph
instead ofimport from rdflib
). This is to reduce the probability of circular imports. - Ignore
E231
(missing whitespace after ',') in flake8 as black is managing the whitespaces and seems to be bumping heads with flake8 with spaces after,
sometimes. - Install
berkeleydb-stubs
when doing extensive testing with tox. - Added
devtools/diffrtpy.py
which is a script that can be used withgit difftool
to generate compact diffs for python code. This should make it a lot easier to review PRs that change type hints to verify that they don't have a runtime impact.
aucampia deleted the iwana-20220728T1941-store_typing branch