@@ -24,30 +24,44 @@ Using the tools module, we can efficiently get them in terms of a dictionary.
24
24
25
25
The function returns a dictionary containing the username and email information.
26
26
27
- 2) You can also override existing values by passing a dictionary to the function with the keys ``"username" `` and ``"email" `` ::
27
+ 2) There are a few ways you could use to override the user information in the configuration files
28
+ * You can override existing values by passing a dictionary to the function with the keys ``"username" `` and ``"email" `` ::
28
29
29
- new_args = {"username": "new_username", "email": "[email protected] "}
30
- new_user_info = get_user_info(new_args)
30
+ new_args = {"username": "new_username", "email": "[email protected] "}
31
+ new_user_info = get_user_info(new_args)
31
32
32
- 3) You can update only the username or email individually, for example ::
33
+ This returns "new_username" and "[email protected] " instead of the
34
+ * You can update only the username or email individually, for example ::
33
35
34
- new_username = {"username": new_username}
35
- new_user_info = get_user_info(new_username)
36
+ new_username = {"username": new_username}
37
+ new_user_info = get_user_info(new_username)
36
38
37
- This updates username to "new_username" while fetching the email from inputs or the configuration files.
38
- Similarly, you can update only the email. ::
39
+ This updates username to "new_username" while fetching the email from inputs or the configuration files.
40
+ Similarly, you can update only the email. ::
39
41
40
- new_email = {"email": [email protected] }
41
- new_user_info = get_user_info(new_email)
42
+ new_email = {"email": [email protected] }
43
+ new_user_info = get_user_info(new_email)
42
44
43
- This updates the email to "[email protected] " while fetching the username from inputs or the configuration files.
45
+ This updates the email to "[email protected] " while fetching the username from inputs or the configuration files.
46
+
47
+ 3) You can also permanently update your default configuration file manually.
48
+ Locate the file ``diffpyconfig.json ``, which is usually in the user's home directory (``~/.diffpy/ ``) or ``~/.config/diffpy/ ``.
49
+ Open the file using a text editor such as nano, vim, or a graphical editor like VS Code.
50
+ Look for entries like these ::
51
+
52
+ {
53
+ "username": "John Doe",
54
+
55
+ }
56
+
57
+ Then you can update the username and email as needed, make sure to save your edits.
44
58
45
59
4) We also have the function ``get_package_info ``, which inserts or updates package names and versions
46
60
in the given metadata dictionary under the key "package_info".
47
61
It stores the package information as {"package_info": {"package_name": "version_number"}}.
48
62
This function can be used as follows. ::
49
63
50
- from diffpy.utils.tools import get_user_info
64
+ from diffpy.utils.tools import get_package_info
51
65
package_metadata = get_package_info("my_package")
52
66
53
67
You can also specify an existing dictionary to be updated with the information. ::
0 commit comments