Welcome to the Coding Standards Training Repository for Data Scientists! This repository contains demos, tasks, and reference materials to help you write cleaner, more maintainable Python code.
Before starting, please complete the setup instructions in SETUP.md.
coding-standards-training/
βββ demos/ # Demonstration materials (follow along)
β βββ 01-code-style/ # Code formatting, linting, type checking
β βββ 02-testing/ # Unit testing with pytest
β βββ 03-collaboration/ # Pre-commit hooks, CI/CD, static analysis
β βββ 04-documentation/ # Docstrings and Sphinx documentation
β βββ 05-tools-config/ # VSCode setup and Databricks integration
β βββ 06-project-setup/ # Project templates and DevContainers
βββ tasks/ # Hands-on exercises
β βββ 01-code-style/ # Refactor poorly formatted code
β βββ 02-testing/ # Write unit tests for a function
β βββ 05-tools-config/ # Set up Databricks connection
β βββ 06-project-setup/ # Use Cookiecutter and DevContainers
βββ .vscode/ # VSCode workspace settings
βββ pyproject.toml # Python project configuration
βββ requirements.txt # Python dependencies
βββ .pre-commit-config.yaml # Pre-commit hooks configuration
βββ SETUP.md # Setup instructions
Learn how to format Python code according to PEP8 using Ruff, and how to use type hints with mypy.
- Demo: demos/01-code-style/
- Task: tasks/01-code-style/
Learn how to write and execute unit tests using pytest, and how to measure code coverage.
- Demo: demos/02-testing/
- Task: tasks/02-testing/
Learn how to set up pre-commit hooks for consistency checks, CI pipelines, and static code analysis.
- Demo: demos/03-collaboration/
Learn how to write clear docstrings and generate documentation using Sphinx.
- Demo: demos/04-documentation/
Learn how to configure VSCode for Python development and connect to Databricks.
- Demo: demos/05-tools-config/
- Task: tasks/05-tools-config/
Learn about project structure, Cookiecutter templates, and DevContainers.
- Demo: demos/06-project-setup/
- Task: tasks/06-project-setup/
- Complete the SETUP.md instructions
- Install the recommended VSCode extensions (you'll be prompted when opening the repo)
- Create a virtual environment and install dependencies:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r requirements.txt
- Follow along with the demos in order, then complete the corresponding tasks
| Tool | Purpose |
|---|---|
| Ruff | Linting and formatting (replaces flake8, black, isort) |
| mypy | Static type checking |
| pytest | Testing framework |
| pytest-cov | Code coverage |
| pre-commit | Git hooks for code quality |
| Sphinx | Documentation generator |
| Cookiecutter | Project templates |
If you encounter any issues during the training, please ask your instructor for assistance.