MC202602: Python Meeting 09: Contract review
Python Meeting Replay
Python Meeting PDF
Set-up Python project
There are three options for setting up the python project:
- Option 1: Download files manually. Manually set-up the folders (see screenshots below) and put the files in each relevant folder, as per the below instructions
- Option 2: Download the zip file from the GitHub link below and unzip on your computer.
- Option 3: Synchronize the project from GitHub. Use the GitHub repository link to clone the GitHub project directly to your computer.
Option 1: Download files manually
1.1: Create folders
Create a project folder on your PC, as shown below but replacing the XX with the number of the Python meeting. This project folder will be the root folder. Within the root folder, create the folders 01_SOURCES, 02_PROGRAMMES and 03_RESULTS. Use these exact same names. Make sure that these folders are all in the same project root folder. Do not mix folders from different python sessions together.
Folders to create in your project root:

Folder to create inside 02_PROGRAMMES:

1.2: Files to put inside the 01_SOURCES folder
During the live session we will use the following source files. These files should go in the folder 01_SOURCES.
1.3: Files to put inside the 02_PROGRAMMES folder -> python files: change extension to .py
During the python session, we will run the following program. You will need to change the extension of the python program to .py.
1.4 File to put inside the 02_PROGRAMMES folder -> requirements.txt
The requirements.txt file holds the list of python libraries and their versions for all of the python libraries that are used by the project. Please note that the subprocess library for automatically running requirements can only work with Python 3.12, therefore, you need to import Python 3.12… see the README.md. Also, we will use kaggle in this project and Kaggle is on 3.12.
1.5: File to put inside the 02_PROGRAMMES folder -> pyproject.toml
The pyproject.toml is not actually used technically. However, it is good practice to use this file to remember the python version that goes with the library versions that we put in requirements.txt
1.6: File to put inside the 02_PROGRAMMES folder -> .env — change extension from .env.example to .env
An .env file is normally a secret file that you do not share with anyone. The .env file is where you will put your secret keys for logging into HuggingFace. You can create a .env file inside Visual Studio Code. The .env file does not have a name, only the extension .env. For this project, the .env should be set to contain your HuggingFace secret key – see PDF for instructions on how to create the secret key.
1.7: File(s) to put inside the Z_SHARED_FUNCTIONS folder
The following are python programmes. You should create a Z_SHARED_FUNCTIONS folder in your 02_PROGRAMMES folder and store these files in Z_SHARED_FUNCTIONS. You should change the extension to .py: Note: the export script here may not be the same as previous Python meetings. Therefore, please use this version.
1.8: File(s) to put inside the 03_RESULTS folder
When you run the python program, it will generate a results file and export it as an Excel file. You can see the example of what you would expect to obtain here if you run test version on your laptop. For the real results, run without test mode in Kaggle. You can put this file in your 03_RESULTS folder.
Program (change extension to .py)
During the python session, we will run the following program in Kaggle. We will run it in Kaggle because the Gemini model that we will use is quite heavy to run on a normal laptop.
Option 2: Download zip file from GitHub
You can go to the link: https://github.com/300Academy/PYTHON_MEETING_09.git, click on the button Code and choose “Download ZIP”.

Option 3: Clone the project from GitHub
If you would like to get the project from github, clone from the following link – based on the instructions below: https://github.com/300Academy/PYTHON_MEETING_09.git
GitHub instructions: updated to include new token access requirement (set 10 and 11)
Responses