Skip to content

Commit 0e2182c

Browse files
committed
Use UV instead of poetry
1 parent 56314b8 commit 0e2182c

20 files changed

+1218
-2255
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@
1818
"uses": "actions/checkout@v4"
1919
},
2020
{
21-
"name": "Set up Python",
22-
"uses": "actions/setup-python@v4",
21+
"name": "Install uv",
22+
"uses": "astral-sh/setup-uv@v5",
2323
"with": {
24-
"python-version": "3.12"
24+
"version": "0.6.0"
2525
}
2626
},
2727
{
2828
"name": "Install dependencies",
29-
"run": "python -m pip install --upgrade pip\npip install -r requirements-dev.txt\npip install -e ."
29+
"run": "uv sync --dev"
3030
},
3131
{
3232
"name": "Tests",
33-
"run": "pytest"
33+
"run": "uv run --group dev pytest"
3434
},
3535
{
3636
"name": "Integration tests",
37-
"run": "pytest --nbval-lax --nbval-current-env Example.ipynb tests/Test*.ipynb"
37+
"run": "uv run --group dev --nbval-lax --nbval-current-env Example.ipynb tests/Test*.ipynb"
3838
},
3939
{
4040
"name": "Build package",
41-
"run": "python -m build"
41+
"run": "uv build"
4242
},
4343
{
4444
"name": "Publish package distributions to PyPI",

.github/workflows/test.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,37 @@
1212
"uses": "actions/checkout@v4"
1313
},
1414
{
15-
"name": "Set up Python",
16-
"uses": "actions/setup-python@v4",
15+
"name": "Install uv",
16+
"uses": "astral-sh/setup-uv@v5",
1717
"with": {
18-
"python-version": "3.12"
18+
"version": "0.6.0"
1919
}
2020
},
2121
{
2222
"name": "Install dependencies",
23-
"run": "python -m pip install --upgrade pip\npip install -r requirements-dev.txt\npip install -e ."
23+
"run": "uv sync --group dev"
2424
},
2525
{
2626
"name": "Check format",
27-
"run": "python -m ruff format --check ."
27+
"run": "uv run --group dev ruff format --check ."
2828
},
2929
{
3030
"name": "Check lints",
31-
"run": "python -m ruff check ."
31+
"run": "uv run --group dev ruff check ."
3232
},
3333
{
3434
"name": "Tests",
35-
"run": "python -m pytest"
35+
"run": "uv run --group dev pytest"
3636
},
3737
{
3838
"name": "Integration tests",
39-
"run": "python -m pytest --nbval-lax --nbval-current-env Example.ipynb tests/Test*.ipynb"
40-
}
39+
"run": "uv run --group dev pytest --nbval-lax --nbval-current-env Example.ipynb tests/Test*.ipynb"
40+
},
41+
{
42+
"name": "Build package",
43+
"run": "uv build"
44+
},
4145
]
4246
}
4347
}
44-
}
48+
}

