{"push_id":1945726727,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"275e58ec3fe164ee760148e867febd26df3065c4","before":"d58b87743d3d12f0522c28011c6051eaecd613bc","commits":[{"sha":"275e58ec3fe164ee760148e867febd26df3065c4","author":{"name":"Ihor Kalnytskyi","email":"c106458e9250d900f99cad2a80974bf211dcbcd4@kalnytskyi.com"},"message":"Picobox is opinionated DI framework for Python\n\nThe best way to describe picobox is to show an example:\n\n import picobox\n import requests\n\n @picobox.pass_('conf')\n @picobox.pass_('requests', as_='session')\n def get_resource(uri, session, conf):\n     return session.get(conf['base_uri'] + uri)\n\n box = picobox.Box()\n box.put('conf', {'base_uri': 'http://example.com'})\n box.put('requests', factory=requests.Session, scope=picobox.threadlocal)\n\n with picobox.push(box):\n     get_resource('/resource', requests.Session(), {})\n     get_resource('/resource', requests.Session())\n     get_resource('/resource')\n\nSo what we have here?\n\n (a) get_resource() function that may try to fetch conf and session out\n     from pushed box on call;\n\n (b) box instance that's created and defined later in the code;\n\n (c) picobox.push() context manager that says to redirect any call of\n     picobox.put(), picobox.get() or picobox.pass_() to pushed box\n     instance;\n\n (d) get_resource() function called from different threads will have its\n     own instance of requests.Session.","distinct":true,"url":"https://api.github.com/repos/ikalnytskyi/box/commits/275e58ec3fe164ee760148e867febd26df3065c4"}]}
{"actor":{"display_login":"ikalnytskyi"}}