Closed taschini closed 8 years ago
It seems that this concerns only buildout and not a recent Pip (>= 8) setup:
The wheel package on OS X is a statically linked build (as of 1.0.1) so for users with pip 8 or above you only need one step:
$ pip install cryptography
See https://cryptography.io/en/latest/installation.
So maybe it's possible to add a warning to the buildout process somewhere in buildout.cfg
.
Maybe someone with more buildout experience can have a look.
Binary wheels on OS X are affected by the same UCS2/UCS4 issue that rendered them pretty much useless on Linux. So, I had to build my own Cryptography, following the instructions with static linking a few paragraphs below.
Alternatively we could make Cryptography optional.
See http://pyjwt.readthedocs.io/en/latest/installation.html.
I am not sure that making Cryptography optional would ultimately make life any easier.
Thought about introducing the legacy dependencies but they really seems to outdated.
Making Cryptography optional at least would allow using the HMAC hash algorithms without installing Cryptography.
Just pushing a new branch 'optional_cryptography', where I start to try it out.
For Pip pip install more.jwtauth
should install more.jwtauth without Cryptography and pip install more.jwtauth[cryptography]
with Cryptography.
Don't know how to do this with Buildout.
Also skipping now tests, which depends on Cryptography when it's not installed.
Of course we have to document this.
Thought about introducing the legacy dependencies but they really seems to outdated.
That will say allowing something like pip install more.jwtauth[legacy]
.
See http://pyjwt.readthedocs.io/en/latest/installation.html#legacy-dependencies.
In the 'optional_cryptography' branch i make Cryptography now optional. I also updated the README and added install instructions.
@taschini Please take a look and tell me what you think and if something is missing.
It looks good to me.
By default you provide the safe option: no crypto, no trouble. If you need any of the algorithms that do require Cryptography, you must install it explicitly and hopefully you did that because you read the Installation notes.
I see that Tox and Travis have now the full matrix Python-version X Install-option, and everything seems to working as expected.
I would only modify one thing in README.rst: I would mark with an asterisk the algorithms under the Algorithms that need the “crypto” extra, and have an explanation like:
*) The marked algorithms require this library to be installed with its
crypto
dependencies:pip install -U more.jwtauth[crypto]
See Installation for details. In case of problems be sure to have read the note in the Requirements section.
@taschini I've now merged this into master. Can you try if it now works with buildout for you?
I confirm that buildout works: it picks the safe option of no Cryptography.
Thanks.
It might happen that during the automatic installation of
more.jwauth
, e.g. via Buildout, the version of the OpenSSL library linked to the Cryptography package is not recent enough. When that happens, Cryptography disables some encryption algorithms, and this typically causes problems at run-time.While one might think of how to fix this non-Python dependency in Buildout, I think that at least
more.jwauth
should detect this situation as early as possible and raise a helpful warning directing people to the instructions to manually install Cryptography on the appropriate OS.When I ran the test-suite with a Cryptography package that was thus restricted, I obtained the following traceback, which could be useful as a source of inspiration on how to implement this safety check: