dynaconf icon indicating copy to clipboard operation
dynaconf copied to clipboard

[RFC] implement `settings.populate_args` - `settings.populate_attrs` decorators.

Open rochacbruno opened this issue 3 years ago • 1 comments

populate_args

@settings.populate_args()
def a_function(server, port):
    ...

# optionally mapped
@settings.populate_args(server="db.config.server")
def a_function(server, port):
    ...

s_function(port=8888)  # server will be read from dynaconf settings if not passed

populate attrs


@settings.populate_attr("db.config")
class Server:
    server: str
    port: int

s = Server(port=8888)
s.server  # loaded from dynaconf settings
s.port   

rochacbruno avatar Mar 09 '21 17:03 rochacbruno

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 29 '22 13:06 stale[bot]