logo

... gin: required settings



Notes

Sometimes you'd like a setting to be manditory. The files below reflect that.

config.gin

simulate.n_samples = 200

simulate.py

import gin
import random

@gin.configurable
def simulate(n_samples=gin.REQUIRED)
    return sum(random.random() for i in range(n_samples))

if __name__ == "__main__":
    gin.parse_config_file("config.gin")
    print(simulate())

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.