| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
into pyproject.toml (#2187)
Replaced setuptools with poetry which provides simpler dependency management, dependency locking and virtual environment management.
This makes it easier for new developers to get a sane development environment (i.e. just `poetry install`) and also makes our CI pipeline more reproducable as now most development tools and libraries will only change through dependabot which will reduce the build failures on main and make breaking changes in dependencies more visible with dependabot PRs.
Other changes:
- moved isort, mypy and coverage config from setup.cfg to pyproject.toml
- Changes in the generated rdflib wheel:
- removed wheel extras related to development (i.e. `tests`, `docs`, `dev`) as poetry dependency groups should be used instead.
- Added an extra group `lxml` with a dependency on lxml.
- Added version ranges to dependencies, and tests to ensure these version ranges are valid.
- Changes to tests:
- Change pyparsing related tests so they work with older pyparsing.
- Made the html5lib related tests conditional on html5lib existing.
- Runtime changes:
- Use importlib.metadata to set `__version__`.
- Changed the devcontainer and related config to avoid contamination and interference with the host environment.
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
Co-authored-by: Edmond Chuc <edmond.chuc@outlook.com>
|
|
|
|
|
|
| |
New mypy version is reporting new errors.
In the long run we need to switch to poetry so we can better control
this.
|
|
|
|
| |
`exclude_lines` was only considering TYPE_CHECKING if it was preceded
with at least one space.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 of `import 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 with
`git 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.
|
|
|
|
|
| |
flake8/flakeheaven is quite slow because it scans test data
directories also. This patch adds more directories to flake8 ignore so
that flake8/flakeheaven can run faster.
|
|
|
|
|
|
|
|
|
|
| |
`GraphHelper.quad_set` was doing the wrong thing for Datasets because
Datasets are not exactly a subclass of ConjunctiveGraph.
This adds special handling for Dataset so it works correctly.
Also:
- Fix some flake8 errors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Enable and baseline flakeheaven
This patch adds flakeheaven with a baseline, the baseline ignores all
existing errors and only reports on new errors.
The benefit with this approach is that we can get full flake8 on new
changes without having to first address the flake8 warnings with our
existing codebase.
Baselined errors can still be seen with:
- `flakeheaven lint --baseline /dev/null`
- `flake8`
This also adds a flakeheaven to GitHub Actions in a way which will
result in independent reporting.
Other changes:
- Simplified caching behaviour in GitHub Actions
- Removed flake8-black because it does not work well
https://github.com/peterjc/flake8-black/issues/59
- Remove redundant/duplicated config for flake8
Co-authored-by: Christian Clauss <cclauss@me.com>
|
|\
| |
| | |
Tell coveragepy to ignore type checking code and `...`
|
| |
| |
| |
| |
| |
| |
| | |
This is so we can get a more accurate picture of coverage.
For more info see:
- https://github.com/nedbat/coveragepy/issues/831
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently rdflib is relying on sphinx-autodoc's built in handling for type
hints, this however has some deficiencies as it does not handle stuff
inside `if TYPE_CHECKING:` and thus only work in cases where there are no
potential for circular dependencies.
This patch changes sphinx to use sphinx-autodoc-typehints instead, the
documentation generated by this plugin looks slightly different but as a
positive it correctly works with things defined inside `if TYPE_CHECKING:`
guards.
Also:
- moved the `_NamespaceSetString` type alias to `rdflib._type_checking`
This is so that `sphinx-autodoc-typehints` recognizes it up, as it
does not handle type aliases that are defined inside
`if TYPE_CHECKING:` guards in imported files.
- remove sphinx requirements from requirements.dev.txt and
replaced it with -r docs/sphinx-requirements.txt to reduce redundancy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pytest was using config from `tox.ini` preferentially and ignoring config
from `setup.cfg`, as a side-effect doctests were not running on
code/docstrings in `rdflib/`.
The reason why some pytest config was in `tox.ini` instead of `setup.cfg`
was because of these issues:
- https://github.com/pypa/pip/issues/5182
- https://github.com/pytest-dev/pytest/issues/3062
As a compromise to fix this I have opted for moving all pytest config to
`pyproject.toml`:
- https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml
This seems sensible as `pyproject.toml` is standarized by PEPs and
eventually most things from `setup.cfg` will end up in there anyway.
Also:
- remove the pytest ignore on `test/translate_algebra` as tests in there
have been running and passing for some time.
- fixed path to test data in `rdflib/plugins/parsers/nquads.py`.
|
|
|
|
|
|
|
|
| |
`isort` was misconfigured to only touch `*.{pyw,pyi}` files.
This patch fixes isort config so that it actually does sort imports.
It also removes the attempt to ignore the test directory.
|
|
|
|
|
|
|
|
| |
The type hints from pyparsing 3.0.8 does not work for rdflib:
https://github.com/pyparsing/pyparsing/issues/385
Once the type hints for pyparsing is in a better state we can enable
them again.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add: isort configure file
* fix: isort
$ isort .
* add: isort to dev deps
* add: isort to CI
* fix: move .isort.cfg into setup.cfg
* fix: re-formatted
* fix: isort target path
* Use pre-commit to check isort
pre-commit CI can auto fix this, and this way we can idenpendently evaluate
the formatting of the code from the validity of the code.
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Plugin loading in `rdflib.plugins.sparql` will now happen similar to
what is being done for `rdflib.plugins`.
This also eliminates a warning that occurs `rdflib.plugins.sparql` and
makes it possible to enable `warn_unused_ignores` without any exceptions
or workarounds.
Also:
- Removed unused `type: ignore` statements.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds as much typing as possible to `rdflib.term`.
Other changes:
- Added back `warn_unused_ignores`. I actually thought this was enabled
but I forgot I disabled it because of some issue on python 3.10.
- Disabled `warn_unused_ignores` only for `rdflib.plugin`. There is an
ignore in this module which is not needed on python 3.10, this is the
most targetted way to avoid having that fail the type checking that I
can think of for now.
- Removed unused type ignores.
This changeset includes no runtime changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As far as I can tell all the tests inside test/translate_algebra
basically did the following:
```python
query_tree = parser.parseQuery(self.query_text)
query_algebra = algebra.translateQuery(query_tree)
self.query_from_algebra = translateAlgebra(query_algebra)
query_tree_2 = parser.parseQuery(self.query_from_algebra)
query_algebra_2 = algebra.translateQuery(query_tree_2)
self.query_from_query_from_algebra = translateAlgebra(query_algebra_2)
_pprint_query(self.query_from_query_from_algebra)
```
One test tried to also execute the query, but against a None valued
variable. And then there was some exception handling in specific place.
This change converts all of this to pytest using parameterization.
There are two tests that fail, and seem to also fail in the old test
structure, they are:
```python
AlgebraTest(
"test_other__service1",
"Test if a nested service pattern is properly translated"
"into the query text.",
pytest.mark.xfail(raises=RecursionError),
),
AlgebraTest(
"test_property_path__negated_property_set",
"Test if a negated property set gets properly translated into the query text.",
pytest.mark.xfail(raises=TypeError, reason="fails in translateAlgebra"),
),
```
The `test_other__service1` causes some more serious issues on Windows so
it is guarded in a condition to only run it on non Windows operating
systems.
|
|
|
|
|
|
|
|
| |
Also removed mypy config to ignore errors in tests.
This will make tests useful for determining if the typing of rdflib is
correct and sane and should also help detect if a change in rdflib
introduces typing errors in tests.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Changed all mypy invocation to not include paths and moved the paths
to the mypy section in setup.cfg.
This removes redudancy in directory specification and reduces the
potential that directories are changed in one invocation but not
others.
- Ignore mypy errors in test directory.
- Enable strict mypy config with in-file config comments in the
following files:
- test/test_issue1447.py
- test/test_issue_git_336.py
- test/test_literal.py
- test/test_parse_file_guess_format.py
|
|
|
|
|
|
|
|
| |
Support for python version 3.6 is dropped, and using 3.6 prevents
certain features from python 3.7 from being useable without type
failures.
Fixes #1513
|
|
|
|
|
| |
pytest's behaviour causes some spurious warnings during test, this
commit configures pytest to ignore them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch replace all uses of nose with pytest. It also includes a
pytest plugin for creating EARL reports for tests with a `rdf_test_uri`
parameter.
Some caveats:
- HTML report directory is now htmlcov instead of coverage
- There is some warning related to the EARL reporting plugin which I can't quite figure out:
```
.venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676
/home/iwana/sw/d/github.com/iafork/rdflib/.venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: test.earl
self.import_plugin(import_spec)
```
This is not causing any problems as far as I can tell, but still annoying.
- python setup.py test won't work anymore, I can make it work but this
is not advised by pytest:
https://github.com/pytest-dev/pytest-runner/#deprecation-notice
- run_test.py is still there but it's not really referenced anymore from
anywhere and the options it accepts are completely different as it's options
were based on nose. I would say it should be removed entirely but for now
it is basically just a wrapper around pytest that basically does nothing.
- Removed references to test attributes as currently they are not being
used anywhere anyway, I guess we can add them back if there is some
use for them later.
- A lot of tests are still marked to skip when really they should be marked
with xfail. This is also affecting the RDFT test manifests and result in
reports saying tests are skipped when really we know they will fail and
they are only skipped for this reason. But there is no change here from
before, and pytest makes it easier to dynamically do expected failures.
Special thanks to Wes Turner for his advice and inputs on this process.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is so that other packages importing rdflib does not get warnings
like this:
```
$ python3.9 -m mypy --show-error-context --show-error-codes test_rdflib.py
test_rdflib.py:1: error: Skipping analyzing "rdflib": found module but no type hints or library stubs [import]
test_rdflib.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #1311
Add `mypy` to .drone.yml and fix type errors that come up.
Not type checking examples or tests.
Other changes:
- fix return value for `Graph.serialize` (refs #1394)
- remove default value for
`rdflib.plugins.sparql.algebra.translateAlgebra` (refs #1322)
- add .dockerignore to reduce context size and make docker quicker
to run.
- add .flake8 config to ignore line length as black is managing
formatting.
- add mypy to docker-compose, makefile and tox.ini
- fix the way csv2rdf is invoked to ensure that the right code gets
executed.
|
|
|
|
|
| |
Also move mypy config into `setup.cfg` to be in line with other tool
configuration.
|
|
|
|
|
| |
This section appears to be left over. It is only necessary in combination with coverage combine,
which we are not using.
|
| |
|
| |
|
|
|
|
|
|
|
| |
remove .pep8 as we don't use it
move the pep8 configuration to setup.cfg
set line length to the default value of black, as we use black
adjust travis configuration
|
|
|
|
| |
replaced with doctest-ignore-unicode noseplugin
|
| |
|
|
|
|
|
|
|
|
| |
networkx shouldn't be a dependency of rdflib just to run tests. Also
graph_tool heavily depends on C libs and can't easily be installed via pip
(or via apt-get on travis).
Hence, the doctests are duplicated into proper tests that auto skip if
networkx or graph_tool can't be imported.
|
| |
|
| |
|
| |
|
|
|
|
| |
of it
|
| |
|
|
|
|
| |
make it easier to run the various groups of tests; and make the default be tests that match the following: \!known_issue,\!slow,\!non_core,\!sparql
|
|
|
|
| |
ignoring test.mysql
|
| |
|
|
|