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
52 changes: 0 additions & 52 deletions .circleci/config.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: ci

on:
push:
branches: [master, main]
pull_request:

jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- run: uv sync --frozen
- name: ruff format
run: uv run ruff format --check .
- name: ruff lint
run: uv run ruff check .
- name: ty type-check
run: uv run ty check funclib tests
- name: tests + coverage
run: |
uv run coverage run -m pytest
uv run coverage report
- name: pmat comply
run: |
curl -fsSL https://raw.githubusercontent.com/paiml/pmat/master/install.sh | sh || true
pmat comply check
continue-on-error: true
- name: banned tools grep
# Catches reintroduction of banned toolchains in *executable*
# locations only — Makefile, pyproject.toml, scripts/. Prose
# mentions in docs/README are allowed (they document the ban).
run: |
! grep -nE '\b(pip install|pylint|poetry run|pipenv)\b' \
Makefile pyproject.toml scripts/*.py
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,14 @@ ENV/

# mypy
.mypy_cache/

# Rust
rust/target/
rust/**/target/
Cargo.lock

# uv
.venv/
rust/notebooks/
.pmat/context.db*
.pmat/context.idx
4 changes: 4 additions & 0 deletions .pmat/project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pmat]
version = "3.17.0"
last_compliance_check = "2026-05-23T09:52:42.842944241Z"
auto_update = false
69 changes: 54 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,70 @@
setup:
#You may want to create an alias to automatically source this:
# alias functop="cd ~/src/functional_intro_to_python && source ~/.func/bin/activate"
python3 -m venv ~/.func
.PHONY: install fmt fmt-check lint type test cover comply notebooks \
rust depyler snippets snippets-extract snippets-rust \
run-part-1 run-part-2 \
run-part-3 run-part-4 run-part-5 clean all

install:
pip install -r requirements.txt
uv sync

