brutasse / graphite-api

Graphite-web, without the interface. Just the rendering HTTP API.
https://graphite-api.readthedocs.io
Apache License 2.0
492 stars 131 forks source link

graphite-api without cairo/cairocffi #149

Open JFC-MC opened 8 years ago

JFC-MC commented 8 years ago

Actually it's a continuation of https://github.com/brutasse/graphite-api/issues/148.

I spent some time trying to make it up and running on Windows, no luck yet. (And you were right there are some difficulties to make libcairo work)

Is there any way to start graphite-api without cairo imports (in our setup I definitely sure we won't use graphing abilities of graphite-api ever. We need just json format. Actually I believe there a lot of users who need just json format output. It would be great to have a some way(e.g. directive in configuration file) which would avoid loading/searching for libcairo and thus make it possible to run even more lightweighted version of graphite-api on Windows)

pkittenis commented 8 years ago

Have been able to get graphite-api going without cairo, in my case for use in pypy where cairo does not work (well).

Have not fixed all pypy tests that expect graphs to be generated yet, though all non image/pdf formats functionality is working. All tests pass on standard python targets with cairo installed.

WIP is at https://github.com/pkittenis/graphite-api/tree/cairo_optional if want to test it out.

JFC-MC commented 8 years ago

@pkittenis Cool, thanks! We're going to try it out on the next week. @brutasse Is there any chances for these commits to be incorporated to the master or somehow else to the mainline project?

brutasse commented 8 years ago

@JFC-MC sure, I'm happy to review/merge a PR that makes Cairo optional!

pkittenis commented 8 years ago

Edit - The below is no longer the case, now uses environment markers to not pull in cairo on windows and pypy platforms only, per notes in the PR - #198

For @brutasse reference , the approach that has been taken is to move cairo from requirements into extras so that it becomes an optional component.

The API will then return 400 error status with the message 'cairo is not installed' if the request is asking for image formats without cairo.

Will be adding another test target for the API changes that tests without cairo installed.

This allows user to choose between installing with and without cairo for pure json/raw format responses and being able to generate images as currently.

The drawback is that pip install graphite-api will no longer also install cairo by default as it does currently, user will have to specify pip install graphite-api[cairo].

drawks commented 7 years ago

Any chance this is gonna get a review/merge?