-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Make argument flag configurable #414
Comments
@hramezani I agree that |
Thanks so much for the PR! I just tried it out and it seems that argparse doesn't support having no prefix chars |
What does "disable" the prefix mean? I believe the prefix has to be non-empty. Argparse will probably do some wonky things if you step off the garden path.
Empty char:
|
@guarin, yes, it's a limitation of If your use case allows for it, you could always use environment variables to mimic a CLI. e.g., on Linux the below invocations are equivalent when using Pydantic Settings: $ python3 my_app.py --arg=5 --other_arg=6
$ arg=5 other_arg=6 python3 my_app.py On Windows, using env vars to mimic the CLI is uglier, and could really only be done in a similar manner using PowerShell. |
Hi, would it be possible to make the argument flag (the
--
prefix before argument names) configurable? I saw that it is hardcoded here:pydantic-settings/pydantic_settings/sources.py
Line 1624 in 7e7ccdb
Our use case is that we are migrating some tools from omegaconf to pydantic and would like to use pydantic-settings to parse CLI arguments. My understanding is that pydantic-settings always adds a
--
prefix before argument names whereas omegaconf doesn't add this prefix. It would be great to have an option to disable the prefix in pydantic-settings to make the transition backwards compatible.I also saw that
--
is used in another place but am not sure if this would be relevant for this feature:pydantic-settings/pydantic_settings/sources.py
Line 1506 in 7e7ccdb
The text was updated successfully, but these errors were encountered: