-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dependency sustainability #333
Comments
If the Graphene route becomes difficult there are two other Python GraphQL server implementations which may or may not offer an easier route:
|
update: 2023 graphene-tornado is now graphene >=3 compatible, but pending release, pending a maintainer to make the release. Because graphql-ws is still graphene < 3 this doesn't help us so #388 is blocked with or without this release. |
Moving to Ariadne or Tartiflette is completely possible, however, this would involve swapping our GraphQL "engine" for theirs which could introduce migration pain. Both Ariadne and Tartiflette are schema-first which means we would need to serialise our Graphene schema, then load it back in again. This should work but it might require a little extra work hooking in our resolvers, etc. Furthermore, although both support websockets, neither support Tornado so we would still require an integration there bringing us back to the original problem. So long story short, both are interesting alternatives which we might have considered had they been around at the time, however, migrating is not likely to be a trivial activity. [edit] correction Ariadne uses graphql-core as its "GraphQL engine" the same thing you get with Graphene, Tartiflette presumably uses something different. |
Update: 2024-08State of graphene-tornado and graphql-wsUnfortunately, it does not look like either graphene-tornado or graphql-ws are going to receive any further updates. I have poked, but there doesn't seem to be any appetite for pushing these projects forward. The maintainers are suggesting we move away from these specific integrations and towards another of their projects, graphql-server as a more unified solution. However, graphql-server presently does not support either subscriptions, websockets or tornado, so this isn't a viable solution either. There is a Alternative toolingThe good news is that other Python GraphQL servers have advanced reasonably during this period. Notably Strawberry and Ariande appear much more mature solutions, both providing subscription and websocket support. Note, neither has reached a v1 release yet. The smaller Tartiflette project may also be promising. There is also the graphql-server project mentioned above, however, this does not support either subscriptions or websockets. None of these options supports Tornado servers, so we will have to accept developing this integration ourselves :( Note, Strawberry and Ariande appear to have GraphQl-core as a dependency, so may just be frameworks wrapping this library (similar to graphql-server)? Component partsThere are four components to the GraphQL server-side stack (my naming):
Migration options
All options are going to be highly disruptive, expected pain points:
Migration notes:
SuggestionsIt might be easier to attempt this as a ground-up rewrite :( Try implementing a simple schema implementing a simple subscription and see how hard it is to expose this through Tornado before continuing. The popularity of the Strawberry and Ariande frameworks is attractive. |
From the face of it options (2)-(5) are my preference, motivation:
Couldn't we just run the Tornado to communicate with Jupyter Hub and run another framework alongside? (just trying to think outside the box)
There may be easier ways to do this .. I think most now have "hooks" where you can manipulate the results at different points of the execution/resolving... i.e. I haven't looked into how much would be involved with creating bespoke integrations .. but strawberry as a little info: Anyway, I need to do a lot more reading.. But willing to tackle it |
Completely agree. I'm leaning towards (2). I think that everything basically just boils down to graphql-core at the end of the day, e.g. see the ariadne dependencies: https://github.com/mirumee/ariadne/blob/af244283987ef57c186a512a1186f819f4dd6e20/pyproject.toml#L26 If so, then these newer frameworks are really just occupying the space of schema definition and server integration. Since we already have a solution for schema definition (graphene) and none of them provide the required server integration (tornado), they probably just represent additional complexity and migration pain for little to no gain.
Great. I'm sure there'll be a solution to this.
We can also take a look at the integrations we are currently using for inspiration. A couple of people have had a crack at upgrading them to graphql-core v3. We only need a subset of what these integrations provide so it might not be too bad. Note we are already hosting our own websocket integration (code lifted from an unmerged PR on an unmaintained repo). |
(2) would definitely be the easiest starting point to figure out how to build a bespoke integration between it's queries and subscriptions to Tornado's
Many points of possible intervention/stripping get exposed to the validation step at the end, which either fails due to the field not being |
Overarching task can be split into two:
Will approach this in that order.. |
I think we've got a way forward now so I'll remove that question label. Do you want to self-assign this issue? |
Yes, done.. Already made a start on the first part .. |
|
Cylc UI Server has two dependencies from the graphql-python org that are starting to look worrying:
These projects are fairly small and live in the graphql-python organisation, however, are in need of a little TLC. They are currently stuck on Graphene 2, Graphene has since moved onto version 3 (Nov 2021).
Unfortunately it is relatively unusual to write GraphQL servers in Python (clients less unusual), GraphQL came out the JS ecosystem where the most popular server lives. Consequently there isn't that much interest from the wider community in some of these more niche integrations in the Python ecosystem.
To safeguard the future of these projects they need to make it to Graphene 3, unfortunately this requires an understanding of Graphene that we don't have which makes it difficult for us to help.
What can/should we do and when can we afford the time to do it?
The text was updated successfully, but these errors were encountered: