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

[3.0.0a2] connexion example not working #1670

Closed
drummerwolli opened this issue Mar 7, 2023 · 7 comments
Closed

[3.0.0a2] connexion example not working #1670

drummerwolli opened this issue Mar 7, 2023 · 7 comments

Comments

@drummerwolli
Copy link
Contributor

drummerwolli commented Mar 7, 2023

Description

I'm setting up a new connexion project, and i want to directly use version 3.0.0 to not have later a costly migration. so for now, its okay to use a non-production version. But I get an import error. so i checked the most basic example, but i still get the same error.

Expected behaviour

the example project just works with the latest 3.0.0 alpha version.

Actual behaviour

I get an import error:

Traceback (most recent call last):
  File "/home/fhalkivaha/GIT/connexion-example/app.py", line 52, in <module>
    app.run(port=8080, server='gevent')
  File "/home/fhalkivaha/.pyenv/versions/3.10.6/envs/venv-3.10-1/lib/python3.10/site-packages/connexion/apps/abstract.py", line 243, in run
    self.middleware.run(import_string, **kwargs)
  File "/home/fhalkivaha/.pyenv/versions/3.10.6/envs/venv-3.10-1/lib/python3.10/site-packages/connexion/middleware/main.py", line 324, in run
    uvicorn.run(app, **kwargs)
  File "/home/fhalkivaha/.pyenv/versions/3.10.6/envs/venv-3.10-1/lib/python3.10/site-packages/uvicorn/main.py", line 445, in run
    config = Config(app, **kwargs)
TypeError: Config.__init__() got an unexpected keyword argument 'server'

Steps to reproduce

  1. git clone git@github.com:hjacobs/connexion-example.git
  2. cd connexion-example
  3. rm Pipfile && rm Pipfile.lock (we gonna use poetry)
  4. add this basic poetry file (created with poetry init):
[tool.poetry]
name = "connexion-example"
version = "0.1.0"
description = ""
authors = ["fhalkivaha <fabian@zalando.de>"]
readme = "README.md"
packages = [{include = "connexion_example"}]

[tool.poetry.dependencies]
python = "^3.10"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  1. poetry add connexion --allow-prereleases -E flask -E uvicorn
  2. poetry run python3 app.py

Additional info:

I'm using poetry version 1.4.0.

Output of the commands:

  • poetry run python3 --version : Python 3.10.6
  • connexion commit used: cd64611
@drummerwolli
Copy link
Contributor Author

i just saw that #1648 was merged just two weeks ago, and i would need that. so even more a reason to use 3.0.0 🥳

@RobbeSneyders
Copy link
Member

Hi @drummerwolli,

ModuleNotFoundError: Please install connexion using the 'flask' extra

Can you try:

pip install --pre connexion[flask]

@drummerwolli
Copy link
Contributor Author

drummerwolli commented Mar 7, 2023

i'm using poetry, so cant use pip. but i found now finally the flag for poetry to install pre-packages: poetry add connexion --allow-prereleases --extras "flask"

but now i get a different import error:

    import uvicorn
ModuleNotFoundError: No module named 'uvicorn'

(adjusted the original issue text above)

@RobbeSneyders
Copy link
Member

There's also an extra for uvicorn, but we should make the error more clear.

@drummerwolli
Copy link
Contributor Author

yeah, also just saw that. i added now the uvicorn package: poetry add connexion --allow-prereleases -E flask -E uvicorn

but now i get:

Traceback (most recent call last):
  File "/home/fhalkivaha/GIT/connexion-example/app.py", line 52, in <module>
    app.run(port=8080, server='gevent')
  File "/home/fhalkivaha/.pyenv/versions/3.10.6/envs/venv-3.10-1/lib/python3.10/site-packages/connexion/apps/abstract.py", line 243, in run
    self.middleware.run(import_string, **kwargs)
  File "/home/fhalkivaha/.pyenv/versions/3.10.6/envs/venv-3.10-1/lib/python3.10/site-packages/connexion/middleware/main.py", line 324, in run
    uvicorn.run(app, **kwargs)
  File "/home/fhalkivaha/.pyenv/versions/3.10.6/envs/venv-3.10-1/lib/python3.10/site-packages/uvicorn/main.py", line 445, in run
    config = Config(app, **kwargs)
TypeError: Config.__init__() got an unexpected keyword argument 'server'

@RobbeSneyders
Copy link
Member

RobbeSneyders commented Mar 7, 2023

uvicorn does not accept a server keyword argument.

@drummerwolli
Copy link
Contributor Author

drummerwolli commented Mar 7, 2023

ah, i see now the server key argument in the app.run. removing that works just fine! thanks ❤️

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

2 participants