Closed germanium closed 2 years ago
Unlike os.environ
itself and a few other singletons which we account for:
https://github.com/pdoc3/pdoc/blob/f358893e4fcfd7f29857a7ff5491b606ff146d39/pdoc/__init__.py#L1453-L1462
... os.getenv('my_env_var')
is evaluated before being assigned as arg1
default.
>>> import os; os.environ['my_env_var'] = 'this'
>>> def foo(*, arg1=os.environ['my_env_var']): pass
>>> foo.__kwdefaults__
{'arg1': 'this'}
So unfortunately, this is not possible. :disappointed:
Expected Behavior
I would expect it to render
Actual Behavior
It actually renders it with the result of evaluating the default argument.
In this example this behavior can be very dangerous if the environment that builds the documentation has secrets in the environment variable
my_env_var
.Additional info