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

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

Closed
phrazzld opened this Issue Mar 4, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@phrazzld
Copy link

phrazzld commented Mar 4, 2017

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

This comment has been minimized.

Copy link
Owner

sybrenstuvel commented Mar 4, 2017

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

This comment has been minimized.

Copy link
Author

phrazzld commented Mar 5, 2017

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

@phrazzld

This comment has been minimized.

Copy link
Author

phrazzld commented Mar 6, 2017

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

This comment has been minimized.

Copy link
Owner

sybrenstuvel commented Mar 7, 2017

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 added a commit that referenced this issue Mar 13, 2017

Late-import sqlite3 module
This fixes issue #81. I also added some unit tests for the token cache
implementations. TokenCache now also supports unicode tokens (just for
the sake of completeness).
@sybrenstuvel

This comment has been minimized.

Copy link
Owner

sybrenstuvel commented Mar 13, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment