Skip to content

Make flasgger optional? #26

Closed
Closed

Description

@AdamWill

Hi! I'm a packager for Fedora. We've run into a bit of a roadblock trying to update Fedora's httpbin package: https://bugzilla.redhat.com/show_bug.cgi?id=2233128#c9

since the last version we packaged, httpbin grew a hard dependency on flasgger. flasgger is not packaged for Fedora and is a bit tricky to package because it contains several bundled, pre-minified javascript libraries, which is against Fedora's packaging guidelines. (They are also, I'll note, ancient - upstream hasn't updated the bundled libraries for ui2 or ui3 since it added them, six and five years ago respectively.)

We can probably work around this if necessary (perhaps by only packaging ui3, the one httpbin uses, which is simpler as it only bundles jquery 2.x), but another option is to look at having httpbin not use flasgger. It doesn't seem, strictly speaking, to be necessary - all it does (AIUI) is provide API docs in the web UI, which is neat but not critical. Especially not since the main reason we package httpbin in Fedora is as a dependency of requests' test suite - no human is looking at API docs in a web UI there.

Would it be acceptable to send a patch to make the flasgger dependency optional, and just skip all the flasgger setup stuff in httpbin/core.py if it's not present?

Activity

  1. kevin1024 commented on Aug 28, 2023

    @kevin1024

    I'm down, especially since flasgger adds its own tree of sub-dependencies, and for httpbin's library usecase, it really doesn't matter.

    However, it DOES render the current homepage for httpbin.

    Maybe there's a way to fall back to the old static homepage if flasgger isn't available?

  2. AdamWill commented on Aug 28, 2023

    @AdamWill
    Author

    I mean, I guess the way I'd address that would be just to make sure whatever process generates the project's homepage honors the optional dependency? I was thinking the setuptools extras_require style, where you can require something like httpbin[apidocs] and flasgger will be pulled in, but if you require just httpbin it won't.

    e.g. in a lot of my projects I specify the dependency coverage[toml] because I want to configure coverage via pyproject.toml - in coverage itself this is implemented here. If you just require coverage, you can't configure it with pyproject.toml.

    I don't know how you do this if you're not using setuptools, but I'd be surprised if other systems don't make it possible.

  3. AdamWill commented on Aug 28, 2023

    @AdamWill
    Author

    oh, I think I'm misunderstanding - you mean it renders the page you see for any instance of httpbin if you just go to the root of the web server? In that case, yeah, I guess we'd need an alternative.

  4. kevin1024 commented on Aug 31, 2023

    @kevin1024

    you mean it renders the page you see for any instance of httpbin if you just go to the root of the web server? I

    As I understand it, yes, the neat API explorer thingy you get when visiting the homepage of httpbin.org is powered by flasgger.

    At one point there was a static html homepage, if someone dug that up from git history and made sure it was up-to-date with all the currently available endpoints and had the app fall back to that static page if flasgger is not installed, then I would merge that PR :)

  5. AdamWill commented on Aug 31, 2023

    @AdamWill
    Author

    awesome, thanks. I will try and get to that then.

  6. AdamWill commented on Oct 18, 2023

    @AdamWill
    Author

    Sorry for the delay, but I finally went ahead and did #32 .

  7. ml31415 commented on Apr 10, 2024

    @ml31415

    @sigmavirus24 @nateprewitt Could one of you please have a look at either PR #32 or #44 ? Pretty please? :)

  8. added a commit that references this issue on Jun 16, 2026
    c0e3cd0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions