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

[BUG] startup failure caused by dependencies, requires httpx #1614

Closed
2 tasks done
Bidaya0 opened this issue Sep 27, 2022 · 13 comments · Fixed by #1615
Closed
2 tasks done

[BUG] startup failure caused by dependencies, requires httpx #1614

Bidaya0 opened this issue Sep 27, 2022 · 13 comments · Fixed by #1615
Assignees
Labels
Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior

Comments

@Bidaya0
Copy link
Contributor

Bidaya0 commented Sep 27, 2022

Checklist

Describe the bug
Because the upstream starlette updated the dependencies,the following error occurs
ModuleNotFoundError: No module named 'httpx'

To Reproduce

https://github.com/HXSecurity/DongTai/actions/runs/3132544194/jobs/5084991907
File "/home/runner/.local/bin/schemathesis", line 5, in
from schemathesis.cli import schemathesis
File "/home/runner/.local/lib/python3.8/site-packages/schemathesis/init.py", line 7, in
from . import auth, fixups, graphql, hooks, runner, serializers, targets
File "/home/runner/.local/lib/python3.8/site-packages/schemathesis/graphql.py", line 3, in
from .specs.graphql import nodes
File "/home/runner/.local/lib/python3.8/site-packages/schemathesis/specs/graphql/init.py", line 1, in
from .loaders import from_asgi, from_dict, from_file, from_path, from_url, from_wsgi
File "/home/runner/.local/lib/python3.8/site-packages/schemathesis/specs/graphql/loaders.py", line 9, in
from starlette.testclient import TestClient as ASGIClient
File "/home/runner/.local/lib/python3.8/site-packages/starlette/testclient.py", line 15, in
import httpx
ModuleNotFoundError: No module named 'httpx'

Expected behavior
It seems that dependencies that are still in version 0.x.y should not be used openly, which means their api is still changing frequently.

Environment (please complete the following information):

  • OS:Linux
  • Python version: 3.8
  • Schemathesis version: 3.17.2

Additional context
looks related to this
encode/starlette#1376

It looks like this issue is not fully resolved.
#1417

@Bidaya0 Bidaya0 added Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior labels Sep 27, 2022
@t-huyeng
Copy link

I can confirm this issue.

  • using GitHub Actions

@TheMatrix97
Copy link

facing the same issue, no matter what version of schemathesis / python

@Kludex
Copy link

Kludex commented Sep 27, 2022

pip install httpx is a temporary fix 👀

@mdavis-xyz
Copy link
Contributor

The starlette readme says:

Starlette only requires anyio, and the following are optional:

  • [httpx](https://www.python-httpx.org/) - Required if you want to use the TestClient.
    

It looks like Schemathesis wants to use the TestClient, therefore httpx should be added as a non-temporary requirement of schemathesis. I'll write a PR for that.

@mdavis-xyz
Copy link
Contributor

Ah actually it looks like schemathesis uses poetry, which I am not familiar with. So I'm not confident I know where to add the new dependency.

Can someone else add it? Does it go in pyproject.toml or poetry.lock?

@Kludex
Copy link

Kludex commented Sep 28, 2022

poetry add httpx>=0.22.0
poetry lock --no-update

@mdavis-xyz
Copy link
Contributor

Ok I'll try that.

Why did you say httpx>=0.22.0 and not just httpx?

@Kludex
Copy link

Kludex commented Sep 29, 2022

Because it's the minimum version that Starlette supports. 🙏

CommanderStorm added a commit to TUM-Dev/NavigaTUM that referenced this issue Oct 1, 2022
@CommanderStorm
Copy link

pip install httpx is a temporary fix eyes

This is awkward: How did you do this?
I tried to add this dependency via pip this way, but this does not work, as (assuming this is the culprit) the schemathesis action does install python dependencies itself.

@Kludex
Copy link

Kludex commented Oct 1, 2022

idk, different virtual env? 🤷‍♂️

t-huyeng added a commit to t-huyeng/geoportal-openapis that referenced this issue Oct 5, 2022
lukaspanni added a commit to lukaspanni/smard-api that referenced this issue Oct 7, 2022
lukaspanni added a commit to lukaspanni/smard-api that referenced this issue Oct 7, 2022
@devicehzy
Copy link

  • solution by poetry
[tool.poetry.dependencies]
starlette = "0.17.1"
werkzeug = "2.0.2"

CommanderStorm added a commit to TUM-Dev/NavigaTUM that referenced this issue Oct 8, 2022
@Stranger6667
Copy link
Member

The issue is fixed in 3.17.3. Let me know if the fix doesn't work for you

@Stranger6667
Copy link
Member

And sorry for the delay!

t-huyeng added a commit to t-huyeng/geoportal-openapis that referenced this issue Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior
Projects
None yet
8 participants