Skip to content

Commit fbbe3a5

Browse files
authored
Merge pull request #18 from noahgift/feat/upgrade-uv-ruff-ty-depyler
feat: upgrade to uv/ruff/ty + depyler Rust parity
2 parents 4f841a3 + ace37c3 commit fbbe3a5

113 files changed

Lines changed: 3682 additions & 107 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
8+
jobs:
9+
python:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: astral-sh/setup-uv@v3
14+
with:
15+
enable-cache: true
16+
- run: uv sync --frozen
17+
- name: ruff format
18+
run: uv run ruff format --check .
19+
- name: ruff lint
20+
run: uv run ruff check .
21+
- name: ty type-check
22+
run: uv run ty check funclib tests
23+
- name: tests + coverage
24+
run: |
25+
uv run coverage run -m pytest
26+
uv run coverage report
27+
- name: pmat comply
28+
run: |
29+
curl -fsSL https://raw.githubusercontent.com/paiml/pmat/master/install.sh | sh || true
30+
pmat comply check
31+
continue-on-error: true
32+
- name: banned tools grep
33+
# Catches reintroduction of banned toolchains in *executable*
34+
# locations only — Makefile, pyproject.toml, scripts/. Prose
35+
# mentions in docs/README are allowed (they document the ban).
36+
run: |
37+
! grep -nE '\b(pip install|pylint|poetry run|pipenv)\b' \
38+
Makefile pyproject.toml scripts/*.py

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,14 @@ ENV/
103103

104104
# mypy
105105
.mypy_cache/
106+
107+
# Rust
108+
rust/target/
109+
rust/**/target/
110+
Cargo.lock
111+
112+
# uv
113+
.venv/
114+
rust/notebooks/
115+
.pmat/context.db*
116+
.pmat/context.idx

.pmat/project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pmat]
2+
version = "3.17.0"
3+
last_compliance_check = "2026-05-23T09:52:42.842944241Z"
4+
auto_update = false

Makefile

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,70 @@
1-
setup:
2-
#You may want to create an alias to automatically source this:
3-
# alias functop="cd ~/src/functional_intro_to_python && source ~/.func/bin/activate"
4-
python3 -m venv ~/.func
1+
.PHONY: install fmt fmt-check lint type test cover comply notebooks \
2+
rust depyler snippets snippets-extract snippets-rust \
3+
run-part-1 run-part-2 \
4+
run-part-3 run-part-4 run-part-5 clean all
55

66
install:
7-
pip install -r requirements.txt
7+
uv sync
88

9-
test:
10-
#PYTHONPATH=. && pytest -vv --cov=paws --cov=spot-price-ml tests/*.py
11-
PYTHONPATH=. && py.test --nbval-lax notebooks/*.ipynb
9+
fmt:
10+
uv run ruff format .
11+
12+
fmt-check:
13+
uv run ruff format --check .
1214

1315
lint:
14-
pylint --disable=R,C funclib
16+
uv run ruff check .
17+
18+
type:
19+
uv run ty check funclib tests
20+
21+
test:
22+
uv run coverage run -m pytest
23+
24+
cover: test
25+
uv run coverage report
26+
27+
comply:
28+
pmat comply check
29+
30+
rust:
31+
cargo fmt --manifest-path rust/Cargo.toml --all -- --check
32+
cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
33+
cargo test --manifest-path rust/Cargo.toml -p funclib
34+
35+
depyler:
36+
depyler transpile funclib/funcmod.py -o rust/funclib/src/funcmod.depyler.rs
37+
38+
snippets-extract:
39+
uv run python scripts/extract_snippets.py
40+
uv run ruff format notebooks/_snippets
41+
42+
snippets:
43+
uv run ruff format --check notebooks/_snippets
44+
uv run ruff check notebooks/_snippets
45+
46+
snippets-rust:
47+
uv run python scripts/transpile_snippets.py
48+
49+
notebooks:
50+
uv run pytest --nbval-lax notebooks/*.ipynb
1551

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

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

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

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

2864
run-part-5:
29-
jupyter nbconvert notebooks/IO\ Python.ipynb --to slides --post serve
65+
uv run jupyter nbconvert notebooks/IO\ Python.ipynb --to slides --post serve
66+
67+
clean:
68+
rm -rf .coverage .pytest_cache .ruff_cache
3069

31-
all: install lint test
70+
all: install fmt-check lint type cover rust snippets

README.md

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,68 @@
1-
## 🎓 Pragmatic AI Labs | Join 1M+ ML Engineers
1+
# 🎓 Pragmatic AI Labs | Functional Intro to Python (& Rust)
22

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

10-
### 🚀 Level Up Your Career:
11-
* 💼 [Production ML Program](https://paiml.com) - Complete MLOps & Cloud Mastery
12-
* 🎯 [Start Learning Now](https://ds500.paiml.com) - Fast-Track Your ML Career
13-
* 🏢 Trusted by Fortune 500 Teams
10+
> Modernized: `uv` + `ruff` + `ty` only · 100% branch coverage · `icontract`
11+
> + `hypothesis` provable contracts · every example transpilable to Rust via
12+
> `depyler` and held to `clippy -D warnings` + `proptest` parity.
13+
> See [`docs/specifications/upgrade-spec.md`](docs/specifications/upgrade-spec.md).
1414
15-
Learn end-to-end ML engineering from industry veterans at [PAIML.COM](https://paiml.com)
15+
---
16+
17+
## 🚀 Pragmatic AI Labs — Full Course Catalog
18+
19+
If this tutorial helps you, please ⭐ the repo and check out the courses
20+
that fund this work:
21+
22+
### 🔥 Featured Courses on [DS500](https://ds500.paiml.com)
23+
* 🤖 [Master GenAI Engineering](https://ds500.paiml.com/learn/course/0bbb5/) — Build Production AI Systems
24+
* 🦀 [Learn Professional Rust](https://ds500.paiml.com/learn/course/g6u1k/) — Industry-Grade Development
25+
* 📊 [AWS AI & Analytics](https://ds500.paiml.com/learn/course/31si1/) — Scale Your ML in Cloud
26+
*[Production GenAI on AWS](https://ds500.paiml.com/learn/course/ehks1/) — Deploy at Enterprise Scale
27+
* 🛠️ [Rust DevOps Mastery](https://ds500.paiml.com/learn/course/ex8eu/) — Automate Everything
28+
29+
### 🎓 Coursera + Duke — Building Cloud Computing Solutions at Scale (4-course specialization)
30+
* [Take the Specialization](https://www.coursera.org/learn/cloud-computing-foundations-duke?specialization=building-cloud-computing-solutions-at-scale)
31+
* [Cloud Computing Foundations](https://www.coursera.org/learn/cloud-computing-foundations-duke?specialization=building-cloud-computing-solutions-at-scale)
32+
* [Cloud Virtualization, Containers & APIs](https://www.coursera.org/learn/cloud-virtualization-containers-api-duke?specialization=building-cloud-computing-solutions-at-scale)
33+
* [Cloud Data Engineering](https://www.coursera.org/learn/cloud-data-engineering-duke?specialization=building-cloud-computing-solutions-at-scale)
34+
* [Cloud Machine Learning Engineering & MLOps](https://www.coursera.org/learn/cloud-machine-learning-engineering-mlops-duke?specialization=building-cloud-computing-solutions-at-scale)
35+
36+
### 💼 Programs & Hub
37+
* [Production ML Program](https://paiml.com) — Complete MLOps & Cloud Mastery
38+
* [Start Learning Now on DS500](https://ds500.paiml.com) — Fast-Track Your ML Career
39+
* [Pragmatic AI Labs Hub](https://paiml.com) — Trusted by Fortune 500 Teams
40+
* 📰 [Newsletter](https://newsletter.paiml.com/social) · 📺 [YouTube](https://www.youtube.com/channel/UCNDfiL0D1LUeKWAkRE1xO5Q) · ✍️ [Medium](https://medium.com/pragmatic-ai-labs)
41+
42+
Learn end-to-end ML engineering from industry veterans at [PAIML.COM](https://paiml.com).
43+
44+
---
45+
46+
<a id="quality-gates"></a>
47+
## 🔒 Quality Gates (this repo)
48+
49+
Single source of truth for the toolchain. **No `pip`, no `pylint`, no
50+
`black`, no `mypy`, no `poetry`** — enforced by CI grep.
51+
52+
| Concern | Tool | Make target |
53+
|----------------|-----------------------|-------------|
54+
| Env + deps | `uv` | `make install` |
55+
| Lint + format | `ruff` | `make lint`, `make fmt-check` |
56+
| Type check | `ty` | `make type` |
57+
| Tests + cov | `pytest` + `coverage` | `make cover` (100% required) |
58+
| Contracts | `icontract` + `hypothesis` | runs via `make cover` |
59+
| Compliance | `pmat comply` | `make comply` |
60+
| Py → Rust | `depyler` | `make depyler` |
61+
| Rust gate | `cargo fmt` + `clippy -D warnings` + `proptest` | `make rust` |
62+
63+
Run everything: `make all`.
64+
65+
---
1666

1767
# Functional, Data Science Intro To Python
1868
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.

0 commit comments

Comments
 (0)