An intro to Python packages and how to manage them
To complete, you'll need the following installed on your computer
- Code editor of choice, we recommend VSCode or PyCharm
- Python
- GitHub account
- Git set up and logged in locally (see tutorial)
- Optional: conda
-
Fork this repository: Create your own copy of this repository by clicking the "Fork" button in the top right corner of this page. This will create a copy of the repository under your GitHub account that you can modify.
-
Clone the repository: Clone your forked repository to your local computer:
-
Open your terminal:
- Windows: Press Windows key, type "cmd", press Enter
- Mac: Press Cmd + Space, type "terminal", press Enter
-
Navigate to your preferred folder:
cd Documents # Windows cd ~/Documents # Mac
Use
dir(Windows) orls(Mac) to see available folders Usecd FOLDER_NAMEto navigate into a folder Usemkdir FOLDER_NAMEto create a new folder -
Clone the repository (replace
YOUR-USERNAME):git clone https://github.com/YOUR-USERNAME/python-dependency-workshop.git cd python-dependency-workshop
If you get errors, verify that:
- You replaced YOUR-USERNAME with your GitHub username
- Git is installed and you're logged in
- You're in the correct folder
This repo has a series of exercises in the workshop_exercises directory that walk through different ways of creating virtual environments and managing dependencies in Python. They are intended to be completed in order, but you can jump in at the level you feel comfortable.
- Exercise 1: Setting Up a Virtual Environment
- Exercise 2: Managing Dependencies with requirements.txt
- Exercise 3: Pyproject.toml, Editable Mode, and Optional Dependencies
- Exercise 4: Setting Up a Conda Environment with environment.yml
- Exercise 5: Using pyproject.toml with Poetry
- Exercise 6: Using requirements.in
If you feel confident in the exercises, you can move on to the practice_problems directory, which has a series of projects with issues in their dependency management. Try your best to debug them. For each, you can find the answer to what's broken in the answer.txt file.