Skip to content

Commit 4290884

Browse files
committed
WIP: Migrate to ipytestsuite package
1 parent 926a17e commit 4290884

6 files changed

Lines changed: 65 additions & 22 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ RUN mamba env update -n base -f /tmp/environment.yml && \
3232
echo "Installing CUDA-enabled PyTorch" && \
3333
pip install --no-cache-dir --force-reinstall torch torchvision; \
3434
fi && \
35+
# Install ipytestsuite from TestPyPI (temporary, will use PyPI once published)
36+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "ipytestsuite[ai]" && \
3537
# Clean up all package caches to reduce image size
3638
mamba clean --all -f -y && \
3739
# Remove pip cache

binder/environment.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- conda-forge
55
- pytorch
66
dependencies:
7-
- python=3.10
7+
- python=3.12
88
- pip
99
- pip:
1010
- numpy
@@ -22,10 +22,6 @@ dependencies:
2222
- scikit-learn
2323
- attrs
2424
- multiprocess
25-
- openai
26-
- tenacity
27-
- markdown2
28-
- python-dotenv
2925
- pillow
3026
- opencv-python
3127
- torch

binder/postBuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ set -ex
33

44
mkdir -p ${HOME}/.ipython/profile_default
55
cp binder/ipython_config.py ${HOME}/.ipython/profile_default/
6+
7+
# Install ipytestsuite from TestPyPI (temporary, will use PyPI once published)
8+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "ipytestsuite[ai]"

docker/environment.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: base
33
channels:
44
- conda-forge
55
dependencies:
6+
- python=3.12
67
- pip
78
- pip:
89
- numpy
@@ -20,10 +21,6 @@ dependencies:
2021
- scikit-learn
2122
- attrs
2223
- multiprocess
23-
- openai
24-
- tenacity
25-
- markdown2
26-
- python-dotenv
2724
- pillow
2825
- opencv-python
2926
- albumentations

magic_example.ipynb

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,64 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"metadata": {
77
"tags": []
88
},
9-
"outputs": [],
9+
"outputs": [
10+
{
11+
"data": {
12+
"text/html": [
13+
"<div style='background-color: #d9ead3; border-radius: 5px; padding: 10px;'>✅ <strong>OpenAI client configured successfully.</strong></div>"
14+
],
15+
"text/plain": [
16+
"<IPython.core.display.HTML object>"
17+
]
18+
},
19+
"metadata": {},
20+
"output_type": "display_data"
21+
},
22+
{
23+
"data": {
24+
"text/html": [
25+
"<div style='background-color: #fffde7; border-radius: 5px; padding: 10px;'>🔄 <strong>IPytest extension (re)loaded</strong> (with AI support).</div>"
26+
],
27+
"text/plain": [
28+
"<IPython.core.display.HTML object>"
29+
]
30+
},
31+
"metadata": {},
32+
"output_type": "display_data"
33+
}
34+
],
1035
"source": [
11-
"%reload_ext tutorial.tests.testsuite"
36+
"%reload_ext ipytestsuite"
1237
]
1338
},
1439
{
1540
"cell_type": "code",
16-
"execution_count": null,
41+
"execution_count": 3,
1742
"metadata": {
1843
"tags": []
1944
},
20-
"outputs": [],
45+
"outputs": [
46+
{
47+
"data": {
48+
"application/vnd.jupyter.widget-view+json": {
49+
"model_id": "36143cb14d384b5598bab2994c67954e",
50+
"version_major": 2,
51+
"version_minor": 0
52+
},
53+
"text/plain": [
54+
"VBox(children=(Output(outputs=({'output_type': 'display_data', 'data': {'text/plain': 'HTML(value=\\'<div style…"
55+
]
56+
},
57+
"metadata": {},
58+
"output_type": "display_data"
59+
}
60+
],
2161
"source": [
22-
"%%ipytest\n",
62+
"%%ipytest --path tutorial/tests\n",
2363
"# or %%ipytest test_module_name\n",
2464
"\n",
2565
"def solution_power2(x: int) -> int:\n",
@@ -89,7 +129,7 @@
89129
"name": "python",
90130
"nbconvert_exporter": "python",
91131
"pygments_lexer": "ipython3",
92-
"version": "3.10.10"
132+
"version": "3.12.11"
93133
},
94134
"vscode": {
95135
"interpreter": {

pyproject.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "python-tutorial"
33
version = "v2025.05"
44
description = "Jupyter-based Python programming tutorial"
5-
requires-python = ">=3.10"
5+
requires-python = ">=3.12"
66

77
[project.optional-dependencies]
88
dev = [
@@ -21,16 +21,13 @@ dev = [
2121
"scikit-learn",
2222
"attrs",
2323
"multiprocess",
24-
"openai",
25-
"tenacity",
26-
"markdown2",
27-
"python-dotenv",
2824
"pillow",
2925
"opencv-python",
3026
"albumentations",
3127
"grad-cam",
3228
"plotly",
33-
"torch==2.7.0", # pinned to last stable version as of 2025-05-14
29+
"torch>=2.0.0", # PyTorch 2.x series
30+
"ipytestsuite[ai]>=0.1.0",
3431
]
3532

3633
# pytest
@@ -93,3 +90,11 @@ indent-style = "space"
9390
# Setuptools: suppress package discovery
9491
[tool.setuptools]
9592
packages = []
93+
94+
[[tool.uv.index]]
95+
name = "testpypi"
96+
url = "https://test.pypi.org/simple/"
97+
explicit = true
98+
99+
[tool.uv.sources]
100+
ipytestsuite = { index = "testpypi" }

0 commit comments

Comments
 (0)