What to do
Convert a value to Path when the target parameter's annotation asks for Path. The resolver
already reads the signature.
Why
configuronic builds a value from the CLI text with ast.literal_eval, and keeps a str when that
read fails. An int, a float and a bool survive that read. A path does not. So
--output_dir=/tmp/run reaches the function as a str. An .override string reaches it unchanged
for the same result.
A caller cannot annotate the parameter Path today. The annotation disagrees with the value that
arrives, and a type checker believes the annotation. So a path parameter carries str | Path | None,
and the function converts the value again.
The URL case
A path parameter also takes a URL, for example --output_dir=s3://bucket/run. The remote store parses
that URL. Path keeps the text on Linux and on macOS, and changes a separator on Windows. Write a
test for this case.
Who waits for it
positronic annotates each path parameter str | Path | None for this reason. It drops the str half
after this change. prepare_output_dir in positronic/cli/eval/run.py carries a TODO that points
here.
What to do
Convert a value to
Pathwhen the target parameter's annotation asks forPath. The resolveralready reads the signature.
Why
configuronic builds a value from the CLI text with
ast.literal_eval, and keeps astrwhen thatread fails. An
int, afloatand aboolsurvive that read. A path does not. So--output_dir=/tmp/runreaches the function as astr. An.overridestring reaches it unchangedfor the same result.
A caller cannot annotate the parameter
Pathtoday. The annotation disagrees with the value thatarrives, and a type checker believes the annotation. So a path parameter carries
str | Path | None,and the function converts the value again.
The URL case
A path parameter also takes a URL, for example
--output_dir=s3://bucket/run. The remote store parsesthat URL.
Pathkeeps the text on Linux and on macOS, and changes a separator on Windows. Write atest for this case.
Who waits for it
positronic annotates each path parameter
str | Path | Nonefor this reason. It drops thestrhalfafter this change.
prepare_output_dirinpositronic/cli/eval/run.pycarries a TODO that pointshere.