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] Incompatibility issues with Quart and Quart-CORS due to unspecific version requirements #29

Open
DjangoPeng opened this issue May 17, 2023 · 5 comments

Comments

@DjangoPeng
Copy link

Environment Information:

  • OS: Ubuntu 18.04.6 LTS
  • Python Version: 3.6.9
  • Quart Version: 0.6.15
  • Quart-CORS Version: 0.1.3

Current Situation:

The versions are unspecific, leading to issues with Quart and Quart-CORS APIs when used. For instance:

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    @app.post("/todos/<string:username>")
AttributeError: 'Quart' object has no attribute 'post'

Changing all @app HTTP method calls to this style:

@app.route("/todos/<string:username>", methods=["POST"])

allows successful execution of main.py.

However, it's unable to load the sample project "TODO Plugin (no auth)" at https://chat.openai.com/ and the following error is displayed:

[2023-05-17 15:08:42,918] ERROR in app: Exception on request GET /logo.png
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1451, in handle_request
    return await self.full_dispatch_request(request_context)
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1473, in full_dispatch_request
    result = await self.handle_user_exception(error)
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 892, in handle_user_exception
    raise error
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1471, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1519, in dispatch_request
    return await handler(**request_.view_args)
  File "main.py", line 36, in plugin_logo
    return await quart.send_file(filename, mimetype='image/png')
TypeError: send_file() got an unexpected keyword argument 'mimetype'

This issue seems to be related to the versioning of Quart and Quart-CORS. Can we specify the versions in the requirements to prevent these issues?

@DjangoPeng
Copy link
Author

@logankilpatrick PTAL

DjangoPeng added a commit to DjangoPeng/plugins-quickstart that referenced this issue May 17, 2023
@evanroyrees
Copy link

Simply cloning, installing dependencies and running python main.py fails.

Pinning dependencies may make this more stable.

(gpt-plugins) ➜  plugins-quickstart git:(main) python main.py 
Traceback (most recent call last):
  File "/Users/rees/plugins-quickstart/main.py", line 4, in <module>
    import quart_cors
  File "/Users/rees/mambaforge/envs/gpt-plugins/lib/python3.11/site-packages/quart_cors/__init__.py", line 6, in <module>
    from quart.datastructures import HeaderSet, RequestAccessControl
ImportError: cannot import name 'HeaderSet' from 'quart.datastructures' (/Users/rees/mambaforge/envs/gpt-plugins/lib/python3.11/site-packages/quart/datastructures.py)
(gpt-plugins) ➜  plugins-quickstart git:(main) mamba list quart    
# packages in environment at /Users/rees/mambaforge/envs/gpt-plugins:
#
# Name                    Version                   Build  Channel
quart                     0.18.3             pyhd8ed1ab_0    conda-forge
quart-cors                0.2.0                      py_0    conda-forge

@DjangoPeng
Copy link
Author

@WiscEvan

How about taking a look at #30

@evanroyrees
Copy link

I gave your code a try as well and this still resulted in the error.

The error seems to be a result of using quart-cors 0.2.0 rather than quart-cors 0.6.0

The code ran without any issues with these versions:

# packages in environment at /Users/rees/mambaforge/envs/gpt-plugins:
#
# Name                    Version                   Build  Channel
quart                     0.18.4                   pypi_0    pypi
quart-cors                0.6.0                    pypi_0    pypi

The conda-forge channel for quart-cors appears to be out of date. This was resolved by installing with pip rather than mamba

The quart-cors conda-forge package should be bumped from 0.2.0 to the latest version to install using the conda package manager. Otherwise, installation should be performed using pypi

@DjangoPeng
Copy link
Author

I see.

Thanks for your explanation.

Let me update the PR( #30) to specify version of quart-cors

xianminx added a commit to xianminx/plugins-quickstart that referenced this issue Jul 5, 2023
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