Skip to content

Commit 530201c

Browse files
authored
Merge pull request #45 from udacity/version-upgrade
feat: upgrade to Python 3.13
2 parents 406493b + f34c97b commit 530201c

13 files changed

Lines changed: 289 additions & 80 deletions

File tree

.github/workflows/manual.yml

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

.gitignore

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
db.sqlite3
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Environments
85+
.env
86+
.venv
87+
env/
88+
venv/
89+
ENV/
90+
env.bak/
91+
venv.bak/
92+
93+
# Spyder project settings
94+
.spyderproject
95+
.spyproject
96+
97+
# Rope project settings
98+
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/
105+
.dmypy.json
106+
dmypy.json
107+
108+
# Pyre type checker
109+
.pyre/
110+
111+
# Machine Learning / Data Science specific
112+
# Models
113+
*.pkl
114+
*.joblib
115+
*.h5
116+
*.hdf5
117+
*.model
118+
*.weights
119+
120+
# Data files (but keep small sample data)
121+
*.csv
122+
!starter/data/census.csv # Keep the census dataset
123+
124+
# Large data directories
125+
data/large/
126+
data/raw/
127+
data/processed/
128+
129+
# Jupyter notebook checkpoints
130+
.ipynb_checkpoints/
131+
132+
# MLflow
133+
mlruns/
134+
mlartifacts/
135+
136+
# DVC
137+
.dvc/cache/
138+
.dvc/tmp/
139+
.dvc/logs/
140+
141+
# Weights & Biases
142+
wandb/
143+
144+
# TensorBoard
145+
runs/
146+
logs/
147+
tensorboard/
148+
149+
# IDE specific files
150+
.vscode/
151+
.idea/
152+
*.swp
153+
*.swo
154+
*~
155+
156+
# OS specific files
157+
.DS_Store
158+
.DS_Store?
159+
._*
160+
.Spotlight-V100
161+
.Trashes
162+
ehthumbs.db
163+
Thumbs.db
164+
165+
# Heroku specific
166+
.env.local
167+
.env.production
168+
169+
# AWS credentials
170+
.aws/
171+
172+
# Temporary files
173+
*.tmp
174+
*.temp
175+
temp/
176+
tmp/
177+
178+
# Screenshots (unless specifically needed)
179+
screenshots/*.png
180+
screenshots/*.jpg
181+
screenshots/*.jpeg
182+
!screenshots/.gitkeep
183+
184+
# API keys and secrets
185+
*.key
186+
*.pem
187+
secrets.json
188+
config.ini

PYTHON_3_13_UPDATES.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Python 3.13 Compatibility Updates
2+
3+
This document summarizes the changes made to make the codebase compatible with Python 3.13.
4+
5+
## Dependencies Updated
6+
- Python: 3.8 → 3.13.0
7+
- NumPy: Latest compatible (1.26.0+)
8+
- Pandas: Latest compatible (2.1.0+)
9+
- scikit-learn: Latest compatible (1.3.0+)
10+
- FastAPI: 0.63.0 → 0.103.0+
11+
- Other dependencies updated to latest stable versions
12+
13+
## Code Changes
14+
1. **ML Data Processing (`ml/data.py`)**
15+
- Updated OneHotEncoder parameters from `sparse=False` to `sparse_output=False` to match newer scikit-learn API
16+
17+
## Notes
18+
- The core ML functionality and boilerplate structure remains unchanged
19+
- Dependencies updated to ensure compatibility with Python 3.13
20+
- Starter code structure maintained for student implementation

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
Working in a command line environment is recommended for ease of use with git and dvc. If on Windows, WSL1 or 2 is recommended.
22

33
# Environment Set up
4-
* Download and install conda if you don’t have it already.
5-
* Use the supplied requirements file to create a new environment, or
6-
* conda create -n [envname] "python=3.8" scikit-learn pandas numpy pytest jupyter jupyterlab fastapi uvicorn -c conda-forge
7-
* Install git either through conda (“conda install git”) or through your CLI, e.g. sudo apt-get git.
4+
* **Option 1: Using pip and venv (Recommended)**
5+
* Ensure you have Python 3.13 installed
6+
* Create virtual environment: `python3.13 -m venv .venv`
7+
* Activate environment: `source .venv/bin/activate` (On Windows: `.venv\Scripts\activate`)
8+
* Install dependencies: `pip install -r starter/requirements.txt`
9+
10+
* **Option 2: Using conda**
11+
* Download and install conda if you don't have it already.
12+
* conda create -n [envname] "python=3.13" scikit-learn pandas numpy pytest jupyter jupyterlab fastapi uvicorn pydantic httpx matplotlib seaborn -c conda-forge
13+
* Install git either through conda ("conda install git") or through your CLI, e.g. sudo apt-get git.
814

915
## Repositories
1016
* Create a directory for the project and initialize git.
1117
* As you work on the code, continually commit changes. Trained models you want to use in production must be committed to GitHub.
1218
* Connect your local git repo to GitHub.
1319
* Setup GitHub Actions on your repo. You can use one of the pre-made GitHub Actions if at a minimum it runs pytest and flake8 on push and requires both to pass without error.
14-
* Make sure you set up the GitHub Action to have the same version of Python as you used in development.
20+
* Make sure you set up the GitHub Action to use Python 3.13 (same version as development).
21+
* Note: Add flake8 to requirements.txt if you want to use it for linting: `pip install flake8`
1522

1623
# Data
1724
* Download census.csv and commit it to dvc.
@@ -40,4 +47,5 @@ Working in a command line environment is recommended for ease of use with git an
4047
* Enable automatic deployments that only deploy if your continuous integration passes.
4148
* Hint: think about how paths will differ in your local environment vs. on Heroku.
4249
* Hint: development in Python is fast! But how fast you can iterate slows down if you rely on your CI/CD to fail before fixing an issue. I like to run flake8 locally before I commit changes.
50+
* Note: Install flake8 separately if needed: `pip install flake8`
4351
* Write a script that uses the requests module to do one POST on your live API.

starter/README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
Working in a command line environment is recommended for ease of use with git and dvc. If on Windows, WSL1 or 2 is recommended.
22

33
# Environment Set up
4-
* Download and install conda if you don’t have it already.
5-
* Use the supplied requirements file to create a new environment, or
6-
* conda create -n [envname] "python=3.8" scikit-learn dvc pandas numpy pytest jupyter jupyterlab fastapi uvicorn -c conda-forge
7-
* Install git either through conda (“conda install git”) or through your CLI, e.g. sudo apt-get git.
4+
* **Option 1: Using pip and venv (Recommended)**
5+
* Ensure you have Python 3.13 installed
6+
* Create virtual environment: `python3.13 -m venv .venv`
7+
* Activate environment: `source .venv/bin/activate` (On Windows: `.venv\Scripts\activate`)
8+
* Install dependencies: `pip install -r requirements.txt`
9+
10+
* **Option 2: Using conda**
11+
* Download and install conda if you don't have it already.
12+
* conda create -n [envname] "python=3.13" scikit-learn dvc pandas numpy pytest jupyter jupyterlab fastapi uvicorn pydantic httpx matplotlib seaborn -c conda-forge
13+
* Install git either through conda ("conda install git") or through your CLI, e.g. sudo apt-get git.
814

915
## Repositories
1016

@@ -32,7 +38,8 @@ To use your new S3 bucket from the AWS CLI you will need to create an IAM user w
3238
## GitHub Actions
3339

3440
* Setup GitHub Actions on your repository. You can use one of the pre-made GitHub Actions if at a minimum it runs pytest and flake8 on push and requires both to pass without error.
35-
* Make sure you set up the GitHub Action to have the same version of Python as you used in development.
41+
* Make sure you set up the GitHub Action to use Python 3.13 (same version as development).
42+
* Note: Add flake8 to requirements.txt if you want to use it for linting: `pip install flake8`
3643
* Add your <a href="https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions" target="_blank">AWS credentials to the Action</a>.
3744
* Set up <a href="https://github.com/iterative/setup-dvc" target="_blank">DVC in the action</a> and specify a command to `dvc pull`.
3845

@@ -70,6 +77,7 @@ To use your new S3 bucket from the AWS CLI you will need to create an IAM user w
7077
* Enable automatic deployments that only deploy if your continuous integration passes.
7178
* Hint: think about how paths will differ in your local environment vs. on Heroku.
7279
* Hint: development in Python is fast! But how fast you can iterate slows down if you rely on your CI/CD to fail before fixing an issue. I like to run flake8 locally before I commit changes.
80+
* Note: Install flake8 separately if needed: `pip install flake8`
7381
* Set up DVC on Heroku using the instructions contained in the starter directory.
7482
* Set up access to AWS on Heroku, if using the CLI: `heroku config:set AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=yyy`
7583
* Write a script that uses the requests module to do one POST on your live API.

starter/data/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

starter/model/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

starter/model/.gitkeep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file ensures the model directory is tracked by git
2+
# Model files (.pkl, .joblib, etc.) will be saved here during training

starter/requirements.txt

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,41 @@
1-
python==3.8
2-
numpy
3-
pandas
4-
scikit-learn
5-
pytest
6-
requests
7-
fastapi==0.63.0
8-
uvicorn
9-
gunicorn
1+
# Exact versions from working .venv for Python 3.13
2+
# Generated from pip freeze - September 2025
3+
4+
# Web framework and server
5+
fastapi==0.117.1
6+
uvicorn[standard]==0.36.0
7+
8+
# Data validation
9+
pydantic==2.11.9
10+
11+
# Testing
12+
pytest==8.4.2
13+
pytest-asyncio==1.2.0
14+
15+
# HTTP clients
16+
httpx==0.28.1
17+
requests==2.32.5
18+
19+
# Data science libraries
20+
pandas==2.3.2
21+
numpy==2.3.3
22+
matplotlib==3.10.6
23+
seaborn==0.13.2
24+
scikit-learn==1.7.2
25+
26+
# Jupyter support
27+
jupyter==1.1.1
28+
ipykernel==6.30.1
29+
nbformat==5.10.4
30+
31+
# ML fairness and visualization
32+
aequitas==0.42.0
33+
altair==4.1.0
34+
35+
# Flask and extensions (for aequitas)
36+
Flask==0.12.2
37+
Flask-Bootstrap==3.3.7.1
38+
39+
# Other utilities
40+
python-multipart==0.0.20
41+
httplib2==0.31.0

starter/screenshots/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)