Giter Club home page Giter Club logo

Comments (4)

wbolster avatar wbolster commented on May 22, 2024

As an alternative, setuptools extension points could be used instead. With the current approach, any external "extension package" containing an additional algorithm implementation must be imported by the application before it could be used, because the extension package would register the algorithms only at import time.

With extension points, which are designed for use cases like these, this isn't needed anymore. A simple pip install pyjwt pyjwt-my-supercool-new-crypto-algo-addon would suffice.

The stevedore package takes care of most of the required plumbing; see http://stevedore.readthedocs.org/en/latest/index.html for details and examples. The "driver" approach would work for the use cases outlined in this issue, I think.

from pyjwt.

mark-adams avatar mark-adams commented on May 22, 2024

That's a neat idea! I could see that being super useful in applications that see a lot of plug-ins being developed (things like Django, SqlAlchemy, flask) and I have some ideas for where I want to use it. Thanks for sharing it! =)

For this library, I anticipate that 99.9999% of the use-cases will be people who are only using the algorithms listed in the JWA spec (which we implement all of the required, all of the reccomended, and most of the optional). I think that someone registering their own non-standard algorithms with this library would be very uncommon so I'm not sure it justifies the additional dependency on stevedore.

I wouldn't be opposed to the setuptools option though. I'll have to read up on it.

But that's just my two cents :-)

from pyjwt.

wbolster avatar wbolster commented on May 22, 2024

Actually I tend to agree with you here @mark-adams. The ugly import-time side-effect and the resulting seemingly "unused" import in application code is just the price one has to pay for using non-standardized crypto! :)

from pyjwt.

wbolster avatar wbolster commented on May 22, 2024

For future reference: follow-up discussion in #71.

from pyjwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.