Chapter 5

Tutorials

Presentation & objectives

This section provides essential tutorials to set up your development environment and master version control for data science projects. These tutorials establish the foundation for professional data science workflows, ensuring you have the proper tools and collaborative skills needed for modern data science development.

Learning Objectives:

  • Configure a modern Python development environment with uv package manager
  • Set up Visual Studio Code with essential extensions for data science
  • Master Git fundamentals and collaborative workflows using GitLab
  • Understand modern Python project standards with pyproject.toml
  • Implement professional development practices and best practices

Prerequisites:

  • Basic command line knowledge
  • Administrator access on your machine

Activities

  1. Environment Setup
  2. Git & GitLab How-to
  3. Git Best Practices

Warning

Setup Requirements

These tutorials involve software downloads and installations. Complete the Environment Setup and Git & GitLab tutorials before your first practical session to ensure you can focus on data science concepts rather than configuration issues.

Time Investment: Allow extra time for initial setup, especially for Windows users requiring WSL2 configuration.

Knowledge Check

Answer these questions once you have finished this tutorial module.

--- primary_color: steelblue secondary_color: lightgray text_color: black shuffle_questions: false shuffle_answers: true --- # What is the main advantage of using uv over traditional Python package managers like pip? 1. [ ] It only works with newer Python versions 2. [x] It provides 10-100x faster dependency resolution and automatic virtual environment management 3. [ ] It requires less disk space 4. [ ] It only works with Jupyter notebooks # Why is pyproject.toml preferred over requirements.txt in modern Python projects? 1. [ ] It's shorter and easier to write 2. [x] It follows PEP standards and provides comprehensive project configuration including dependencies, metadata, and build settings 3. [ ] It automatically installs Python 4. [ ] It's only required for web applications # What is the primary purpose of WSL2 for Windows users in data science development? 1. [ ] It makes Python run faster 2. [ ] It's required for all Python installations 3. [x] It provides a native Linux environment ensuring compatibility with data science tools and deployment environments 4. [ ] It automatically installs all required packages # Why should you register a Jupyter kernel when using uv environments in VS Code? 1. [x] VS Code looks for kernels in system-wide locations, but uv kernels are installed locally in .venv/ directories 2. [ ] It's required by uv for all Python projects 3. [ ] It improves notebook performance significantly 4. [ ] It automatically installs missing packages # What is the main benefit of collaborative Git workflows with branching? 1. [ ] It makes repositories smaller 2. [ ] It eliminates the need for commit messages 3. [x] It enables parallel development, reduces conflicts, and provides controlled integration through code review 4. [ ] It automatically backs up all files # Why do merge conflicts occur in Git collaboration? 1. [ ] Git is not designed for multiple users 2. [x] Two people modify the same lines in the same file simultaneously 3. [ ] The repository is too large 4. [ ] One person doesn't have proper permissions # What is the purpose of a GitLab merge request? 1. [ ] To delete branches automatically 2. [ ] To backup project files 3. [x] To enable code review, discussion, and quality control before integrating changes 4. [ ] To merge all branches at once # Which Git configuration is essential before starting any collaborative work? 1. [ ] Setting up SSH keys only 2. [x] Configuring user.name and user.email with your identity 3. [ ] Installing the latest Git version 4. [ ] Creating a .gitignore file # What should you do if your Git push is rejected with "Updates were rejected"? 1. [ ] Force push to override the remote changes 2. [ ] Delete the repository and start over 3. [x] Pull the remote changes first, resolve any conflicts, then push again 4. [ ] Switch to a different branch immediately # What is the recommended approach for dependency groups in pyproject.toml? 1. [ ] Put all dependencies in the main dependencies list 2. [x] Organize dependencies into logical groups (dev, ml, viz) for different use cases 3. [ ] Use separate pyproject.toml files for each dependency type 4. [ ] Only use optional dependencies # What does the `uv sync` command accomplish? 1. [ ] It synchronizes with remote Git repositories 2. [ ] It updates all Python versions 3. [x] It creates a virtual environment and installs all dependencies specified in pyproject.toml and uv.lock 4. [ ] It syncs files between different computers # Why should data files typically be excluded from Git repositories? 1. [ ] Git cannot handle binary files 2. [x] Data files are often large, may contain sensitive information, and can significantly slow down repository operations 3. [ ] Data files change too frequently 4. [ ] It's only necessary for small projects # Which practice best demonstrates professional Git workflow for data science projects? 1. [ ] Making one large commit at the end of the project 2. [ ] Committing only final results without intermediate steps 3. [x] Making incremental commits after major analysis milestones with descriptive messages 4. [ ] Avoiding branches and working only on main