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: content/1-hour/1-add-endpoint.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ It's standard to work in phases when adding functionality to an application. Giv
13
13
The application uses a Flask app with SQLAlchemy as the backend API (in the [app/server][server-code] folder), and an Astro app as the frontend (in the [app/client][client-code] folder). You will explore more of the project later; this exercise will focus solely on the Flask application.
14
14
15
15
> [!NOTE]
16
-
> As you begin making changes to the application, there is always a chance a breaking change could be created. If the page stops working, check the terminal window you used previously to start the application for any error messages. You can stop the app by using <kbd>Ctl</kbd>+<kbd>C</kbd>, and restart it by running the script appropriate for your operating system: `./app/scripts/start-app.sh` (macOS / Linux) or `./app/scripts/start-app.ps1` (Windows PowerShell).
16
+
> As you begin making changes to the application, there is always a chance a breaking change could be created. If the page stops working, check the terminal window you used previously to start the application for any error messages. You can stop the app by using <kbd>Ctrl</kbd>+<kbd>C</kbd>, and restart it by running the script appropriate for your operating system: `./app/scripts/start-app.sh` (macOS / Linux) or `./app/scripts/start-app.ps1` (Windows PowerShell).
17
17
18
18
## Flask routes
19
19
@@ -34,7 +34,7 @@ Let's build our new route in our Flask backend with the help of code completion.
34
34
35
35
1. Return to your IDE with the project open.
36
36
2. Open **app/server/app.py**.
37
-
3. Locate the comment which reads `## HERE`, which should be at line 69.
37
+
3. Locate the comment which reads `## HERE`, which should be at line 80.
38
38
4. Delete the comment to ensure there isn't any confusion for Copilot, and leave your cursor there.
39
39
5. Begin adding the code to create the route to return all breeds from an endpoint of **api/breeds** by typing the following:
40
40
@@ -68,7 +68,7 @@ Let's build our new route in our Flask backend with the help of code completion.
68
68
> [!IMPORTANT]
69
69
> Because LLMs are probabilistic, not deterministic, the exact code generated can vary. The above is a representative example. If your code is different, that's just fine as long as it works!
70
70
71
-
8. Add a comment to the newly created function. To do this, place your cursor inside the function (anywhere between the lines `def get_breeds...`and`return jsonify...`). Then, press <kbd>Ctl</kbd>+<kbd>I</kbd> (or<kbd>cmd</kbd>+<kbd>I</kbd> on a Mac) to open the editor inline chat. In the input box, type`/doc`. (You can optionally provide additional details, but it's not required). This will prompt GitHub Copilot to generate a documentation comment for the function. The suggested comment will appear inline in the code (highlighted in green). Click **Accept** to apply the comment to your code, or click **Close** to discard the suggestion. You just used a slash command, a shortcut to streamline a task, these commands eliminate the need for verbose prompts.
71
+
8. Add a comment to the newly created function. To do this, place your cursor inside the function (anywhere between the lines `def get_breeds...`and`return jsonify...`). Then, press <kbd>Ctrl</kbd>+<kbd>I</kbd> (or<kbd>cmd</kbd>+<kbd>I</kbd> on a Mac) to open the editor inline chat. In the input box, type`/doc`. (You can optionally provide additional details, but it's not required). This will prompt GitHub Copilot to generate a documentation comment for the function. The suggested comment will appear inline in the code (highlighted in green). Click **Accept** to apply the comment to your code, or click **Close** to discard the suggestion. You just used a slash command, a shortcut to streamline a task, these commands eliminate the need for verbose prompts.
72
72
73
73
9. **Save** the file.
74
74
@@ -94,13 +94,13 @@ You've added a new endpoint with the help of GitHub Copilot! You saw how Copilot
Copy file name to clipboardExpand all lines: content/1-hour/4-add-feature.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ And
65
65
66
66
1. Review the code suggestions to ensure they behave the way you expect them to, making any necessary changes. Once you're satisfied, you can select **Keep** on the files individually or in Copilot Chat to accept all changes.
67
67
2. Open the page at [http://localhost:4321][tailspin-shelter-website] to see the updates!
68
-
3. Run the Python tests by using`python -m unittest`in the terminal as you did previously.
68
+
3. Run the Python tests by running`python -m unittest`from the `app/server` directory in the terminal.
69
69
4. If any changes are needed, explain the required updates to GitHub Copilot and allow it to generate the new code.
Copy file name to clipboardExpand all lines: content/1-hour/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ You will also need the following available and installed locally:
39
39
- A shell capable of running BASH commands.
40
40
41
41
> [!NOTE]
42
-
> Linux and macOS are able to run BASH commands without additional configuration. For Windows, you will need either [Windows Subsystem for Linux (WS)][windows-subsystem-linux] or the BASH shell available via [git][git-link].
42
+
> Linux and macOS are able to run BASH commands without additional configuration. For Windows, you will need either [Windows Subsystem for Linux (WSL)][windows-subsystem-linux] or the BASH shell available via [git][git-link].
Copy file name to clipboardExpand all lines: content/full-day/2-issues.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ Our project needs two main updates. We want to make the updates to support devel
49
49
| Add filters to dog list | Add the code to allow users to filter for dogs by breed and availability |
50
50
51
51
> [!TIP]
52
-
> You can also save an issue by pressing <kbd>Ctl</kbd> - <kbd>Enter</kbd> (or <kbd>Cmd</kbd> - <kbd>Return</kbd> on a Mac) in the title or description fields.
52
+
> You can also save an issue by pressing <kbd>Ctrl</kbd> - <kbd>Enter</kbd> (or <kbd>Cmd</kbd> - <kbd>Return</kbd> on a Mac) in the title or description fields.
53
53
54
54
You've now defined all the issues for the workshop! You'll use these issues to help guide your progress through the workshop.
Copy file name to clipboardExpand all lines: content/full-day/3-codespaces.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ You've now defined a custom container!
99
99
100
100
## Use the newly defined custom container
101
101
102
-
Whenever someone uses the codespace you defined they'll have an environment with Node.js and Mongo DB, and the GitHub Copilot extension installed. Let's use this container!
102
+
Whenever someone uses the codespace you defined they'll have an environment with Node.js and SQLite, and the GitHub Copilot extension installed. Let's use this container!
103
103
104
104
1. Access the Command Palette (<kbd>F1</kbd> or clicking ☰ → View → Command Palette), then start typing **dev container**.
105
105
1. Type **rebuild** and select **Codespaces: Rebuild container**.
@@ -117,7 +117,7 @@ Custom containers for GitHub Codespaces become part of the source code for the r
117
117
> [!IMPORTANT]
118
118
> For purposes of this exercise we are pushing code updates directly to `main`, our default branch. Normally you would follow the [GitHub flow][github-flow], which we will do in a [later exercise][github-flow-exercise].
119
119
120
-
1. Open a new terminal window in the codespace by selecting <kbd>Ctl</kbd> + <kbd>Shift</kbd> + <kbd>`</kbd> or clicking ☰ → View → Terminal.
120
+
1. Open a new terminal window in the codespace by selecting <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>`</kbd> or clicking ☰ → View → Terminal.
121
121
2. Find the issue number for defining the codespace by entering the following command:
Copy file name to clipboardExpand all lines: content/full-day/5-context.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Before adding new functionality to the website, you want to explore the existing
11
11
12
12
## Getting started with GitHub Copilot
13
13
14
-
GitHub Copilot is a cloud-based service offered for both individuals and businesses. As an individual, you can [sign up for a free account][copilot-signup] of the service. After enrolling you will typically install the extension for your IDE, which is available for [Visual Studio][copilot-vs], [Visual Studio Code][copilot-vscode], [NeoVIM][copilot-vim], the [JetBrains IDEs][copilot-jetbrains], [XCode](copilot-xcode) and [Eclipse][copilot-eclipse]. Because we'll be using the [Codespace][walkthrough-codespaces] you defined in the previous exercise, you won't need to manually install the extension - you did that when you configured the dev container!
14
+
GitHub Copilot is a cloud-based service offered for both individuals and businesses. As an individual, you can [sign up for a free account][copilot-signup] of the service. After enrolling you will typically install the extension for your IDE, which is available for [Visual Studio][copilot-vs], [Visual Studio Code][copilot-vscode], [NeoVIM][copilot-vim], the [JetBrains IDEs][copilot-jetbrains], [XCode][copilot-xcode] and [Eclipse][copilot-eclipse]. Because we'll be using the [Codespace][walkthrough-codespaces] you defined in the previous exercise, you won't need to manually install the extension - you did that when you configured the dev container!
15
15
16
16
1. If you don't already have access to GitHub Copilot, [sign up for a free trial][copilot-signup].
17
17
2. In the [previous exercise][walkthrough-codespaces] you configured your [devcontainer][devcontainer-docs] to automatically install the extension for GitHub Copilot, so you're all set and ready to go!
@@ -75,7 +75,7 @@ This is an application to allow people to look for dogs to adopt. It is built in
75
75
## Backend
76
76
77
77
- Built using Flask and SQLAlchemy
78
-
- All routes require unit tests, which are created in *test_file.py* in the same folder as the file
78
+
- All routes require unit tests, which are created in *test_app.py* in the same folder as the file
79
79
- When creating tests, always mock database calls
80
80
81
81
## Frontend
@@ -118,13 +118,13 @@ Congratulations! You've explored context in GitHub Copilot, which is key to gene
Copy file name to clipboardExpand all lines: content/full-day/6-code.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,11 +37,11 @@ Let's build our new route in our Flask backend with the help of code completion.
37
37
38
38
1. Return to your codespace, or reopen it by navigating to your repository and selecting **Code** > **Codespaces** and the name of your codespace.
39
39
2. Open **app/server/app.py**.
40
-
3. Locate the section of code at the very bottom which launches the server, and put your cursor just above it. This should be line 71, and the code will be:
40
+
3. Locate the section of code at the very bottom which launches the server, and put your cursor just above it. This should be line 82, and the code will be:
41
41
42
42
```python
43
43
if__name__=='__main__':
44
-
app.run(debug=True, port=5100) # Port 5100 to avoid macOS conflicts
44
+
app.run(debug=True, port=5100) # Port 5100 to avoid macOS conflicts
45
45
```
46
46
47
47
4. Create the route which will call the database to find all breeds, and returns a JSON array with their names and IDs. If you begin typing `@app.route`or add a comment with the requirements like `# Route to get all breeds`, you should notice italicized text generated by GitHub Copilot.
@@ -64,9 +64,9 @@ With the route created, we want to now add the tests to ensure the code is corre
64
64
7. Review and validate the code, making any necessary changes. Select **Keep** once you're satisfied.
65
65
> [!IMPORTANT]
66
66
> GitHub Copilot, like any generative AI solution, can make mistakes. Always review the generated code, making any necessary changes to ensure it's accurate and performs as expected.
67
-
8. Open a terminal window in your codespace orVS Code by selecting <kbd>Ctl</kbd>+<kbd>Shift</kbd>+<kbd>`</kbd>
68
-
9. Ensure the virtual serveris activated by running the terminal command `source ./venv/bin/activate`
69
-
10. Navigate to the **server** folder by running the terminal command `cd server`
67
+
8. Open a terminal window in your codespace orVS Code by selecting <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>`</kbd>
68
+
9. Ensure the virtual environmentis activated by running the terminal command `source ./venv/bin/activate`
69
+
10. Navigate to the **app/server** folder by running the terminal command `cd app/server`
70
70
11. Run the tests by running the terminal command `python -m unittest`
0 commit comments