Closed c-w closed 6 years ago
python setup.py install
to install the correct dependencies is a good idea.
Would it be better to instead call pip install .
for the reasons given here?
http://python3statement.org/practicalities/#unit-testing-and-documentation
Interesting, didn't know about that. Fixed in ee601ae.
In https://github.com/c-w/gutenberg/issues/105 we saw that there should be a method to leverage the URI building functionality of the Gutenberg library for non-text resources. This pull request implements
_format_download_uri_for_extension
which is a refactoring of our existing URI formatting logic that can take an arbitrary file extension like-pdf.pdf
(as for example returned by theformaturi
metadata call) and format the appropriate URL.This is not an official API (whence the underscore prefix) so no strict requirement to always maintain this function, but it's useful functionality to expose nevertheless given that we already have it in the code base.
When working on this change, I also noticed that we weren't correctly handling the case where the mirror root URL was changed in a single session so I also added a fix for that.
When verifying the refactor, I saw some odd behavior when running the tests locally, so this pull request also improves the developer experience for the tests:
requests.head
calls instead of doing it manually.python setup.py install
to install the dependencies for the various runtimes since the setup file already knows how to load the correct pip dependencies for Python 2 vs Python 3. Previously on Travis we were always installing the Python 3 dependencies even when running the tests for Python 2 which could lead to odd behavior.