hbldh / pybankid

BankID Relying Party client for Python
https://pybankid.readthedocs.io
MIT License
48 stars 19 forks source link

Heroku deploy failure due to incorrect setup.py imports #7

Closed magandrez closed 8 years ago

magandrez commented 8 years ago

Hi,

I forked pybankid-example-app for a project where I need to create a gateway to BankId services, thus, using this wrapper (pybankid). I cloned the project and started by creating a virtual environment with python 2.7 on Mac OS (later I learned that 2.7.8 had some issues with SSL libraries, so I upgraded to 2.7.11, what contains a backport of all the SSL modules since 2.7.9).

When I download the requirements I found a funny thing, and is that first downloads six, requests and so on, and then fails when installing bankid. I found out that by installing each of those separately (i.e.: pip install six pip install requests and so on) it worked like a charm.

That type of issue is described here: https://github.com/pypa/pip/issues/25

That is cool, to work in localhost I instalL each of the requirement lines by splitting the requirements.txt like this: while read in; do pip install "$in"; done < requirements.txt;

However, my problem comes when I need to deploy this to Heroku (silly me, I should have figured out before). The pybankid-example-app, nor any project that has this wrapper as dependency can be built to run in Heroku.

Good news is that this is, apparently a common problem doing imports in the setup.py It is explained here:

https://github.com/scipy/scipy/pull/453

And here an actuall implementation of a similar fix for pandas library: https://github.com/pydata/pandas/commit/28e2a383f4afbf97164316dfaf1e7c47166570dd

My main problem is: I am not sure if I can pull through a similar fix in a reasonable amount of time. Could you help me with it?

Cheers,

-Manuel

hbldh commented 8 years ago

@magandrez: Ok, so I made a quick and dirty fix for installing pybankid, and it seems to work fine. I deployed version 0.3.1 of PyBankID to PyPI some minutes ago and tested installation on Heroku via the pybankid-example-app and nearly everything works well.

I get a requests.exceptions.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:590) error when I try to run the app, but I think this has to do with an old test certificate stored in the pybankid-example-app repo. I will look into this eventually... The tests for PyBankID downloads the test certificate from BankID webpage every time the tests runs, so I know the PyBankID works.

Thank you for catching this; it was a clumsy mistake that I will correct in a more proper way later.

magandrez commented 8 years ago

@hbldh :+1:

I had an attempt at this as well. The server seems to run normally, however I get an error on one of the example projects you have with this wrapper when importing bankid :/

https://github.com/magandrez/pybankid/commit/c6fc0466d6d1de6c53aadf8977e76ac6addde9a3

hbldh commented 8 years ago

Included new cert and key in example app rep, pushed it and now it seems to work fine again. Haven't tested thoroughly though.

On 3 feb. 2016, at 15:14, Manuel G. notifications@github.com wrote:

@hbldh

I had an attempt at this as well. The server seems to run normally, however I get an error on one of the example projects you have with this wrapper when importing bankid :/

magandrez@c6fc046

— Reply to this email directly or view it on GitHub.

magandrez commented 8 years ago

@hbldh Hmmm, seems my humble take on Python was not good enough, test won't pass.

However, your version seems to be working wonderfully and I have a running Heroku instance with your wrapper running. Many thanks! :)

-Manuel