Skip to content
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

graphql-core v3? #49

Open
GinTR1k opened this issue Jul 10, 2020 · 3 comments
Open

graphql-core v3? #49

GinTR1k opened this issue Jul 10, 2020 · 3 comments

Comments

@GinTR1k
Copy link

GinTR1k commented Jul 10, 2020

Hello!

Is there any plan to update graphql-core dependency to the latest version?

@hyusetiawan
Copy link

would love to know about this as well

@ossareh
Copy link

ossareh commented Nov 18, 2020

Hey there, to add some context here - graphql-ws is now incompatible with graphql-core included in graphene and graphql-server. I've discussed this a bit over here: https://app.slack.com/client/TBFTZEULB/CBG1GAB42/thread/CBG1GAB42-1605717933.051400

Attempting to install the following packages:

graphene = "==3.0.0b2"
graphql-server = {extras = ["aiohttp"], version = "==3.0.0b2"}
graphql-ws = "==0.3.1"

Results in:

pipenv install graphql-ws==0.3.1
Installing graphql-ws==0.3.1…
Adding graphql-ws to Pipfile's [packages]…
✔ Installation Succeeded 
Pipfile.lock (b7b025) out of date, updating to (ee6f08)…
Locking [dev-packages] dependencies…
Building requirements...
Resolving dependencies...
✔ Success! 
Locking [packages] dependencies…
Building requirements...
Resolving dependencies...
✘ Locking Failed! 
[ResolutionFailure]:   File "/home/ossareh/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pipenv/resolver.py", line 785, in _main
[ResolutionFailure]:       resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages)
[ResolutionFailure]:   File "/home/ossareh/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pipenv/resolver.py", line 746, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/home/ossareh/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pipenv/resolver.py", line 728, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/home/ossareh/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pipenv/utils.py", line 1378, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:   File "/home/ossareh/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pipenv/utils.py", line 1093, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/home/ossareh/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pipenv/utils.py", line 818, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: Could not find a version that matches graphql-core<3,<4,>=2.0,>=3.1.0,>=3.1.0b1 (from graphene==3.0.0b2->-r /tmp/pipenvam0pkvu9requirements/pipenv-d_a7l2a7-constraints.txt (line 2))
Tried: 0.4.9, 0.4.11, 0.4.12, 0.4.12.1, 0.4.13, 0.4.14, 0.4.15, 0.4.16, 0.4.17, 0.4.18, 0.5, 0.5.1, 0.5.2, 0.5.3, 1.0, 1.0.1, 1.1, 2.0, 2.0, 2.1, 2.1, 2.2, 2.2, 2.2.1, 2.2.1, 2.3, 2.3, 2.3.1, 2.3.1, 2.3.2, 2.3.2, 3.0.0, 3.0.0, 3.0.1, 3.0.1, 3.0.2, 3.0.2, 3.0.3, 3.0.3, 3.0.4, 3.0.4, 3.0.5, 3.0.5, 3.1.0, 3.1.0, 3.1.1, 3.1.1, 3.1.2, 3.1.2
Skipped pre-versions: 0.1a0, 0.1a1, 0.1a2, 0.1a3, 0.1a4, 0.4.7b0, 0.4.7b1, 0.4.7b2, 0.5b1, 0.5b2, 0.5b3, 1.0.dev20160814231515, 1.0.dev20160822075425, 1.0.dev20160823054952, 1.0.dev20160909030348, 1.0.dev20160909040033, 1.0.dev20160920065529, 1.2.dev20170724044604, 2.0.dev20170801041408, 2.0.dev20170801041408, 2.0.dev20170801051721, 2.0.dev20170801051721, 2.0.dev20171009101843, 2.0.dev20171009101843, 2.1rc0, 2.1rc0, 2.1rc1, 2.1rc1, 2.1rc2, 2.1rc2, 2.1rc3, 2.1rc3, 3.0.0a0, 3.0.0a0, 3.0.0a1, 3.0.0a1, 3.0.0a2, 3.0.0a2, 3.0.0b0, 3.0.0b0, 3.0.0b1, 3.0.0b1, 3.1.0b0, 3.1.0b0, 3.1.0b1, 3.1.0b1, 3.1.0b2, 3.1.0b2
There are incompatible versions in the resolved dependencies:
  graphql-core<3,>=2.0 (from graphql-ws==0.3.1->-r /tmp/pipenvam0pkvu9requirements/pipenv-d_a7l2a7-constraints.txt (line 4))
  graphql-core<4,>=3.1.0 (from graphql-server[aiohttp]==3.0.0b2->-r /tmp/pipenvam0pkvu9requirements/pipenv-d_a7l2a7-constraints.txt (line 6))
  graphql-core<4,>=3.1.0b1 (from graphene==3.0.0b2->-r /tmp/pipenvam0pkvu9requirements/pipenv-d_a7l2a7-constraints.txt (line 2))

fwiw, using pip instead of pipenv results in graphql-ws installing but it is then incompatible at the code-API layer:

Traceback (most recent call last):
  File "/home/ossareh/dev/src/github.com/erisyon/vega/guvnor/server.py", line 4, in <module>
    import graphene as gql
  File "/home/ossareh/.local/share/virtualenvs/vega-IIh8dIOy/lib/python3.9/site-packages/graphene/__init__.py", line 3, in <module>
    from .types import (
  File "/home/ossareh/.local/share/virtualenvs/vega-IIh8dIOy/lib/python3.9/site-packages/graphene/types/__init__.py", line 2, in <module>
    from graphql import GraphQLResolveInfo as ResolveInfo
ImportError: cannot import name 'GraphQLResolveInfo' from 'graphql' (/home/ossareh/.local/share/virtualenvs/vega-IIh8dIOy/lib/python3.9/site-packages/graphql/__init__.py)

This is generated by the following code:

import asyncio
import time

import graphene as gql
import graphql_server.aiohttp as srv
from aiohttp import web
from graphql_ws.aiohttp import AiohttpSubscriptionServer


class Query(gql.ObjectType):
    hello = gql.String(name=gql.String(default_value="bob"))

    def resolve_hello(root, info, name):
        return f"Hello to you and you family {name}!"


class Result(gql.ObjectType):
    time = gql.Int()
    msg = gql.String()

    def __init__(self, msg):
        self.time = time.time()
        self.msg = msg


class Subscription(gql.ObjectType):
    result_stream = gql.Field(Result)

    async def subscribe_result_stream(root, info):
        print("starting")
        while True:
            print(root, info)
            yield Result("Imagine I was helpful!")
            await asyncio.sleep(5)


schema = gql.Schema(query=Query, subscription=Subscription)

app = web.Application()
srv.GraphQLView.attach(
    app,
    schema=schema.graphql_schema,
    graphiql=True,
    subscriptions="ws://localhost:8080/subscriptions",
    enable_async=True,
)

subscription_server = AiohttpSubscriptionServer(schema)


async def subscriptions(request):
    ws = web.WebSocketResponse(protocols=("graphql-ws",))
    await ws.prepare(request)

    await subscription_server.handle(ws)
    return ws


app.router.add_get("/subscriptions", subscriptions)

if __name__ == "__main__":
    web.run_app(app)

@susingh
Copy link

susingh commented Aug 21, 2024

I was hoping there was a better answer here. I am building a GraphQL backend in Python, but this package is not compatible with graphql-core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants