{ "info": { "author": "Phuong Huynh", "author_email": "lo4kings@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Lo4container\n\nThe simplest IoC in python\n\n## Install\n\n```\npip install lo4container\n```\n\n## Usage\n\nCreating a container is matter of creating a `Container` instance\n\n```\nfrom lo4container import Container\ncontainer = Container()\n```\n\n### Assign value\n\nWe can use `container` as a dictionary, it means you can assign/get value by key, check existing, ...\n\n```\ncontainer['name'] = 'lo4container'\nprint(container['name'])\n# output: 'lo4container'\n\n'name' in container\n# return True\n```\n\nIf we use lambda function for value, it would execute with `container` as argument\n\n```\nimport datetime\ncontainer['timer'] = lambda c: return datetime.datetime.now()\n\nprint(container['time'])\n# output: 2018-07-07 14:05:59.941780\n```\n\nEach time you get a value by key, lo4container returns a differences instance. If you want the same instance to be returned for all calls, use `share` method\n\n```\nimport datetime\ncontainer['timer'] = lambda c: return datetime.datetime.now()\ncontainer.share('timer')\n\nprint(container['time'])\n# output: 2018-07-07 14:05:59.941780\n\nprint(container['time'])\n# output: 2018-07-07 14:05:59.941780\n\nprint(container['time'])\n# output: 2018-07-07 14:05:59.941780\n# same results for n calls\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/lo4p/lo4container", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lo4container", "package_url": "https://pypi.org/project/lo4container/", "platform": "", "project_url": "https://pypi.org/project/lo4container/", "project_urls": { "Homepage": "https://gitlab.com/lo4p/lo4container" }, "release_url": "https://pypi.org/project/lo4container/0.1.6/", "requires_dist": null, "requires_python": "", "summary": "The simplest IoC in python", "version": "0.1.6" }, "last_serial": 4038687, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "5bb6540c615c5b5ef25d05a2e5fb5284", "sha256": "a07b84227417a01a28e7d6537618ecaa73ff625801706f0ae30a45ac7487123f" }, "downloads": -1, "filename": "lo4container-0.1.6.tar.gz", "has_sig": false, "md5_digest": "5bb6540c615c5b5ef25d05a2e5fb5284", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1668, "upload_time": "2018-07-07T08:17:53", "url": "https://files.pythonhosted.org/packages/24/d0/e322cb9f5ef6ef5ccf9be041a4fe9c5e3ada6a7519c85f503b1c5bde7cd0/lo4container-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5bb6540c615c5b5ef25d05a2e5fb5284", "sha256": "a07b84227417a01a28e7d6537618ecaa73ff625801706f0ae30a45ac7487123f" }, "downloads": -1, "filename": "lo4container-0.1.6.tar.gz", "has_sig": false, "md5_digest": "5bb6540c615c5b5ef25d05a2e5fb5284", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1668, "upload_time": "2018-07-07T08:17:53", "url": "https://files.pythonhosted.org/packages/24/d0/e322cb9f5ef6ef5ccf9be041a4fe9c5e3ada6a7519c85f503b1c5bde7cd0/lo4container-0.1.6.tar.gz" } ] }