Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09b391d

Browse files
Fix modules and packages notebook (empa-scientific-it#346)
* Add a screenshot to switch to SSH* Remove $ signs from bash commands.* Remove unnecessary warning.* Update instructions on uploading repo to GitHub.* Fix blank lines around some commands---------Co-authored-by: Edoardo Baldi <edoardob90@gmail.com>
1 parent2f99183 commit09b391d

File tree

2 files changed

+56
-28
lines changed

2 files changed

+56
-28
lines changed

‎06_modules_and_packages.ipynb‎

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@
831831
"3. Create a new file called `pyproject.toml` in the top-level `mypackage` directory with the content from the cell above.\n",
832832
"4. Open the terminal (`File` -> `New Launcher`, then select `Terminal`), and run the following command to install `mypackage`:\n",
833833
"```bash\n",
834-
"$pip install mypackage/\n",
834+
" pip install mypackage/\n",
835835
"```\n",
836836
"5. Return to the new notebook we created in the previous exercise and try to import the `mypackage` package again.\n",
837837
"\n",
@@ -878,7 +878,22 @@
878878
"You can still change it later, but it is better not to do it at all due to [unwanted consequences](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/changing-your-github-username).\n",
879879
"For example, John Doe can use `johndoe`, `john.doe`, `johnd`, `jdoe`, etc.\n",
880880
"\n",
881-
"2. [Create an access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic) for your account that will be used instead of your password."
881+
"2. Enable passwordless connection to your GitHub profile.\n",
882+
"\n",
883+
" 1. For that, you first need to open the Terminal and type the following:\n",
884+
" ```bash\n",
885+
" ssh-keygen -t rsa\n",
886+
" ```\n",
887+
" Then hit `Enter` three times to accept the default values.\n",
888+
"\n",
889+
" 1. In the File Browser, enter the `.ssh` folder and open the file named `id_rsa.pub`.\n",
890+
" Copy its content.\n",
891+
"\n",
892+
" 1. Go to [github.com](https://github.com), click on your icon (top right corner) and select `Settings`.\n",
893+
" In the newly opened window, select\"SSH and GPG keys\" and click on\"New SSH key\".\n",
894+
" Provide the key title (e.g. `python-intro-tutorial`) and paste the key content in the\"Key\" field.\n",
895+
"\n",
896+
" 1. Click on\"Add SSH key\"."
882897
]
883898
},
884899
{
@@ -897,34 +912,41 @@
897912
"source": [
898913
"### Exercise on initializing a Git repository\n",
899914
"\n",
900-
"1. Open the terminal and navigate to the `mypackage` directory.\n",
901-
"2. Run the following command to initialize a Git repository:\n",
915+
"\n",
916+
"\n",
917+
"1. Open the terminal and navigate to the `mypackage` directory\n",
918+
"\n",
919+
"2. (optional) If you haven't done this before, set up your GitHub information\n",
902920
"```bash\n",
903-
" $ git init\n",
921+
"git config --global user.email\"you@example.com\" # Your GitHub email\n",
922+
"git config --global user.name\"Your Name\" # Your name on GitHub\n",
904923
"```\n",
905-
"3. Create a new file named `.gitignore` (do **not** forget the leading `.`) in the package directory with the following content to exclude some temporary files from the repository:\n",
924+
"\n",
925+
"3. Run the following command to initialize a Git repository:\n",
926+
"```bash\n",
927+
"git init\n",
906928
"```\n",
907-
" .ipynb_checkpoints\n",
908-
" __pycache__\n",
929+
"\n",
930+
"4. Create a new file named `.gitignore` (do **not** forget the leading `.`) in the package directory with the following content to exclude some temporary files from the repository:\n",
931+
"```\n",
932+
".ipynb_checkpoints\n",
933+
"__pycache__\n",
909934
"```\n",
910-
"4. Run the following command to add all files to the staging area:\n",
935+
"\n",
936+
"5. Run the following command to add all files to the staging area:\n",
911937
"```bash\n",
912-
" $ git add .\n",
938+
"git add .gitignore\n",
939+
"git add mypackage\n",
913940
"```\n",
914-
"<div class=\"alert alert-block alert-warning\">\n",
915-
"<b>Warning:</b> the dot (<code>.</code>) means <b>all files</b> in the current directory **except** those listed in the <code>.gitignore</code> file.\n",
916-
"Git does not track files that are listed in the <code>.gitignore</code> file.\n",
917-
"The <code>.gitignore</code> file, however, should be committed to the repository.\n",
918-
"</div>\n",
919941
"\n",
920-
"5. Review the changes that will be committed:\n",
942+
"6. Review the changes that will be committed:\n",
921943
"```bash\n",
922-
" $git status\n",
944+
"git status\n",
923945
"```\n",
924946
"\n",
925-
"6. Run the following command to commit the changes:\n",
947+
"7. Run the following command to commit the changes:\n",
926948
"```bash\n",
927-
" $git commit -m\"Initial commit\"\n",
949+
"git commit -m\"Initial commit\"\n",
928950
"```\n",
929951
"\n",
930952
"Now, we have a Git repository with the initial commit.\n",
@@ -956,12 +978,18 @@
956978
"source": [
957979
"### Exercise on connecting the local Git repository to the remote GitHub repository\n",
958980
"\n",
959-
"1. Have a look at your new repository on GitHub. You should see a message like this:\n",
981+
"1. Have a look at your new repository on GitHub. You should see something like this\n",
982+
" <img src=\"images/git_switch_to_ssh.png\" alt=\"Start a new Renku session\" width=\"800\"/>\n",
983+
" Before you continue, please switch to SSH (as shown in the Figure).\n",
984+
"\n",
985+
"\n",
986+
"2. Copy the commands that are located under the message:\n",
960987
"\n",
961988
" > …or push an existing repository from the command line\n",
962989
"\n",
963-
"2. Copy the command that starts with `git remote add origin...` (all three of them) and paste it into the terminal. Enter your GitHub username and token generated earlier instead of the password.\n",
964-
"3. Reload the page on GitHub. You should see the files from the local Git repository.\n",
990+
"3. Now, in the Terminal, enter the\"mypackage\" folder, paste all three commands, and hit\"Enter\".\n",
991+
"\n",
992+
"4. Reload the page on GitHub. You should see the files from the local Git repository.\n",
965993
"\n",
966994
"Congratulations, your package is now on GitHub!"
967995
]
@@ -986,19 +1014,19 @@
9861014
"This is my first package.\n",
9871015
"\n",
9881016
"# Installation\n",
989-
"$pip install git+<specify the URL of your package here>\n",
1017+
"pip install git+<specify the URL of your package here>\n",
9901018
"\n",
9911019
"```\n",
9921020
"\n",
9931021
"3. Run the following commands to add the changes to the staging area and commit them:\n",
9941022
"```bash\n",
995-
"$git add .\n",
996-
"$git commit -m\"Add personal message and README\"\n",
1023+
" git add .\n",
1024+
" git commit -m\"Add personal message and README\"\n",
9971025
"```\n",
9981026
"\n",
9991027
"4. Run the following command to push the changes to GitHub:\n",
10001028
"```bash\n",
1001-
"$git push\n",
1029+
" git push\n",
10021030
"```\n",
10031031
"\n",
10041032
"5. Reload the page on GitHub. You should see the changes you made."
@@ -1012,7 +1040,7 @@
10121040
"\n",
10131041
"1. Uninstall the `mypackage` package:\n",
10141042
"```bash\n",
1015-
"$pip uninstall mypackage\n",
1043+
" pip uninstall mypackage\n",
10161044
"```\n",
10171045
"2. Ask another tutorial's participant to share the URL of their package with you.\n",
10181046
"3. Open the URL and study the README file.\n",
@@ -1043,7 +1071,7 @@
10431071
"name":"python",
10441072
"nbconvert_exporter":"python",
10451073
"pygments_lexer":"ipython3",
1046-
"version":"3.9.12"
1074+
"version":"3.10.10"
10471075
}
10481076
},
10491077
"nbformat":4,

‎images/git_switch_to_ssh.png‎

244 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp