Skip to content

Commit 9556025

Browse files
committed
Use uv
1 parent a21c797 commit 9556025

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

.github/workflows/main.yml

+13-18
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,27 @@ jobs:
5757
with:
5858
dotnet-version: '6.0.x'
5959

60-
- name: Set up Python ${{ matrix.python }}
61-
uses: actions/setup-python@v2
60+
- name: Install the latest version of uv
61+
uses: astral-sh/setup-uv@v3
6262
with:
63-
python-version: ${{ matrix.python }}
64-
architecture: ${{ matrix.os.platform }}
63+
enable-cache: true
6564

6665
- name: Install dependencies
6766
run: |
68-
pip install --upgrade -r requirements.txt
69-
pip install numpy # for tests
70-
71-
- name: Build and Install
72-
run: |
73-
pip install -v .
67+
uv venv --python ${{ matrix.python }}
68+
uv sync
7469
7570
- name: Set Python DLL path and PYTHONHOME (non Windows)
7671
if: ${{ matrix.os.category != 'windows' }}
7772
run: |
78-
echo PYTHONNET_PYDLL=$(python -m find_libpython) >> $GITHUB_ENV
79-
echo PYTHONHOME=$(python -c 'import sys; print(sys.prefix)') >> $GITHUB_ENV
73+
echo PYTHONNET_PYDLL=$(uv run find_libpython) >> $GITHUB_ENV
74+
echo PYTHONHOME=$(uv run python -c 'import sys; print(sys.prefix)') >> $GITHUB_ENV
8075
8176
- name: Set Python DLL path and PYTHONHOME (Windows)
8277
if: ${{ matrix.os.category == 'windows' }}
8378
run: |
84-
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(python -m find_libpython)"
85-
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONHOME=$(python -c 'import sys; print(sys.prefix)')"
79+
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONNET_PYDLL=$(uv run find_libpython)"
80+
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -InputObject "PYTHONHOME=$(uv run python -c 'import sys; print(sys.prefix)')"
8681
8782
- name: Embedding tests
8883
if: ${{ matrix.python != '3.13' }}
@@ -92,16 +87,16 @@ jobs:
9287

9388
- name: Python Tests (Mono)
9489
if: ${{ matrix.os.category != 'windows' }}
95-
run: pytest --runtime mono
90+
run: uv run pytest --runtime mono
9691

9792
# TODO: Run these tests on Windows x86
9893
- name: Python Tests (.NET Core)
9994
if: ${{ matrix.os.platform == 'x64' }}
100-
run: pytest --runtime coreclr
95+
run: uv run pytest --runtime coreclr
10196

10297
- name: Python Tests (.NET Framework)
10398
if: ${{ matrix.os.category == 'windows' }}
104-
run: pytest --runtime netfx
99+
run: uv run pytest --runtime netfx
105100

106101
- name: Python tests run from .NET
107102
if: ${{ matrix.python != '3.13' }}
@@ -110,7 +105,7 @@ jobs:
110105
- name: Perf tests
111106
if: ${{ (matrix.python == '3.8') && (matrix.os.platform == 'x64') }}
112107
run: |
113-
pip install --force --no-deps --target src/perf_tests/baseline/ pythonnet==2.5.2
108+
uv pip install --force --no-deps --target src/perf_tests/baseline/ pythonnet==2.5.2
114109
dotnet test --configuration Release --runtime any-${{ matrix.os.platform }} --logger "console;verbosity=detailed" src/perf_tests/
115110
116111
# TODO: Run mono tests on Windows?

tools/geninterop/geninterop.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
1+
#!/usr/bin/env uv run
2+
# /// script
3+
# dependencies = ["pycparser"]
4+
# ///
45
"""
56
TypeOffset is a C# class that mirrors the in-memory layout of heap
67
allocated Python objects.

0 commit comments

Comments
 (0)