Skip to content

Commit 60f8f69

Browse files
committed
Enhance API Workshop documentation with detailed Python installation instructions and improved project setup steps
1 parent 2962d0c commit 60f8f69

File tree

1 file changed

+61
-12
lines changed

1 file changed

+61
-12
lines changed

src/content/docs/guides/py/api_workshop.mdx

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,47 @@ If an API has an OpenAPI formatted yml or json file, you can use Swagger UI to v
8484

8585
## Setting up your Environment
8686

87-
<LinkCard title="Download & install Python" href="https://www.python.org/downloads" description="python.org/downloads" />
87+
<Card>
88+
### Installing Python
89+
<Aside type="caution">
90+
Before you start, make sure you only have a single version of Python installed.
91+
92+
If you are unsure goto the terminal and run:
93+
```shell
94+
python --version
95+
```
96+
97+
If you see `Python 2.x.x` quit python by typing `quit()` and run:
98+
```shell
99+
python3 --version
100+
```
88101

89-
<LinkCard title="Download & install VS Code" href="https://code.visualstudio.com/download" description="code.visualstudio.com/download" />
102+
If you see `Python 3.x.x` you are good to go. If not, you need to install Python 3.
90103

91-
<LinkCard title="Download & install the Python extension for VS Code" href="https://marketplace.visualstudio.com/items?itemName=ms-python.python" description="marketplace.visualstudio.com/items?itemName=ms-python.python" />
104+
**Note**: Certain versions of Windows `python` and `python3` might open the Microsoft Store. If that happens, press `GET` and install Python 3 from the store.
105+
</Aside>
92106

93-
<LinkCard title="Download & install the Thunder Client extension" href="https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client" description="marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client" />
107+
Installing Python is straightforward. You can download the latest version from the official Python website.
94108

95-
<LinkCard title="[Optional] Download & install Code for IBM i" href="https://marketplace.visualstudio.com/items?itemName=HalcyonTechLtd.ibm-i-development-pack" description="marketplace.visualstudio.com/items?itemName=HalcyonTechLtd.ibm-i-development-pack" />
109+
When you first install Python, make sure to check the box that says **"Add Python to PATH"**to make it easier to run Python commands from the terminal.
96110

111+
<LinkCard title="Download & install Python" href="https://www.python.org/downloads" description="python.org/downloads" />
112+
</Card>
113+
114+
<CardGrid>
115+
<Card>
116+
<LinkCard title="Download & install VS Code" href="https://code.visualstudio.com/download" description="code.visualstudio.com/download" />
117+
</Card>
118+
<Card>
119+
<LinkCard title="Download & install the Python extension for VS Code" href="https://marketplace.visualstudio.com/items?itemName=ms-python.python" description="marketplace.visualstudio.com/items?itemName=ms-python.python" />
120+
</Card>
121+
<Card>
122+
<LinkCard title="Download & install the Thunder Client extension" href="https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client" description="marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client" />
123+
</Card>
124+
<Card>
125+
<LinkCard title="[Optional] Download & install Code for IBM i" href="https://marketplace.visualstudio.com/items?itemName=HalcyonTechLtd.ibm-i-development-pack" description="marketplace.visualstudio.com/items?itemName=HalcyonTechLtd.ibm-i-development-pack" />
126+
</Card>
127+
</CardGrid>
97128
<Aside type="note">
98129
In this guide, we use `python3` and `pip3` commands. Depending on your system configuration, `python` might refer to Python 2. If that's the case, you need to use `python3` and `pip3` instead.
99130
You can get more specific by using `python3.6` or `python3.9` if you have multiple versions installed.
@@ -102,11 +133,11 @@ You can get more specific by using `python3.6` or `python3.9` if you have multip
102133
### Project Setup
103134
<CardGrid stagger>
104135
<Card title="Step #1" icon="add-document">
105-
Create a new folder for your project.
136+
Create a new folder for your project. This can be a folder anywhere on your computer.
106137
</Card>
107138

108139
<Card title="Step #2" icon="open-book">
109-
Open Visual Studio Code and select "Open Folder" to open your project folder.
140+
Open Visual Studio Code and select `FILE` and "Open Folder" to open your project folder.
110141
</Card>
111142

112143
<Card title="Step #3" icon="forward-slash">
@@ -119,24 +150,29 @@ Create a new virtual environment:
119150
python3 -m venv --system-site-packages venv
120151
```
121152
<Aside type="note">
122-
Virtual environments are used to manage dependencies for your projects.
153+
Virtual environments are used to manage dependencies for your projects. All your `PIP` installs will be isolated to this environment.
123154
</Aside>
124155
</Card>
125156

126157
<Card title="Step #5" icon="rocket">
127158
Activate your virtual environment:
128-
- On PASE (IBM i):
159+
- On Windows:
129160
```shell
130-
. venv/bin/activate
161+
venv\Scripts\activate
131162
```
132163
- On macOS/Linux:
133164
```shell
134165
source venv/bin/activate
135166
```
136-
- On Windows:
167+
- On PASE (IBM i):
137168
```shell
138-
venv\Scripts\activate
169+
. venv/bin/activate
139170
```
171+
<Aside type="note">
172+
If you see `(venv)` in your terminal prompt, you have successfully activated your virtual environment.
173+
174+
You will need to activate your virtual environment every time you open a new terminal.
175+
</Aside>
140176
</Card>
141177
</CardGrid>
142178

@@ -151,6 +187,17 @@ pip3 install flask
151187

152188
<Card>
153189
### Step 2: Create a new file `hello.py`
190+
191+
<Aside type="info">
192+
Your directory structure should look like this:
193+
```
194+
project-folder/
195+
├── venv/
196+
| └── ...
197+
├── .env
198+
└── main.py
199+
```
200+
</Aside>
154201
```python
155202
// hello.py
156203

@@ -162,6 +209,7 @@ app = Flask(__name__)
162209
def home():
163210
return 'Hello, World!'
164211

212+
# ^^ Add New Routes Above ^^
165213
if __name__ == '__main__':
166214
app.run(debug=True, port=5000)
167215
```
@@ -302,6 +350,7 @@ def get_employees():
302350

303351
return jsonify(employee_list)
304352

353+
# ^^ Add New Routes Above ^^
305354
if __name__ == '__main__':
306355
app.run(debug=True, port=int(os.getenv('PORT')))
307356
```

0 commit comments

Comments
 (0)