Example.ipynb

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,16 @@
8585
"\n",
8686
"# define the tests\n",
8787
"\n",
88+
"\n",
8889
"def test_my_func():\n",
8990
" assert my_func(0) == 0\n",
9091
" assert my_func(1) == 0\n",
9192
" assert my_func(2) == 2\n",
9293
" assert my_func(3) == 2\n",
93-
" \n",
94-
" \n",
94+
"\n",
95+
"\n",
9596
"def my_func(x):\n",
96-
" return x // 2 * 2 "
97+
" return x // 2 * 2"
9798
]
9899
},
99100
{
@@ -163,21 +164,25 @@
163164
"\n",
164165
"import pytest\n",
165166
"\n",
166-
"@pytest.mark.parametrize('input,expected', [\n",
167-
" (0, 0),\n",
168-
" (1, 0),\n",
169-
" (2, 2),\n",
170-
" (3, 2),\n",
171-
"])\n",
167+
"\n",
168+
"@pytest.mark.parametrize(\n",
169+
" \"input,expected\",\n",
170+
" [\n",
171+
" (0, 0),\n",
172+
" (1, 0),\n",
173+
" (2, 2),\n",
174+
" (3, 2),\n",
175+
" ],\n",
176+
")\n",
172177
"def test_parametrized(input, expected):\n",
173178
" assert my_func(input) == expected\n",
174-
" \n",
175-
" \n",
179+
"\n",
180+
"\n",
176181
"@pytest.fixture\n",
177182
"def my_fixture():\n",
178183
" return 42\n",
179-
" \n",
180-
" \n",
184+
"\n",
185+
"\n",
181186
"def test_fixture(my_fixture):\n",
182187
" assert my_fixture == 42"
183188
]
@@ -216,17 +221,21 @@
216221
"source": [
217222
"%%ipytest -k feature1\n",
218223
"\n",
224+
"\n",
219225
"def test_feature1_test1():\n",
220226
" assert True\n",
221227
"\n",
228+
"\n",
222229
"def test_feature1_test2():\n",
223230
" assert True\n",
224-
" \n",
231+
"\n",
232+
"\n",
225233
"def test_feature2_test1():\n",
226-
" assert False\n",
227-
" \n",
234+
" pytest.fail(\"expected failure\")\n",
235+
"\n",
236+
"\n",
228237
"def test_feature2_test2():\n",
229-
" assert False"
238+
" pytest.fail(\"expected failure\")"
230239
]
231240
},
232241
{
@@ -254,12 +263,14 @@
254263
],
255264
"source": [
256265
"%%ipytest {test_feature1_test1}\n",
257-
" \n",
266+
"\n",
267+
"\n",
258268
"def test_feature1_test1():\n",
259269
" assert True\n",
260270
"\n",
271+
"\n",
261272
"def test_feature1_test2():\n",
262-
" assert False"
273+
" assert pytest.fail(\"expected failure\")"
263274
]
264275
},
265276
{
@@ -288,11 +299,13 @@
288299
"source": [
289300
"%%ipytest --deselect {test_feature1_test2}\n",
290301
"\n",
302+
"\n",
291303
"def test_feature1_test1():\n",
292304
" assert True\n",
293305
"\n",
306+
"\n",
294307
"def test_feature1_test2():\n",
295-
" assert False"
308+
" pytest.fail(\"expected failure\")"
296309
]
297310
},
298311
{
@@ -321,9 +334,10 @@
321334
"source": [
322335
"%%ipytest -x --pdb\n",
323336
"\n",
337+
"\n",
324338
"def test_example():\n",
325339
" for i in range(10):\n",
326-
" if i == 5: \n",
340+
" if i == 5:\n",
327341
" raise ValueError(i)"
328342
]
329343
},
@@ -353,6 +367,7 @@
353367
"%%ipytest\n",
354368
"# ipytest: raise_on_error=True\n",
355369
"\n",
370+
"\n",
356371
"def test():\n",
357372
" raise ValueError()"
358373
]

ipytest/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77

88
__all__ = [
9+
"Error",
910
"autoconfig",
10-
"run",
11-
"config",
1211
"clean",
12+
"config",
1313
"force_reload",
1414
"reload",
15-
"Error",
15+
"run",
1616
]

ipytest/_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Add syntatic sugar for configuration"""
2+
23
import inspect
34
import warnings
45

ipytest/cov.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def test():
3636
[coverage-py-config-docs]: https://coverage.readthedocs.io/en/latest/config.html
3737
[ipytest-cov-pytest-cov]: https://pytest-cov.readthedocs.io/en/latest/config.html
3838
"""
39+
3940
import linecache
4041
import os
4142
import os.path
@@ -206,9 +207,9 @@ def on_post_run_cell(self, result):
206207
)
207208
if execution_count in self._execution_count_counts:
208209
self._execution_count_counts[execution_count] += 1
209-
self._info[
210-
filename
211-
] = f"In[{execution_count}/{self._execution_count_counts[execution_count]}]"
210+
self._info[filename] = (
211+
f"In[{execution_count}/{self._execution_count_counts[execution_count]}]"
212+
)
212213

213214
else:
214215
self._execution_count_counts[execution_count] = 0

minidoc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
`minidoc` will replace the content between the comments with the documentation
1717
of the module. It preserves the comments itself. Therefore, it is safe to run
18-
`minidoc` repeatedly on the same document.
18+
`minidoc` repeatedly on the same document.
1919
2020
Per default minidoc will render a header for the module. To disable this
2121
behavior add `"header": false` to the initial comment, as in:
@@ -24,6 +24,7 @@
2424
<!-- minidoc "module": "my_module", "header": false -->
2525
```
2626
"""
27+
2728
#
2829
# Copyright: Christopher Prohm, 2022
2930
# Copied from https://github.com/chmp/libchmp/blob/main/src/chmp/minidoc.py

0 commit comments

Comments
 (0)