-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix interface of run_api for running REST API #3875
fix interface of run_api for running REST API #3875
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3875 +/- ##
===========================================
- Coverage 77.18% 77.17% -0.01%
===========================================
Files 457 457
Lines 33779 33775 -4
===========================================
- Hits 26072 26067 -5
- Misses 7707 7708 +1
Continue to review full report at Codecov.
|
docs/source/conf.py
Outdated
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', | ||
'sphinx.ext.coverage', 'sphinx.ext.imgmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', | ||
'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive', | ||
'sphinxcontrib.contentui', 'aiida.sphinxext'] | ||
ipython_mplbackend = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, not quite - I added some new references to flask
, which then caused the docs build to fail, which then caused me to add an intersphinx pointer to the flask docs here.
Which then caused me to think about adding also the docs of the python standard library (which is #3876)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then don't we just want to first merge #3876 which should be fine without this PR and then you rebase this PR on top of that, which then only includes relevant changes, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, it's just extra effort and I think it's ok to keep the flask intersphinx mapping in this PR - otherwise I need to add another nitpick here and remove it again.
if you want me to do this, let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around a bit with the intersphinx and nitpicks, and rebased your other PR and merged it. This PR is now also rebased and you already addressed my comments, so will also merge this. Thanks a lot!
The current `run_api` interface for running the AiiDA REST API had unnecessarily many parameters, making it complicated to use in WSGI scripts, e.g.: ```python from aiida.restapi import api from aiida.restapi.run_api import run_api import aiida.restapi CONFIG_DIR = os.path.join(os.path.split( os.path.abspath(aiida.restapi.__file__))[0], 'common') (app, api) = run_api( api.App, api.AiidaApi, hostname="localhost", port=5000, config=CONFIG_DIR, debug=False, wsgi_profile=False, hookup=False, catch_internal_server=False ) ``` While all but the first two parameters are keyword arguments, the code would actually crash if they are not provided. In reality, there is no reason to have to specify *any* parameters whatsoever and one should simply be able to call `run_api()`. This commit accomplishes this by defining the appropriate default values.
59d76ca
to
e8067f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @ltalirz
Great, thanks a lot Seb!
…On Sun, 29 Mar 2020 at 23:10, Sebastiaan Huber ***@***.***> wrote:
Merged #3875 <#3875> into
develop.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3875 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIBEPN5UMT2E57GZ2WGNCDRJ62MHANCNFSM4LVRLZEQ>
.
|
Fixes #3870
The current
run_api
interface for running the AiiDA REST API hadunnecessarily many required arguments, making it complicated to use in WSGI
scripts, e.g.:
While all but the first two parameters are keyword arguments, the code
would actually crash if some of the keyword arguments are not provided.
In reality, there is no reason to force people to specify any parameters
whatsoever. One should simply be able to call
run_api()
.This commit accomplishes this by defining the appropriate default
values (without introducing breaking changes).