Hamilton
The Hamilton pack has 1 rule, and xpd can fix 0 of them.
The Hamilton rule finds a node that changes an input that other nodes share. It runs on files
that import hamilton, the module of Apache Hamilton, which PyPI
ships as apache-hamilton and sf-hamilton. Hamilton builds a graph of steps from plain
functions, so the name of a function is its output and the names of its parameters are its inputs. The results
below are from sf-hamilton 1.90.0 with pandas 3.1.1.
def raw() -> pd.DataFrame: ... # node rawdef clipped(raw: pd.DataFrame) -> pd.DataFrame: ... # node clipped, with the input rawdef total_uk(raw: pd.DataFrame) -> float: ... # node total_uk, with the same rawxpd does not check a node module that uses no Hamilton decorator, because it has no hamilton
import.
Shared inputs
Section titled “Shared inputs”Copy an input before a node changes it, because Hamilton hands the same object to every node that takes the input.
| Rule | Severity | Fix | What it finds |
|---|---|---|---|
| node-mutates-input | error | none | A Hamilton node that writes to its input changes an object that other nodes also receive, so their results depend on which outputs you ask for. |