generated from BrianPugh/python-template
-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
enhancementNew feature or requestNew feature or requestimplementedthis feature has been implemented, but the issue **might** not be closed yet.this feature has been implemented, but the issue **might** not be closed yet.
Description
Hi!
Thanks for this great peace of software, I'm having a lot of fun with all the features cyclopts provides!
I'm using https://python-dependency-injector.ets-labs.org/wiring.html for a project, it uses an "@Inject" decorator to overwrite arg defaults.
Sadly cyclopts also wants to handle them which results in wired behavior.
This little patch allows me to ignore fields with an underscore prefix, I don't think this is backwards compatible that's why I didn't provide a PR.
diff --git a/cyclopts/argument/_collection.py b/cyclopts/argument/_collection.py
index 87abf08..00b5dfe 100644
--- a/cyclopts/argument/_collection.py
+++ b/cyclopts/argument/_collection.py
@@ -435,6 +435,9 @@ class ArgumentCollection(list[Argument]):
docstring_lookup = extract_docstring_help(func) if parse_docstring else {}
positional_index = 0
for field_info in signature_parameters(func).values():
+ if not field_info.required and field_info.name[0] == "_":
+ continue
+
if parse_docstring:
subkey_docstring_lookup = {
k[1:]: v for k, v in docstring_lookup.items() if k[0] == field_info.name and len(k) > 1What do you think about this?
Kind regards,
René
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestimplementedthis feature has been implemented, but the issue **might** not be closed yet.this feature has been implemented, but the issue **might** not be closed yet.