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

Added extra information in warning for better capturing of user info #149

Merged
merged 9 commits into from
Nov 7, 2024

Conversation

alisnwu
Copy link

@alisnwu alisnwu commented Nov 5, 2024

closes #129 and #140

@sbillinge ready for review

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the best way to do this is to paste the outputs into the comments under different situations and we can discuss what is the clearest wording?

@@ -0,0 +1,23 @@
**Added:**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can delete this file.

@@ -114,6 +115,11 @@ def get_user_info(args=None):
global_config = load_config(Path().home() / "diffpyconfig.json")
local_config = load_config(Path().cwd() / "diffpyconfig.json")
if global_config is None and local_config is None:
warnings.warn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite what I had in mind. Just the warning messages in the prompts could be clearer. We could put this preamble message here if we really like it, but I would like to see it in the context of the full workflow pasted in the comments before deciding.

@alisnwu have you run through the whole workflow to see what it looks like and where it can be improved?

Even if we do want this wording, I think this is not a good use of warnings.warn. We are not using any of its features. A simple print statement would be clearer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbillinge Would this be a better way to word the prompts?

Screenshot 2024-11-06 at 10 42 10 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I like that (modulo a slight grammatical boo boo)!

How about something a bit more human friendly:
"No global configuration file was found containing information about the user to associate with the data. By following the prompts below you can add your name and email to this file on the current computer and your name will be automatically associated with subsequent diffpy data by default. This is not recommended on a shared or public computer. You will only have to do that once. For more information "

we need a workflow for people to update this global config file later if they want. Pease could you make an issue to check/work on that and maybe do it on a separate PR? Thanks!

@alisnwu
Copy link
Author

alisnwu commented Nov 6, 2024

Screenshot 2024-11-06 at 6 32 37 PM

@sbillinge ready for review

@sbillinge
Copy link
Contributor

Thanks @alisnwu

It seems to be failing pre-commit. Also, I think it would be easier to read if it were formatted a bit better on the terminal. This will depend on the configuration on the user's computer but having some line-breaks and/or empty lines to make it easier to read would be nice I think? What do you think?

Please can you check with Bob why the tests are not running?

@bobleesj
Copy link
Contributor

bobleesj commented Nov 6, 2024

@alisnwu Once you are done with formatting, could you tag me? Let's see if the tests are running. Also, plz don't forget to run pre-commit run --all-files! Feel free to configure a shortcut/alias like pc so save time - This habit saves time for the reviewers and also makes the history clean.

Ref: https://github.com/bobleesj/command-line-cheatsheet/?tab=readme-ov-file#command-line-shortcuts

@alisnwu
Copy link
Author

alisnwu commented Nov 6, 2024

Screenshot 2024-11-06 at 6 51 46 PM

@sbillinge I added some newline to make the message easier to read, how does this look?

@bobleesj
Copy link
Contributor

bobleesj commented Nov 7, 2024

Please can you check with Bob why the tests are not running?

@sbillinge #159 CI Pytest running again - need to merge this to see the global effect

@sbillinge sbillinge merged commit 0b90f3e into diffpy:main Nov 7, 2024
2 checks passed
@sbillinge
Copy link
Contributor

nice! Thanks @alisnwu !

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

Successfully merging this pull request may close these issues.

Add instructions/link to fix missing user info issue in get_user_info function in tools.py
3 participants