[MRG] Print survey link upon first launch of GUI or first import#1158
Conversation
|
Thanks Karthikeya, unfortunately you seem to be correct, in that pip doesn't appear to have support for a "post-install message" that is separate from the potentially large amount of |
0af4ca5 to
1afe3b7
Compare
|
@sketch123456 , I have finished going over your PR and making some changes. Thanks for your contribution! I think it's now ready for review by our other developers. I've made some changes to the code, but mostly only minor things. However, in order to resolve some merge conflicts, it was easiest to "rebase" the branch, which I have done remotely. In other words, if you want to check out your branch locally on your computer, the history on origin has been changed, and you must delete (or overwrite) your local branch. You can find some guidance on how to do this at our Contributing Guide here https://jonescompneurolab.github.io/hnn-core/stable/contributing.html#keeping-your-code-up-to-date-by-rebasing |
|
@ntolley @dylansdaniels This is now ready for review by another member of the team (since I edited a bunch of the code). The "flag" file for the survey is now saved to, essentially, |
|
This will resolve #1141 . |
|
This was reviewed in a group Code Review meeting either last week or the week before. Merging after I add in a circleci fix commit. |
Currently, both the script and notebook versions of our example file `examples/workflows/plot_simulate_somato.py` fail because of an upstream breakage in how the MNE sample data is downloaded and unpacked (see here fatiando/pooch#518 This change fixes the issue by "capping" the Pooch version to a prior version which does not contain the bug.
This PR is in regard to issue #1141 .
There is no reliable way to print a message after the user runs
pip installthat works across all installation methods. It may be done if the user runs the verbose install (pip install -v), but this may not be entirely user-friendly.As such, my approach to this problem was to print a link to the survey upon the first successful import or the first successful launch of the GUI.
import hnn_core, the message is displayed viahnn_core/__init__.pyhnn-guiwithout importing the package directly, the message is displayed viahnn_core/gui/__init__.pyA persistent config file
~/.hnn_core_config.jsonensures the message is only shown once, regardless of which interaction path the user takes first.Changes Made:
hnn_core/_first_run.pycontaining thecheck_first_run()function that:~/.hnn_core_config.jsonexistshnn_core/__init__.pyto callcheck_first_run()to catch first import scenarioshnn_core/gui/__init__.pyto callcheck_first_run()to catch first GUI launch scenariosBoth implementations wrap the check in try-except blocks to ensure that any errors in displaying the message don't break core functionality.