-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from SissiFeng/main
update MD files for software dev course
- Loading branch information
Showing
22 changed files
with
1,824 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
|
||
(4.1-setup-vscode)= | ||
# 🧩 4.1 Setting Up VS Code | ||
|
||
```{contents} | ||
:depth: 3 | ||
``` | ||
|
||
## 🔰 Tutorial | ||
|
||
In this module, you will learn how to set up VS Code and optimize it for Python development using tools like Miniconda, various extensions, and advanced features. | ||
|
||
1. Set up VS Code | ||
2. Install Miniconda for environment management | ||
3. Install key VS Code extensions for Python development | ||
4. Configure SSH for remote development | ||
5. Explore advanced tools such as Black formatter, Pylance, and GitHub Copilot Chat | ||
|
||
### Setting Up VS Code | ||
|
||
First, you will download and install Visual Studio Code (VS Code), a lightweight and powerful editor. Then, you'll learn how to configure it for efficient Python development. | ||
|
||
#### Steps: | ||
|
||
1. Download and install VS Code from the official site: [VS Code Download](https://code.visualstudio.com/). | ||
2. Open VS Code and get familiar with the interface, including the command palette, sidebar, and settings menu. | ||
|
||
**Video Tutorial**: [Getting Started with VS Code](https://www.youtube.com/watch?v=VqCgcpAypFQ) | ||
|
||
### Installing Miniconda | ||
|
||
Miniconda is a lightweight distribution of Conda, an environment and package manager for Python. It allows you to manage multiple isolated environments on your machine. | ||
|
||
```{note} | ||
Consider using [Mamba](https://github.com/mamba-org/mamba), a widely used, fast (written in C++), drop-in replacement for conda. | ||
``` | ||
|
||
#### Steps: | ||
|
||
1. Download Miniconda from the [official site](https://docs.conda.io/en/latest/miniconda.html). | ||
2. Install Miniconda by following the instructions for your operating system. | ||
3. After installation, create a new Python environment: | ||
```bash | ||
conda create -n myenv python=3.9 | ||
conda activate myenv | ||
``` | ||
|
||
4. Ensure that VS Code is set up to use this environment for Python development. | ||
|
||
**Video Tutorial**: [How to Install Miniconda](https://www.youtube.com/watch?v=oHHbsMfyNR4&pp=ygUYSG93IHRvIEluc3RhbGwgTWluaWNvbmRh) | ||
|
||
### Installing Essential VS Code Extensions | ||
|
||
Extensions can enhance the functionality of VS Code, especially for Python development. Below are some essential extensions to install: | ||
|
||
- [Python Extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python): Adds Python language support. | ||
- [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance): A high-performance language server with type checking and autocompletion. | ||
- [Black Formatter](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter): Automatically formats your Python code. | ||
- [autoDocstring](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring): Generates docstrings for your Python functions and methods. | ||
- [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot): An AI-powered coding assistant. | ||
- [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat): AI chat features powered by Copilot. | ||
- [Remote - SSH](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh): For remote development using SSH. | ||
|
||
To install these extensions: | ||
1. Open the **Extensions** view in VS Code (`Ctrl + Shift + X`). | ||
2. Search for each extension by name and click **Install**. | ||
|
||
**Video Tutorial**: [Best VS Code Extensions for Python](https://www.youtube.com/watch?v=fj2tuTIcUys&pp=ygUiQmVzdCBWUyBDb2RlIEV4dGVuc2lvbnMgZm9yIFB5dGhvbg%3D%3D) | ||
|
||
### Using SSH for Remote Development | ||
|
||
VS Code supports remote development, allowing you to write and run code on a remote machine as if it were local. | ||
|
||
#### Steps: | ||
|
||
1. Install the **Remote - SSH** extension from the marketplace. | ||
2. Set up SSH on your local machine by generating SSH keys: | ||
```bash | ||
ssh-keygen -t rsa -b 4096 | ||
``` | ||
3. Copy the public key to your remote server: | ||
```bash | ||
ssh-copy-id username@hostname | ||
``` | ||
4. Use VS Code's Remote Explorer to connect to the remote server using SSH. | ||
**Video Tutorial**: [VS Code Remote Development with SSH](https://www.youtube.com/watch?v=miyD4c1dnTU&pp=ygUjVlMgQ29kZSBSZW1vdGUgRGV2ZWxvcG1lbnQgd2l0aCBTU0g%3D) | ||
### Configuring Black Formatter | ||
Black is an opinionated Python code formatter that ensures code is formatted consistently. Here’s how to configure it in VS Code: | ||
1. Open the VS Code **Settings** (`Ctrl + ,`). | ||
2. Search for `Python Formatting Provider` and set it to `Black`. | ||
3. You can also configure VS Code to format your code on save by enabling the "Format on Save" option in settings. | ||
**Video Tutorial**: [How to Use Black in VS Code](https://www.youtube.com/watch?v=esZLCuWs_2Y) | ||
### GitHub Copilot Chat | ||
GitHub Copilot can assist you by suggesting code snippets, entire functions, and even refactoring your code. With **GitHub Copilot Chat**, you can interact with Copilot via a chat interface to get suggestions and resolve issues. | ||
#### Steps: | ||
1. Install **GitHub Copilot** and **GitHub Copilot Chat** extensions. | ||
2. After installation, sign in to your GitHub account in VS Code. | ||
3. Open the Copilot Chat interface and ask for help with coding, debugging, or writing functions. | ||
**Video Tutorial**: [GitHub Copilot Chat](https://www.youtube.com/watch?v=a2DDYMEPwbE&pp=ygUTR2l0SHViIENvcGlsb3QgQ2hhdA%3D%3D) | ||
### Additional Resources | ||
- [VS Code Documentation](https://code.visualstudio.com/docs) | ||
- [Conda Environments Guide](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) | ||
- [Setting up VS Code for Python](https://code.visualstudio.com/docs/python/python-tutorial) | ||
- [Black Formatter Documentation](https://black.readthedocs.io/en/stable/) | ||
- [GitHub Copilot Documentation](https://docs.github.com/en/copilot) | ||
## 🚀 Quiz | ||
::::{tab-set} | ||
:sync-group: category | ||
:::{tab-item} Sp/Su 2024 | ||
:sync: sp2024 | ||
[URL] | ||
::: | ||
:::: | ||
## 📄 Assignment | ||
1. **Set up VS Code**: | ||
- Download and install VS Code, and create a Python virtual environment using Miniconda. | ||
2. **Install Extensions**: | ||
- Install the recommended extensions and configure Black as the default formatter. | ||
3. **SSH Configuration**: | ||
- Set up SSH access to a remote machine and use VS Code to write and run Python code remotely. | ||
::::{tab-set} | ||
:sync-group: category | ||
:::{tab-item} Sp/Su 2024 | ||
:sync: sp2024 | ||
[URL] | ||
::: | ||
:::: |
Oops, something went wrong.