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: Using-GitHub-Copilot-with-Python/README.md
+51-4Lines changed: 51 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,15 @@ Prepare to tackle a practical, hands-on project! You’ll work on modifying a Py
10
10
11
11
12
12
-**Who this is for**: Developers, DevOps Engineers, Software development managers, Testers.
13
-
-**What you'll learn**: Using GitHub Copilot to create code and add comments to your work.
13
+
-**What you'll learn**: How to use GitHub Copilot to for code completion, inline suggestions and next edit suggestions, as well as adding comments to your work.
14
14
-**What you'll build**: Python files that will have code generated by Copilot AI for code and comment suggestions.
15
15
-**Prerequisites**: GitHub Copilot is available to use for free, sign up for [GitHub Copilot](https://gh.io/copilot).
16
16
-**Timing**: This module can be completed in under an hour.
17
17
18
-
By the end of this module, you'll aquire the skills to be able to:
18
+
By the end of this module, you'll acquire the skills to be able to:
19
19
20
-
- Craft prompts to generate suggestions from GitHub Copilot
20
+
- Engage with Copilot in the IDE using inline suggestions and next-edit completions.
21
+
- Craft prompts to generate suggestions from GitHub Copilot using code completion and chat.
21
22
- Apply GitHub Copilot to improve your projects.
22
23
23
24
## Prerequisite reading:
@@ -27,7 +28,8 @@ By the end of this module, you'll aquire the skills to be able to:
27
28
## Requirements
28
29
29
30
1. Enable your [GitHub Copilot service](https://github.com/github-copilot/signup)
30
-
1. Open [this repository with Codespaces](https://codespaces.new/MicrosoftDocs/mslearn-copilot-codespaces-python)
31
+
32
+
2. Open [this repository with Codespaces](https://codespaces.new/MicrosoftDocs/mslearn-copilot-codespaces-python)
31
33
32
34
## 💪🏽 Exercise
33
35
@@ -37,6 +39,51 @@ By the end of this module, you'll aquire the skills to be able to:
37
39
38
40
The API already has a single endpoint to generate a token. Let's update the API by adding a new endpoint that accepts text and returns a list of tokens.
39
41
42
+
### 🗒️ Section 1: Exploring Your Project
43
+
44
+
🎯**Learning Goals**
45
+
- Use inline code completion to scaffold new classes and methods
46
+
- Trigger and refine Copilot completions
47
+
- Use inline chat and slash commands
48
+
49
+
Once your Codespace launches, you'll have a fully functional development environment with the entire repository preloaded. This is the perfect time to explore GitHub Copilot Chat to help you better understand the codebase.
50
+
51
+
To get started:
52
+
53
+
1. Click the Copilot Chat icon in the top-right corner of the Codespace window:
2. Instead of manually exploring the project and various folders, try asking Copilot for an overview. In the chat pane, type '/' to view available slash commands — these offer quick, structured ways to interact with Copilot.
60
+
61
+
Type `/help` to see all commands, or check out the [GitHub Copilot Chat cheat sheet](https://docs.github.com/copilot/reference/github-copilot-chat-cheat-sheet#slash-commands) for a list of available slash commands.
62
+
63
+
For example, you can use:
64
+
-`/doc` to add a documentation comment
65
+
-`/explain` to explain the code
66
+
-`/fix` to propose a fix for the problems in the selected code
67
+
-`/generate` to generate code to answer your question
68
+
69
+
3. In lieu of using natural language, type `/explain` into the chat pane. The output from GitHub Copilot will go into details of how the project is structured, including further information of the Frontend and Backend details.
70
+
71
+
TODO: GIF
72
+
<divalign="left">
73
+
<imgsrc="./images/002explainoutput.gif"alt="Output of /Explain"width="500"height="300">
74
+
</div>
75
+
76
+
4. As a visual learner, you can ask GitHub Copilot to 'create a diagram of the workflow of the application'. This could be saved into a README for further documentation.
77
+
78
+
TODO: GIF
79
+
<divalign="left">
80
+
<imgsrc="./images/movingdiagram.gif"alt="Output of application diagram"width="500"height="300">
81
+
</div>
82
+
83
+
In the above exercises we achieved the following:
84
+
- ✅ Used slash commands to explain new code
85
+
- ✅ Created a diagram to visualize and understand the application flow
86
+
-
40
87
### 🛠 Step 1: Add a Pydantic model
41
88
42
89
Go to the `main.py` file, navigate to the bottom of the provided code, select **Ctrl + I (PC)** or **Cmd + I (Mac)** and copy the following into the provided GitHub Copilot Chat box so that it can generate a `Pydantic` model for you:
0 commit comments