You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/llms.txt
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -185,3 +185,33 @@ except SystemExit:
185
185
```
186
186
187
187
argclass automatically strips `type=` for `VERSION`, `HELP`, `STORE_TRUE`, `STORE_FALSE`, and `COUNT` actions (argparse rejects it). Extra kwargs are frozen as an immutable `MappingProxyType` and merged into the dict passed to `add_argument()`.
188
+
189
+
The same passthrough enables custom `argparse.Action` subclasses with their own constructor parameters — they read those parameters in `__init__` before delegating to `super().__init__`. Example: a `--check-updates` flag that queries PyPI for the latest version of a configurable package and exits:
190
+
191
+
```python
192
+
import argparse, json, urllib.request
193
+
from importlib.metadata import version as get_version
0 commit comments