Summary and Schedule
This is a new lesson built with The Carpentries Workbench.
Before coming to this course please make sure you have:
- Basic computer skills and fundamental coding knowledge (e.g., knowledge of different data types, loading data, writing simple functions)
- Familiarity with a code editor (e.g., VSCode)
- Interest in AI-assisted coding tools
After following this lesson, learners will be able to:
- Generate code and optimize its performance using an AI coding assistant
- Refactor and improve the structure and quality of existing code using an AI coding assistant
- Automate repetitive coding tasks using AI coding assistant
- Generate and improve documentation using AI coding assistant
- Recognize, evaluate, and mitigate ethical and security considerations when using AI coding assistant
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Introduction to AI Coding Assistants |
How do AI coding assistants work? What are the main AI coding assistants and what are their main characteristics? How to set up Codeium as a coding assistant for the lesson? |
Duration: 00h 20m | 2. Code Generation and Optimization |
What are the three main modes of Codeium and how do they differ? How can developers effectively use the Command feature for code generation and refactoring? What role does context awareness play in improving Codeium’s suggestions? How does the Chat feature complement the Command and Autocomplete modes? What are the best practices for writing prompts that get optimal results from Codeium? |
Duration: 01h 20m | 3. Ethical and Security Considerations |
What are the potential biases inherent in AI coding assistants and how
can they affect code quality? How can developers effectively validate and test AI-generated code to ensure security and reliability? What measures can be taken to protect sensitive data when using AI coding assistants? |
Duration: 02h 00m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
For this lesson, the setup includes a coding environment, an AI coding assistant, and datasets for practical exercises.
Code Editor
The recommended code editor for this lesson is Visual Studio Code, a popular code editor frequently used by researchers. You can download it from the official website. Follow the instructions on the website to install it on your operating system.
Setting up Codeium
Make sure you have an Integrated Development Environment (IDE) installed on your computer. Go to the Codeium download page to see a list of supported IDEs and installation instructions. Visual Studio Code is on the list, so if you followed the previous step, you are all set.
Open Extension Marketplace: Open the Extension Marketplace, which is the icon with boxes on the primary sidebar in your VS Code.
Install Codeium: Type Codeium in the marketplace search bar, open up the page and click the blue Install button.
Authorize: After installation is complete, you should be prompted by Visual Studio Code with a pop-up on the bottom right to authorize Codeium. If not, you should see an option to sign in to your Codeium account in the bottom left Accounts tab of your Visual Studio Code window. Click the Sign in with Auth to use Codeium option. Either method (popup or Accounts tab) should redirect you to the Codeium website.
Create Account: If you do not have a Codeium account yet, you will be redirected to create an account.
Sign In: If you are not signed in, please sign in with your account details. Once you sign in, you will be redirected back to Visual Studio Code via pop-up. Click Open Visual Studio Code, which should redirect you back to Visual Studio Code. If you are using a browser-based IDE, instead of being redirected back with pop-up, you will be routed to instructions on how to complete authentication by providing an access token. Please follow these instructions instead of Step 6, and then continue on with “Using Codeium.”
All Done! You will be asked to confirm the authentication in Visual Studio Code (click Open in the resulting pop-up).
Make sure that the extension is enabled by checking the bottom left corner of your Visual Studio Code window. You should see a Codeium icon there. Otherwise, go to the marketplace, look for Codeium, and click the Enable button. It could be necessary to reload the window after enabling the extension.
You can alternatively follow the Codeium installation instructions in VS Code on the official website, which will guide you through the same steps.
Additional Notes
- If you have issues with enabling the Codeium chat, it could be due to the disabled telemetry on your VS Code. Make sure to enable telemetry by following the instructions on the VS Code telemetry page.
- Codeium can be also used with other IDEs, such as IntelliJ IDEA, PyCharm, Vim, and WebStorm. You can find the installation instructions for these IDEs on the Codeium download page.
Data Sets
For this lesson, we will work with datasets tracking atmospheric CO2 levels, specifically the Trends in Atmospheric Carbon Dioxide dataset, available here. This dataset, sourced from the U.S. Government’s Earth System Research Laboratory, Global Monitoring Division, includes two primary series:
Mauna Loa Series – The longest continuous record of atmospheric CO₂ concentrations, dating back to 1958, from measurements at Mauna Loa Observatory in Hawaii.
Global Average Series – A calculated global average of atmospheric CO₂ levels from marine surface sites worldwide.
During the exercises, we will download and analyze these datasets together, so there’s no need to prepare or download anything in advance.
Setting Up Your Python Environment
Installing Python
For the practical exercises in this lesson, we will use Python. If Python isn’t already installed on your system, download it from the official Python website and follow the provided instructions for installation.
Setting Up a Virtual Environment
To ensure a consistent and isolated Python environment, we recommend using a virtual environment. Virtual environments allow you to manage dependencies specific to each project without affecting other Python projects or your global Python setup.
Install virtualenv
if it’s not already available by running:
Alternatively, you can use pipx
to manage
virtualenv
installation:
Then, in your project directory, you can create a virtual environment:
This command will create a .venv
folder in your current
directory to store all environment-specific files.
To activate the virtual environment, you will use the following command:
- On Windows, run
.venv\Scripts\activate.bat
- On macOS/Linux, run
source .venv/bin/activate
After activation, you should see the name of your environment (e.g.,
.venv
) appear in your terminal prompt, indicating that the
environment is active.
Once the environment is activated, you can install the packages needed for this lesson. Run the following command to install the necessary dependencies:
BASH
pip install -r https://raw.githubusercontent.com/olgaminaeva/gen-ai-coding/refs/heads/main/learners/files/requirements.txt
When you’re finished with your work, after the end of this lesson,
deactivate the virtual environment by typing deactivate
.
This will return you to your global Python environment.