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

update setup.py to include requests needed by Graph.parse() #1123

Closed
wants to merge 1 commit into from

Conversation

rob-metalinkage
Copy link

Fixes #1122

Proposed Changes

updates setup.py

suggest reviewing requirements.txt and setup.py and syncing.

@coveralls
Copy link

coveralls commented Jun 23, 2020

Coverage Status

Coverage remained the same at 75.797% when pulling d3ee9e9 on rob-metalinkage:master into 228a8db on RDFLib:master.

@tgbugs
Copy link
Contributor

tgbugs commented Jul 20, 2020

This should not be merged per #969 and #1035. The correct solution is to install via pip install rdflib[sparql]. requests is not a core dependency.

@rob-metalinkage
Copy link
Author

i piut this comment on #1122

See the direction (pip install rdflib[sparql]) , fair enough...

but a few things seem off -

there seems to be inconsistency between requirements.txt and setup.py (and not sure if this is a good thing to have similar info in both places anyway?)
Parsing a graph from a HTTP request has nothing to do with SPARQL - so this isnt very intuitive a solution
probably the parse module should report a sensible error with the correct import suggestion if you ask it for a HTTP source and it doesnt have the install available
the documentation for parse is quite explicit HTTP is supported without any mention of the requirement.
I think all these things need to be addressed for the proposed solution to be acceptible.

@tgbugs
Copy link
Contributor

tgbugs commented Jul 21, 2020

Unless something changed very recently in the internals (which my review of the commit logs suggests it did not), rdflib doesn't depend on requests for fetching http resources.

@ashleysommer
Copy link
Contributor

ashleysommer commented Jul 21, 2020

the requests library is only used in two locations in rdflib.

Here:

response = requests.get(service_url, params=query_settings, headers=headers)
else:
response = requests.post(

And here:

self._session.__dict__.setdefault(k, requests.Session())

Both related to SPARQL. The first instance is invoked by the SPARQL SERVICE directive, while running a SPARQL query.
The second is in the sparqlconnector store backend, and used for maintaining a persistent connection to a remote SPARQL endpoint while operating on a Graph.

The only reason you would need requests when doing Graph.parse() is if you have configured your Graph to use the sparqlconnector backend (or sparqlstore backend, which in turn uses sparqlconnector).

The correct solution here would be to take the requirement out of requirements.txt I think it was put there accidentally.

I've been experimenting with a way of eliminating the need for requests in plugins/sparql/evaluate.py (by using the built-in python3 urllib.requests library), but it looks like it cannot be avoided in plugins/stores/sparqlconnector.py due to the use of a persistent Session per thread.

@rob-metalinkage
Copy link
Author

So the HTTP request from parse works fine without requests? If so good and the doco is fine.

@white-gecko white-gecko self-requested a review August 14, 2020 10:18
@white-gecko
Copy link
Member

Ok, so we can close this I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

requests not included in setup.py
5 participants