cyclopts: Confusing error message when missing `Parameter(name="*")`
# /// script
# dependencies = ["cyclopts"]
# ///
import os
from dataclasses import dataclass, field
from cyclopts import App, Parameter
app = App()
@Parameter(name="*")
@dataclass(frozen=True, slots=True, kw_only=True)
class P:
arg1: str = field(default_factory=lambda: os.environ["FOO"])
@app.default
def main(p: P, *, arg: str):
print("Hello World!")
if __name__ == "__main__":
app()
uv run demo.py --arg s yields:
Parameter "*" requires an argument.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (17 by maintainers)
Yeah I think this is good. Let’s close.
I’ll have to think about it more. I think it’s probably too much cruft to make it work exactly as the user might want, but I’m not sure yet.
got it; will investigate later today!
EDIT: I suspect that i’m not handling
default_factorycorrectly in dataclasses, but we shall see.