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.