Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ parts:
- file: short_courses/r_environments
- file: short_courses/r_functions
- file: short_courses/r_unit_testing
- file: short_courses/best_practices
sections:
- file: short_courses/data_science_best_practices
- caption: Join Us!
chapters:
- file: contributing/community
Expand Down
13 changes: 13 additions & 0 deletions short_courses/best_practices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Best Practices

This section contains our short, focused Best Practices courses designed to help you quickly develop specific skills without committing to a full workshop series.

## Included modules
- **Data Science Best Practices** – Learn how to set up and manage Python environments for reproducible workflows. [Clickable Link to Self Study Notes](data_science_best_practices.md)


## Who is this for?
Learners who want to quickly enhance their skills in targeted areas, or refresh their knowledge on specific topics.

## How to use these notes
Work through the materials in sequence or jump directly to the topic you need. Each module is self-contained and can be completed independently.
536 changes: 536 additions & 0 deletions short_courses/data_science_best_practices.md

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions short_courses/files/example_pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[tool.poetry]
name = "{project-name}"
version = "1.0.0"
description = "A brief description of your project."
authors = ["Your Name <[email protected]>"]
license = "MIT"
readme = "README.md"
packages = [
{ include = "{project-name}", from = "src" }
]

# Main project dependencies
[tool.poetry.dependencies]
python = "^3.8"
# Example dependencies (add your specific requirements)
numpy = "^1.21"
pandas = "^1.3"

# Development dependencies
[tool.poetry.dev-dependencies]
pytest = "^6.2" # for testing
jupyter = "^1.0.0" # for running notebooks in the examples folder

# Scripts can also be specified here if necessary
# Defining a script
[tool.poetry.scripts]
example-script = "scripts.example_module:main_function"
# can be run with: poetry run example-script


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
19 changes: 19 additions & 0 deletions short_courses/files/example_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"python.pythonPath": ".venv/bin/python", // Ensure VSCode uses Poetry's virtual environment
"python.linting.enabled": true, // Enable linting
"python.linting.ruffEnabled": true, // Enable Ruff as the linter
"python.linting.ruffPath": ".venv/bin/ruff", // Point to Ruff inside Poetry's virtual environment
"python.formatting.provider": "black", // Use black for auto-formatting
"python.formatting.blackPath": ".venv/bin/black", // Ensure black from Poetry's virtual environment is used
"python.testing.pytestEnabled": true, // Enable pytest for testing
"python.testing.pytestArgs": [
"tests" // Specify the test folder for pytest
],
"files.exclude": {
"**/.venv": true, // Exclude .venv folder from the file explorer
"**/__pycache__": true // Exclude __pycache__ from the file explorer
},
"editor.formatOnSave": true, // Automatically format on save
"editor.defaultFormatter": "ms-python.black", // Set black as the default formatter
"python.testing.autoTestDiscoverOnSaveEnabled": true // Automatically discover tests on file save
}
33 changes: 33 additions & 0 deletions short_courses/files/example_test_advanced.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# tests/test_advanced.py

import pytest

class ExampleTestClass:
# Class-level setup and teardown (executed once for the entire class)
@classmethod
def setup_class(cls):
print("\nClass-level setup")
cls.class_resource = "Class resource setup"

@classmethod
def teardown_class(cls):
print("\nClass-level teardown")
cls.class_resource = None

# Object-level setup and teardown (executed before each test method)
def setup_method(self):
print("\nObject-level setup")
self.test_resource = "Test resource setup"

def teardown_method(self):
print("\nObject-level teardown")
self.test_resource = None

def test_addition(self):
assert 1 + 1 == 2
print(f"Using {self.test_resource}")

def test_subtraction(self):
assert 2 - 1 == 1
print(f"Using {self.test_resource}")

7 changes: 7 additions & 0 deletions short_courses/files/example_test_simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# tests/test_simple.py

def test_addition():
assert 1 + 1 == 2

def test_subtraction():
assert 2 - 1 == 1
Loading