You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-6Lines changed: 46 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,22 +22,62 @@ This repository gives us a chance to practice using git and virtual environments
22
22
23
23
## Create a Virtual Environment and Install Dependencies
24
24
25
-
1. The AdaSay project requires the cowsay package to run. We want to install this dependency in a virtual environment so that it is used only for this project. We first run the following command to create a virtaul environment:
25
+
5. The AdaSay project requires the cowsay package to run. We want to install this dependency in a virtual environment so that it is used only for this project. We first run the following command to create a virtaul environment:
26
26
27
27
```python -m venv venv```
28
28
29
-
2. This will create a new folder named `venv` which will hold all the information about our virtual environment. Verify that this folder was created by running `ls` and seeing that `venv` is one of the folders present.
29
+
6. This will create a new folder named `venv` which will hold all the information about our virtual environment. Verify that this folder was created by running `ls` and seeing that `venv` is one of the folders present.
30
30
31
-
3. We now need to activate the virtual environment. Everything else up to this point was one-time setup, but we will need to repeat this step each time we open a new terminal to interact with this project. We activate the virtual environment by running the activation script in the `venv` folder.
31
+
7. We now need to activate the virtual environment. Everything else up to this point was one-time setup, but we will need to repeat this step each time we open a new terminal to interact with this project. We activate the virtual environment by running the activation script in the `venv` folder.
32
32
33
33
```source venv/bin/activate```
34
34
35
-
4. Verify that the virtual environment has been activated. If `(venv)` appears at the front of your shell prompt, you have successfully activated the environment.
35
+
8. Verify that the virtual environment has been activated. If `(venv)` appears at the front of your shell prompt, you have successfully activated the environment.
36
36
37
-
5. Next, we want to install all the requirements. This projects specifies the what packages it needs in the `requirements.txt` file. We use pip to read this file and install the needed dependencies:
37
+
9. Next, we want to install all the requirements. This projects specifies the what packages it needs in the `requirements.txt` file. We use pip to read this file and install the needed dependencies:
38
38
39
39
```pip install -r requirements.txt```
40
40
41
-
6. Now that the requirements are installed, we're ready to try running our program. Run the following command (in a terminal that has the virtual environment activated) and see if we get a cow outputted:
41
+
10. Now that the requirements are installed, we're ready to try running our program. Run the following command (in a terminal that has the virtual environment activated) and see if we get a cow outputted:
42
42
43
43
```python main.py```
44
+
45
+
## Make and Commit Changes
46
+
47
+
11. Right now the cow doesn't say anything interesting. Let's change that! Start by opening VS Code in the AdaSay directory.
48
+
49
+
```code .```
50
+
51
+
12. Edit `main.py` to make the cow say something interesting. Make sure to save the file in VS Code after you make your change!
52
+
53
+
13. Verify that your changes work by running `main.py` again. (Note: if you use the terminal inside VS Code, you may need to activate the virtual environment on that new terminal. See step 7.)
54
+
55
+
```python main.py```
56
+
57
+
14. Once you're satisfied with your changes double-check which files have been changed.
58
+
59
+
```git status```
60
+
61
+
15. You should expect to see that only `main.py` was changed. We'll now stage this for our commit.
62
+
63
+
```git add main.py```
64
+
65
+
16. Check the status of the files again. You should see that `main.py` is now shown in green, indicating that it will be part of our commit.
66
+
67
+
```git status```
68
+
69
+
17. Commit the changes. Add some meaningful commit message that describes the changes you made. (Hint: do not use exclamation marks in your commit message)
70
+
71
+
```git commit -m "Changed cow message to COWABUNGA"```
72
+
73
+
18. Push the changes to GitHub. If asked for a username and password, use your GitHub username and your Personal Access Token (PAT).
74
+
75
+
```git push origin```
76
+
77
+
19. Check that the changes are reflected in GitHub. Refresh the GitHub page in your browser and see that your new change is present in `main.py`.
78
+
79
+
20. BONUS: do some searching online to figure out how to have cowsay use a dragon instead of a cow. Modify your code to use the dragon, stage your changes, make a commit, and push the commit to GitHub.
80
+
81
+
21. Once you're finished working on this exercise, deactivate the virtual environment.
0 commit comments