Skip to content

Commit 863c08c

Browse files
committed
pr comments
Signed-off-by: Mark Halka <mark.halka2001@gmail.com>
1 parent 08ce4d4 commit 863c08c

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ A compilation framework that transforms Python functions into native C-callable
1616
- **Extensible type resolution** — register custom types that map Python syntax to numba-compatible lowering
1717
- **Plugin architecture** — all domain-specific behavior (input handlers, output handlers, AST transforms, type inference) is injected through registration APIs
1818

19-
```python
20-
@numba_node
21-
def ema(x: Signal[float], alpha: float) -> Signal[float]:
22-
s: State[float] = 0.0 # persistent state, initialized once
23-
s = alpha * x + (1.0 - alpha) * s # natural Python syntax
24-
return s # compiled to native code
25-
```
26-
2719
The distribution is published as `numba-cfunc-compiler` and imported in Python as `numba_cfunc_compiler`.
2820

2921
## Installation

numba_cfunc_compiler/post_compilation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
import re
23
from dataclasses import dataclass
34
from typing import Any
@@ -8,6 +9,8 @@
89
"link_ffi_bitcode",
910
]
1011

12+
log = logging.getLogger("numba_cfunc_compiler")
13+
1114

1215
@dataclass(frozen=True)
1316
class CompilationOptions:
@@ -105,6 +108,6 @@ def link_ffi_bitcode(module: Any, bitcode: bytes) -> Any:
105108
module.verify()
106109

107110
except Exception as e:
108-
print(f"Failed to link FFI bitcode for inlining (falling back to external calls): {e}")
111+
log.warning(f"Failed to link FFI bitcode for inlining (falling back to external calls): {e}")
109112

110113
return module

numba_cfunc_compiler/utils/ast.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ast
2+
import logging
23
from typing import List, Union
34

45
from llvmlite import ir
@@ -16,12 +17,14 @@
1617
"AST",
1718
]
1819

20+
log = logging.getLogger("numba_cfunc_compiler")
21+
1922

2023
def print_ast(value) -> None:
2124
ast.fix_missing_locations(value)
2225
tree = ast.parse(value)
2326
src = ast.unparse(tree)
24-
print(src)
27+
log.info(src)
2528

2629

2730
def add_statement_to_list(node_list: List[ast.stmt], node: Union[ast.stmt, List[ast.stmt], None]) -> None:

0 commit comments

Comments
 (0)