Create a new Secret parameter or as keyword
- Dominant language
- Python
- Stars
- 521
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 35
Description
Add support for secret parameter types, similar to Pydantic's [SecretStr](https://docs.pydantic.dev/2.0/usage/types/secrets/)/SecretBytes implementation, to help protect sensitive information from being accidentally exposed in logs, debugging output, or string representations.
I imagine either having a dedicated param:
```python
import param
class Config(param.Parameterized):
api_key = param.Secret(default="sk_test_abcdef")
config = Config()
print(config.api_key) # Would display: "Secret('**********')"
print(config.api_key.get_secret_value()) # Would return: "sk_test_abcdef"
```
Or, a secret kwarg on String
```python
import param
class Config(param.Parameterized):
api_key = param.String(default="sk_test_abcdef", secret=True)
config = Config()
print(config.api_key) # Would display: "**********"
print(config.get_secret_value("api_key")) # Would return: "sk_test_abcdef"
```
Contributor guide
Assessment
This issue has not been assessed yet.