-
Notifications
You must be signed in to change notification settings - Fork 579
Description
Hi all,
I found a looming incompatibility with a dependency that is currently in alpha status for its next major release. If this compatibility issue is not addressed, the SPARQL engine in rdflib will not import.
rdflib currently imports pyparsing at version 2.4.7. In a few inconsistently-reproducing cases, I'd found that adding this line to a Python script would cause an import failure: import rdflib.plugins.sparql. Stack trace:
source venv_broken/bin/activate \
&& python3 -c 'import pyparsing ; print(pyparsing.__version__)'
3.0.0a2
source venv_broken/bin/activate \
&& python3 -c 'import rdflib.plugins.sparql'
RDFLib Version: 5.0.0
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ajn/local/src/test/venv_broken/lib/python3.6/site-packages/rdflib/plugins/sparql/__init__.py", line 33, in <module>
from . import parser
File "/home/ajn/local/src/test/venv_broken/lib/python3.6/site-packages/rdflib/plugins/sparql/parser.py", line 184, in <module>
Param('prefix', PN_PREFIX)) + Suppress(':').leaveWhitespace()
File "/home/ajn/local/src/test/venv_broken/lib/python3.6/site-packages/rdflib/plugins/sparql/parserutils.py", line 114, in __init__
self.name = name
AttributeError: can't set attributeHere is that line in today's master branch for context.
Discovery background:
I'm still not sure how I've been triggering pip to download an alpha release. My best guess at the moment comes from this only happening when I run python setup.py install in a project's source tree to install the project into a virtual environment for some tests. A bit maddeningly, this has happened in my Mac environment running Python 3.8 from MacPorts; an Ubuntu 18.04 environment running Python 3.6; but not an Ubuntu 20.04 environment running Python 3.8.
Minimal steps to reproduce:
- Create virtual environment.
- Install packages with this requirements file:
pyparsing == 3.0.0a2
rdflib
requests
- Activate environment, and in some script import
rdflib.plugins.sparql.
EDITED TO ADD: I'd accidentally truncated the last line of the stack trace reporting the AttributeError.