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

Error on missing argument if installed from pypi #58

Open
shevron opened this issue Nov 23, 2020 · 4 comments
Open

Error on missing argument if installed from pypi #58

shevron opened this issue Nov 23, 2020 · 4 comments

Comments

@shevron
Copy link
Contributor

shevron commented Nov 23, 2020

After installing from pypi I get:

Traceback (most recent call last):
  File "${HOME}/.local/lib/python3.7/site-packages/giftless/wsgi_entrypoint.py", line 7, in <module>
    app = init_app()
  File "${HOME}.local/lib/python3.7/site-packages/giftless/app.py", line 43, in init_app
    transfer.init_flask_app(app)
  File "${HOME}/.local/lib/python3.7/site-packages/giftless/transfer/__init__.py", line 71, in init_flask_app
    adapter.register_views(app)
  File "${HOME}/.local/lib/python3.7/site-packages/giftless/transfer/basic_streaming.py", line 158, in register_views
    ObjectsView.register(app, init_argument=self.storage)
  File "${HOME}/.local/lib/python3.7/site-packages/giftless/view.py", line 30, in register
    return super().register(*args, **kwargs)
  File "${HOME}/.local/lib/python3.7/site-packages/flask_classful.py", line 138, in register
    proxy = cls.make_proxy_method(name)
  File "${HOME}/.local/lib/python3.7/site-packages/flask_classful.py", line 230, in make_proxy_method
    i = cls()
TypeError: __init__() missing 1 required positional argument: 'storage'
unable to load app 0 (mountpoint='') (callable not found or import error)

The last call comes from flask_classfull, where I have version 0.14.2, if that is important.

Originally posted by @ANaumann85 in #57 (comment)

@shevron
Copy link
Contributor Author

shevron commented Nov 23, 2020

Unfortunately this is a known issue and it happens because our setup.py just refers to flask-classful but requirements.txt requires Flask-Classful to be of a non-released Git revision which is not available on Pypi (yet?). The code relies on features in the non-released version of Flask-Classful.

I'll see how we can work around this issue. In the mean time, can you try to run the following in your virtual environment / local environemnt where you installed Giftless:

pip install -r https://raw.githubusercontent.com/datopian/giftless/master/requirements.txt

This should ensure all dependency versions are exactly as specified in requirements.txt. Let me know if that solves the issue.

@ANaumann85
Copy link

yes, that particular requirements and the newly build flask solve the issue.
Thank you for your fast response and solution.

@shevron
Copy link
Contributor Author

shevron commented Nov 25, 2020

I've tried a fix in #59 but it seems this direct notation is not allowed by pypi (when installing locally from setup.py it does work but pypi won't accept the package).

As it doesn't seem like flask-classful is going to make a release to pypi with the code we need soon, I am thinking about some alternatives:

  1. Make our own release of flask-classful (e.g. flask-classful-myfork) to pypi (not a good idea)
  2. Change the code to not require the extra constructor argument somehow (need to check if feasible) and rely on flask-classful 0.14.*.
  3. Drop dependency on flask-classful all together (may be a good idea but requires some effort)
  4. Drop dependency on Flask all together and switch to another framework specifically designed for APIs (e.g. FastAPI) - this will require more considerable effort, but may be worth it. However, if we switch to non-WSGI (e.g. ASGI) framework, we will need to replace current support for WSGI middleware, specifically for CORS and proxy forwarding, with something else.

From all of these, I think 2 and 3 make the most sense. I will need to look into them.

Of course, these is the option of not doing anything and waiting for flask-classful to make a release.

@gonewest818
Copy link

I'll just say as a newcomer the giftless documentation could be more explicit that THIS is the issue that people will encounter if they try to install from pypi. Docs are currently a bit vague as to what the symptom will be, or even which dependency is involved. A simple link and note to "see #58 for more info" might help there. If the docs had only mentioned "flask-classful" I might have noticed the stack trace and made the connection.

Considering the long hiatus since the most recent flask-classful release (and 18 months since even a commit) I tend to agree option 2 or 3 seems most prudent for right now.

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

3 participants