|
831 | 831 | "3. Create a new file called `pyproject.toml` in the top-level `mypackage` directory with the content from the cell above.\n", |
832 | 832 | "4. Open the terminal (`File` -> `New Launcher`, then select `Terminal`), and run the following command to install `mypackage`:\n", |
833 | 833 | "```bash\n", |
834 | | -"$pip install mypackage/\n", |
| 834 | +" pip install mypackage/\n", |
835 | 835 | "```\n", |
836 | 836 | "5. Return to the new notebook we created in the previous exercise and try to import the `mypackage` package again.\n", |
837 | 837 | "\n", |
|
878 | 878 | "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", |
879 | 879 | "For example, John Doe can use `johndoe`, `john.doe`, `johnd`, `jdoe`, etc.\n", |
880 | 880 | "\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\"." |
882 | 897 | ] |
883 | 898 | }, |
884 | 899 | { |
|
897 | 912 | "source": [ |
898 | 913 | "### Exercise on initializing a Git repository\n", |
899 | 914 | "\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", |
902 | 920 | "```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", |
904 | 923 | "```\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", |
906 | 928 | "```\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", |
909 | 934 | "```\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", |
911 | 937 | "```bash\n", |
912 | | -" $ git add .\n", |
| 938 | +"git add .gitignore\n", |
| 939 | +"git add mypackage\n", |
913 | 940 | "```\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", |
919 | 941 | "\n", |
920 | | -"5. Review the changes that will be committed:\n", |
| 942 | +"6. Review the changes that will be committed:\n", |
921 | 943 | "```bash\n", |
922 | | -" $git status\n", |
| 944 | +"git status\n", |
923 | 945 | "```\n", |
924 | 946 | "\n", |
925 | | -"6. Run the following command to commit the changes:\n", |
| 947 | +"7. Run the following command to commit the changes:\n", |
926 | 948 | "```bash\n", |
927 | | -" $git commit -m\"Initial commit\"\n", |
| 949 | +"git commit -m\"Initial commit\"\n", |
928 | 950 | "```\n", |
929 | 951 | "\n", |
930 | 952 | "Now, we have a Git repository with the initial commit.\n", |
|
956 | 978 | "source": [ |
957 | 979 | "### Exercise on connecting the local Git repository to the remote GitHub repository\n", |
958 | 980 | "\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", |
960 | 987 | "\n", |
961 | 988 | " > …or push an existing repository from the command line\n", |
962 | 989 | "\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", |
965 | 993 | "\n", |
966 | 994 | "Congratulations, your package is now on GitHub!" |
967 | 995 | ] |
|
986 | 1014 | "This is my first package.\n", |
987 | 1015 | "\n", |
988 | 1016 | "# 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", |
990 | 1018 | "\n", |
991 | 1019 | "```\n", |
992 | 1020 | "\n", |
993 | 1021 | "3. Run the following commands to add the changes to the staging area and commit them:\n", |
994 | 1022 | "```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", |
997 | 1025 | "```\n", |
998 | 1026 | "\n", |
999 | 1027 | "4. Run the following command to push the changes to GitHub:\n", |
1000 | 1028 | "```bash\n", |
1001 | | -"$git push\n", |
| 1029 | +" git push\n", |
1002 | 1030 | "```\n", |
1003 | 1031 | "\n", |
1004 | 1032 | "5. Reload the page on GitHub. You should see the changes you made." |
|
1012 | 1040 | "\n", |
1013 | 1041 | "1. Uninstall the `mypackage` package:\n", |
1014 | 1042 | "```bash\n", |
1015 | | -"$pip uninstall mypackage\n", |
| 1043 | +" pip uninstall mypackage\n", |
1016 | 1044 | "```\n", |
1017 | 1045 | "2. Ask another tutorial's participant to share the URL of their package with you.\n", |
1018 | 1046 | "3. Open the URL and study the README file.\n", |
|
1043 | 1071 | "name":"python", |
1044 | 1072 | "nbconvert_exporter":"python", |
1045 | 1073 | "pygments_lexer":"ipython3", |
1046 | | -"version":"3.9.12" |
| 1074 | +"version":"3.10.10" |
1047 | 1075 | } |
1048 | 1076 | }, |
1049 | 1077 | "nbformat":4, |
|