-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use runtime config file for setting tokens and parameters. #385
Comments
This is great Paul! Thanks for jumping in! Do you have anything in mind about how the encryption workflow will work? |
Ups! my fault.. didn't mean GUI but UI (not only graphical User Interfaces, but non-graphical User Interfaces like command-line programs built on top of QISKit too). |
We do need to truly reach a consensus and look at the situation fully - while the final solution will most likely involve making use a file on the user's folder, the problem has a wider scope and still needs to be fleshed out, as hinted in #226. Also, #376 is potentially a blocker as well, depending on how coupled we intend to make it with the authentication ( A non-comprehensive recap about things that might need to be considered:
Personally, I think something along the lines of having an opt-in way of reading the configuration from a small number of "default" places (ie. the current working directory, the user config file and the environment variables), and a script that the users can execute to generate it for the first time (ideally for updating it as well) might be a good compromise - the "easiness of use" vs "be flexible enough" is the point that I find harder to balance. |
My concern about implementing this solution as a default from
[1] The QConfig.py will slightly change. Instead of writing the token to this file directly, the new QConfig will read the token from the env variable, this way we DON'T NEED TO UPDATE ANY TUTORIAL, as the import os
APItoken = os.environ['QE_TOKEN']
config = {
"url": 'https://quantumexperience.ng.bluemix.net/api'
}
if 'APItoken' not in locals():
raise Exception("Please set up your access token. See Qconfig.py.") What do you think? |
Good ideas all around. My thinking was to do away with the user modifying anything at all, just registering backends, or updating credentials as necessary. All the code for creating, modifying, and reading the configrc files is already created. A blank file would be created at initial run, or during install. Based on the feedback from @atilag, one could have an option for which service does the token handling. Something like from external_backend.tokens import CustomTokenService
register(url, token, encrypted=True, service=CustomTokenService, **kwargs) One could then pass |
I should also mention that I am not advocating that everything be done in |
Closing this issue in the hopes of continuing the discussion at #540 and finally get the feature in place 🎉 |
How to deal if this erro? I am trying to register, but I simply cannot During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Thank you any help |
For this to work, you need to be using the Master branch of If these do not work, then please open a new issue. |
Currently, many users have trouble understanding / setting the Qconfig.py file. This issue is the start of a Pull that replaces the current Qconfig file with a runtime config file,
qiskitrc
, that (by convention) is located in the users home directory: e.g.HOME\.qiskit\qiskitrc
. Tokens and other information can be saved and loaded by defining sections in the config file. e.g. When doingregister(token, url, **kwargs)
:The tokens can also be encrypted before saving (if we want to go down that road), so that the user must input a password once, before the (decrypted) token is loaded into the current session. Thoughts on this would be appreciated before I go and implement it. This would be done after the modifications for the next release (0.5).
The text was updated successfully, but these errors were encountered: