Skip to content

Commit 38fc738

Browse files
committed
Resolve remaining Python issues
1 parent 162ea81 commit 38fc738

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

.actrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-P ubuntu-latest=catthehacker/ubuntu:act-latest

.github/copilot-instructions.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,19 @@ All Markdown files must strictly follow these markdownlint rules:
138138
1. Run tests with `LLVM_PROFILE_FILE` set (e.g., `export LLVM_PROFILE_FILE="profraw/%m-%p.profraw"`).
139139
2. Merge profiles: `llvm-profdata merge -sparse profraw/*.profraw -o coverage.profdata`.
140140
3. Generate report: `llvm-cov show -instr-profile=coverage.profdata -format=html ...`
141+
142+
### Local GitHub Actions Testing (`act`)
143+
144+
- **Tool**: Use `act` to run GitHub Actions workflows locally.
145+
- **Configuration**: Ensure `.actrc` exists in the workspace root with the following content to use a compatible runner image:
146+
```text
147+
-P ubuntu-latest=catthehacker/ubuntu:act-latest
148+
```
149+
- **Usage**:
150+
- List jobs: `act -l`
151+
- Run specific job: `act -j <job_name>` (e.g., `act -j python-check`)
152+
- Run specific event: `act pull_request`
153+
- **Troubleshooting**:
154+
- **Docker Socket**: `act` requires access to the Docker socket. In dev containers, this may require specific mount configurations or permissions.
155+
- **Artifacts**: `act` creates a `phlex-src` directory (or similar) for checkout. Ensure this is cleaned up or ignored by tools like `mypy`.
156+

test/python/test_types.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
import numpy.typing as npt
99

1010

11+
class double(float): # noqa: N801
12+
"""Dummy class for C++ double type."""
13+
14+
pass
15+
16+
1117
def add_float(i: float, j: float) -> float:
1218
"""Add two floats.
1319
@@ -21,7 +27,7 @@ def add_float(i: float, j: float) -> float:
2127
return i + j
2228

2329

24-
def add_double(i: "double", j: "double") -> "double":
30+
def add_double(i: double, j: double) -> double:
2531
"""Add two doubles.
2632
2733
Args:
@@ -31,10 +37,10 @@ def add_double(i: "double", j: "double") -> "double":
3137
Returns:
3238
float: Sum of the two inputs.
3339
"""
34-
return i + j
40+
return double(i + j)
3541

3642

37-
def add_unsigned(i: "unsigned int", j: "unsigned int") -> "unsigned int":
43+
def add_unsigned(i: "unsigned int", j: "unsigned int") -> "unsigned int": # type: ignore # noqa: F722
3844
"""Add two unsigned integers.
3945
4046
Args:
@@ -60,7 +66,7 @@ def collect_float(i: float, j: float) -> npt.NDArray[np.float32]:
6066
return np.array([i, j], dtype=np.float32)
6167

6268

63-
def collect_double(i: "double", j: "double") -> npt.NDArray[np.float64]:
69+
def collect_double(i: double, j: double) -> npt.NDArray[np.float64]:
6470
"""Combine doubles into a numpy array.
6571
6672
Args:

0 commit comments

Comments
 (0)