sybrenstuvel / flickrapi

Python Flickr API implementation
https://stuvel.eu/flickrapi
Other
157 stars 33 forks source link

Apps using this module can't deploy to Heroku because of sqlite3 dependency #81

Closed phrazzld closed 7 years ago

phrazzld commented 7 years ago

Heroku doesn't like sqlite.

How could this be handled? Switching to postgres? Only calling sqlite3-dependent functions when explicitly commanded to by the user, i.e., not on init?

My use case is just an api_key and api_secret, I don't even use OAuth because I'm not logging in and I'm only accessing publicly available images. Or am I mistaken, and OAuth with a persistent database for tokencache is required even for my use case?

sybrenstuvel commented 7 years ago

You're not mistaken, we could delay importing the sqlite3 module, and only do that in the functions that use it. Not sure I have much time to do this soon, but things can be considerably sped up with a pull request ;-)

phrazzld commented 7 years ago

That is exactly what I wanted to hear, thank you (:

phrazzld commented 7 years ago

Just set up the project on my machine (Taurinus X200 running Trisquel Mini 7.0), but hitting some confusing test failures and errors when I run py.test. Here's every command I ran to get to this point, and I've attached the output of py.test below:

$ git clone https://github.com/phrazzld/flickrapi.git
$ cd flickrapi
$ virtualenv -p /usr/local/bin/python3 venv
$ source venv/bin/activate
(venv) $ python setup.py install
(venv) $ pip install -r requirements.txt
(venv) $ py.test

18 failed, 180 passed, 5 skipped, 1 error. However, I see multiple errors when I look through the terminal output, most being "IOError: [Errno 2] No such file or directory: 'setuptools/svn_data/svn_ext_list.txt'" This led me to run pip install --upgrade setuptools from within the project virtual environment.

Once I did that, everything passed. Am I a Python newbie (yes) who just didn't have his environment set up correctly, or should more detail be added to the README so the steps to get started with this project aren't as ambiguous?

flickrapi_test_log.txt

EDIT: I'm also new to Github collaboration and I now realize this may have made more sense filed as a separate issue. If you'd like me to re-file as a separate issue, I can.

sybrenstuvel commented 7 years ago

Yes, filing as another issue would have been better indeed, as it is, indeed, another issue. However, we can be quick about this ;-) Looking at the logs, it's not the flickrapi tests that fail, but the setuptools ones. This is caused by py.test searching through the entire project directory for tests to execute. Since your venv directory is inside the flickrapi project directory, it finds unittests there too. Place your venv outside of the flickrapi directory, or (and I recommend this) use virtualenvwrapper instead.

sybrenstuvel commented 7 years ago

Implemented, will be included in the next release, or just use the latest version from Git.