test:
#PYTHONPATH=. && pytest -vv --cov=paws --cov=spot-price-ml tests/*.py
PYTHONPATH=. && py.test --nbval-lax notebooks/*.ipynb
fmt:
uv run ruff format .

fmt-check:
uv run ruff format --check .

lint:
pylint --disable=R,C funclib
uv run ruff check .

type:
uv run ty check funclib tests

test:
uv run coverage run -m pytest

cover: test
uv run coverage report

comply:
pmat comply check

rust:
cargo fmt --manifest-path rust/Cargo.toml --all -- --check
cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
cargo test --manifest-path rust/Cargo.toml -p funclib

depyler:
depyler transpile funclib/funcmod.py -o rust/funclib/src/funcmod.depyler.rs

snippets-extract:
uv run python scripts/extract_snippets.py
uv run ruff format notebooks/_snippets

snippets:
uv run ruff format --check notebooks/_snippets
uv run ruff check notebooks/_snippets

snippets-rust:
uv run python scripts/transpile_snippets.py

notebooks:
uv run pytest --nbval-lax notebooks/*.ipynb

run-part-1:
jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_1\(Introductory_Concepts\).ipynb --to slides --post serve
uv run jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_1\(Introductory_Concepts\).ipynb --to slides --post serve

run-part-2:
jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_2\(Functions\).ipynb --to slides --post serve
uv run jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_2\(Functions\).ipynb --to slides --post serve

run-part-3:
jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_3\(Control_Structures\).ipynb --to slides --post serve
uv run jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_3\(Control_Structures\).ipynb --to slides --post serve

run-part-4:
jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_4\(Intermediate_Topics\).ipynb --to slides --post serve
uv run jupyter nbconvert notebooks/Functional_Introduction_To_Python_Section_4\(Intermediate_Topics\).ipynb --to slides --post serve

run-part-5:
jupyter nbconvert notebooks/IO\ Python.ipynb --to slides --post serve
uv run jupyter nbconvert notebooks/IO\ Python.ipynb --to slides --post serve

clean:
rm -rf .coverage .pytest_cache .ruff_cache

all: install lint test
all: install fmt-check lint type cover rust snippets
74 changes: 62 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,68 @@
## 🎓 Pragmatic AI Labs | Join 1M+ ML Engineers
# 🎓 Pragmatic AI Labs | Functional Intro to Python (& Rust)

### 🔥 Hot Course Offers:
* 🤖 [Master GenAI Engineering](https://ds500.paiml.com/learn/course/0bbb5/) - Build Production AI Systems
* 🦀 [Learn Professional Rust](https://ds500.paiml.com/learn/course/g6u1k/) - Industry-Grade Development
* 📊 [AWS AI & Analytics](https://ds500.paiml.com/learn/course/31si1/) - Scale Your ML in Cloud
* ⚡ [Production GenAI on AWS](https://ds500.paiml.com/learn/course/ehks1/) - Deploy at Enterprise Scale
* 🛠️ [Rust DevOps Mastery](https://ds500.paiml.com/learn/course/ex8eu/) - Automate Everything
[![uv](https://img.shields.io/badge/packaging-uv-DE5FE9)](https://github.com/astral-sh/uv)
[![ruff](https://img.shields.io/badge/lint-ruff-261230)](https://github.com/astral-sh/ruff)
[![ty](https://img.shields.io/badge/types-ty-3776AB)](https://github.com/astral-sh/ty)
[![pmat comply](https://img.shields.io/badge/pmat-comply-2E8B57)](https://paiml.com)
[![coverage 100%](https://img.shields.io/badge/coverage-100%25-brightgreen)](#quality-gates)
[![depyler](https://img.shields.io/badge/Py%E2%86%92Rust-depyler-orange)](https://crates.io/crates/depyler)

### 🚀 Level Up Your Career:
* 💼 [Production ML Program](https://paiml.com) - Complete MLOps & Cloud Mastery
* 🎯 [Start Learning Now](https://ds500.paiml.com) - Fast-Track Your ML Career
* 🏢 Trusted by Fortune 500 Teams
> Modernized: `uv` + `ruff` + `ty` only · 100% branch coverage · `icontract`
> + `hypothesis` provable contracts · every example transpilable to Rust via
> `depyler` and held to `clippy -D warnings` + `proptest` parity.
> See [`docs/specifications/upgrade-spec.md`](docs/specifications/upgrade-spec.md).

Learn end-to-end ML engineering from industry veterans at [PAIML.COM](https://paiml.com)
---

## 🚀 Pragmatic AI Labs — Full Course Catalog

If this tutorial helps you, please ⭐ the repo and check out the courses
that fund this work:

### 🔥 Featured Courses on [DS500](https://ds500.paiml.com)
* 🤖 [Master GenAI Engineering](https://ds500.paiml.com/learn/course/0bbb5/) — Build Production AI Systems
* 🦀 [Learn Professional Rust](https://ds500.paiml.com/learn/course/g6u1k/) — Industry-Grade Development
* 📊 [AWS AI & Analytics](https://ds500.paiml.com/learn/course/31si1/) — Scale Your ML in Cloud
* ⚡ [Production GenAI on AWS](https://ds500.paiml.com/learn/course/ehks1/) — Deploy at Enterprise Scale
* 🛠️ [Rust DevOps Mastery](https://ds500.paiml.com/learn/course/ex8eu/) — Automate Everything

### 🎓 Coursera + Duke — Building Cloud Computing Solutions at Scale (4-course specialization)
* [Take the Specialization](https://www.coursera.org/learn/cloud-computing-foundations-duke?specialization=building-cloud-computing-solutions-at-scale)
* [Cloud Computing Foundations](https://www.coursera.org/learn/cloud-computing-foundations-duke?specialization=building-cloud-computing-solutions-at-scale)
* [Cloud Virtualization, Containers & APIs](https://www.coursera.org/learn/cloud-virtualization-containers-api-duke?specialization=building-cloud-computing-solutions-at-scale)
* [Cloud Data Engineering](https://www.coursera.org/learn/cloud-data-engineering-duke?specialization=building-cloud-computing-solutions-at-scale)
* [Cloud Machine Learning Engineering & MLOps](https://www.coursera.org/learn/cloud-machine-learning-engineering-mlops-duke?specialization=building-cloud-computing-solutions-at-scale)

### 💼 Programs & Hub
* [Production ML Program](https://paiml.com) — Complete MLOps & Cloud Mastery
* [Start Learning Now on DS500](https://ds500.paiml.com) — Fast-Track Your ML Career
* [Pragmatic AI Labs Hub](https://paiml.com) — Trusted by Fortune 500 Teams
* 📰 [Newsletter](https://newsletter.paiml.com/social) · 📺 [YouTube](https://www.youtube.com/channel/UCNDfiL0D1LUeKWAkRE1xO5Q) · ✍️ [Medium](https://medium.com/pragmatic-ai-labs)

Learn end-to-end ML engineering from industry veterans at [PAIML.COM](https://paiml.com).

---

<a id="quality-gates"></a>
## 🔒 Quality Gates (this repo)

Single source of truth for the toolchain. **No `pip`, no `pylint`, no
`black`, no `mypy`, no `poetry`** — enforced by CI grep.

| Concern | Tool | Make target |
|----------------|-----------------------|-------------|
| Env + deps | `uv` | `make install` |
| Lint + format | `ruff` | `make lint`, `make fmt-check` |
| Type check | `ty` | `make type` |
| Tests + cov | `pytest` + `coverage` | `make cover` (100% required) |
| Contracts | `icontract` + `hypothesis` | runs via `make cover` |
| Compliance | `pmat comply` | `make comply` |
| Py → Rust | `depyler` | `make depyler` |
| Rust gate | `cargo fmt` + `clippy -D warnings` + `proptest` | `make rust` |

Run everything: `make all`.

---

# Functional, Data Science Intro To Python
The first section is an intentionally brief, functional, data science centric introduction to Python. The assumption is a someone with zero experience in programming can follow this tutorial and learn Python with the smallest amount of information possible.
Expand Down
Loading
Loading