logo


gin


<p><a href="https://github.com/google/gin-config">Gin</a> is a system for configuring python code that is still very much in early phases, but very powerful.</p>


1 - Intro to Gin
2 - Required Settings
3 - Functions as Config
4 - Blacklist
5 - External Configurations

You can install gin via pip install gin-config. Once that is taken care of you should be able to repeat the steps in this videos with these two files..

config.gin

simulate.n_samples = 100

simulate.py

import gin
import random

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

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

Notice how simulate() is able to run without any parameters being passed to it.