{ "info": { "author": "Emiliano Jordan", "author_email": "emiliano.jordan+sejings@protonmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "# Sejings\n\nSejings is meant to be a quick and simple tool to rapidly integrate \nproject sejings. The problem I've seen many times with libraries is that\nit's often hard to have a way for the user to change aspects or functionality \ndeep in a library. Libraries can often have arguments for a function \nthat are unavailable to a developer because they're hidden behind three function calls.\n\nOne attempt that evolves as a codebase grows is to pass along keyword \narguments, which leads to documentation and maintainability issues. \nThis is evident by the popularity of **kwargs in many data science libraries. \nThe only solution I've seen that tries to solve this problem is to work \nwith dictionaries similar to matplotlib's rcParams. Yet this leads to \na tedious and time consuming developer experience by forcing \n`if xxx is None` statements at the top of method calls.\n\nTo show you my solution let's first start of with a rcParams style \nfunction example:\n\n```python\ndef add(*nums, cache=None, cache_path=None):\n \n if cache is None:\n cache = dict_settings['cache']\n if cache_path is None:\n cache_path = dict_settings['cache.path']\n \n result = sum(nums)\n \n if cache:\n save_to_cache(result, cache_path)\n \n return result\n```\n\nObviously this would be computationally the fastest way to \naccomplish sejings but leaves a lot of work to the developer. \nThat's why this project is meant to be friendly to developers \nconsuming packages and to encourage rapid development.\n\n# Usage\n\nImport sejings and create the sejings you need:\n\n```python\nfrom sejings import sejings\n\nsejings.cache = True\nsejings.cache.path = '/some/dir/path'\n\n```\n \nTo evaluate sejings passed into a function as an argument \nuse the @extract_sejings decorator. This will evaluate all \nsejings in the function definition and in the arguments\nbeing passed into the function:\n\n```python\nfrom sejings import extract_sejings\n\n@extract_sejings\ndef add(*nums, cache=sejings.cache, cache_path=sejings.cache.path):\n result = sum(nums)\n \n if cache: # True\n save_to_cache(result, cache_path) #'/some/dir/path'\n \n return result\n```\n\nA branch is also evaluated when an endpoint is called.\n\n```python\nassert sejings.cache()\nassert sejings.cache.path() == '/some/dir/path'\n\ndef add(*nums, cache=sejings.cache, cache_path=sejings.cache.path):\n result = sum(nums)\n \n if cache(): # True\n save_to_cache(result, cache_path()) #'/some/dir/path'\n \n return result\n```\n\nIn some cases defining arguments as a Sejings object may be\ndesired. This is accomplished by adding the argument name to the \n@extract_sejings arguments.\n\n```python\n@extract_sejings('cache')\ndef add(*nums, cache=sejings.cache):\n result = sum(nums)\n \n if cache(): # True\n save_to_cache(result, cache.path()) #'/some/dir/path'\n \n return result\n```\n\n# Integrating Into Your Project\n\nI chose sejings as a close to settings word that wouldn't conflict with\na potentially very common word in programming. Therefore you are encouraged\nto import Sejings as a name you see fit. To use matplotlibs rcParams again\nas an example we could look at an fictional file settings.py:\n\n```python\nfrom pathlib import Path\nfrom sejings import (\n extract_sejings as extract_settings,\n Sejings\n)\n\nmy_settings = Sejings(name='rcParams')\n\nmy_settings.cache = True\nmy_settings.cache.path = Path(r'/some/dir/path')\n\n@extract_settings\ndef add(*nums, cache=my_settings.cache, cache_path=my_settings.cache.path):\n result = sum(nums)\n \n if cache: # True\n save_to_cache(result, cache_path) #'/some/dir/path'\n \n return result\n\n```\n\n## @TODO\n\n* Context manager\n* __getitem__, __setitem__", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/EmilianoJordan/Sejings", "keywords": "", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "sejings", "package_url": "https://pypi.org/project/sejings/", "platform": "", "project_url": "https://pypi.org/project/sejings/", "project_urls": { "Homepage": "https://github.com/EmilianoJordan/Sejings", "Source": "https://github.com/EmilianoJordan/Sejings/", "Tracker": "https://github.com/EmilianoJordan/Sejings/issues" }, "release_url": "https://pypi.org/project/sejings/0.0.6/", "requires_dist": null, "requires_python": "", "summary": "A simple package for rapidly developing system sejings.", "version": "0.0.6", "yanked": false, "yanked_reason": null }, "last_serial": 6386133, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "9c99add7846f052ce77ad2a794bba0c4", "sha256": "7fc6128891c7855b7c351512083f33e5bbc611312c4529e5744771d14e901ed5" }, "downloads": -1, "filename": "sejings-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9c99add7846f052ce77ad2a794bba0c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4510, "upload_time": "2019-10-28T04:29:36", "upload_time_iso_8601": "2019-10-28T04:29:36.654210Z", "url": "https://files.pythonhosted.org/packages/e9/b2/313d7780c7f146381b085615a4e0d7de1c5d2fba80eef76467d0b84ddb76/sejings-0.0.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e7b577a65273d5aa7d7d6b1cba7f439c", "sha256": "75f014fc31a154f2dd91bd8069578436abc8a5c3e1a03a4fe22a932bb60bac93" }, "downloads": -1, "filename": "sejings-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e7b577a65273d5aa7d7d6b1cba7f439c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4403, "upload_time": "2019-12-23T15:26:32", "upload_time_iso_8601": "2019-12-23T15:26:32.082568Z", "url": "https://files.pythonhosted.org/packages/4e/d8/7a1fc8d74ce33adcfac22c2260e769c29bd40ea7ca5f20d07f61d6563349/sejings-0.0.2.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "b1e0971769106f2332648479ba9fdef5", "sha256": "ac72d8dcb77ee390b8bb0a7f776bc60b6c983c12fb3f554baaf861bd4e684e28" }, "downloads": -1, "filename": "sejings-0.0.3.tar.gz", "has_sig": false, "md5_digest": "b1e0971769106f2332648479ba9fdef5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4343, "upload_time": "2019-12-26T15:50:44", "upload_time_iso_8601": "2019-12-26T15:50:44.463933Z", "url": "https://files.pythonhosted.org/packages/ed/20/6a238100ecc5d3c6143202948b0057c3df3376a5d97cfd8f4f3957d9d3ac/sejings-0.0.3.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "733385007cd8ad1862ef2e69b767d4a1", "sha256": "bf8b40fed066520bc022cada60cab0bbfd386b9f2819c5083c79471343f28eff" }, "downloads": -1, "filename": "sejings-0.0.4.tar.gz", "has_sig": false, "md5_digest": "733385007cd8ad1862ef2e69b767d4a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4418, "upload_time": "2019-12-26T17:01:06", "upload_time_iso_8601": "2019-12-26T17:01:06.846627Z", "url": "https://files.pythonhosted.org/packages/4f/24/7fdcae38dafefd8c7f224affdd8c1d8d501f62b8eec18de26d7cfcedb267/sejings-0.0.4.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "332bb14b4cfe20c152e36b3ab73745cc", "sha256": "b55b4db3165a15700e8cd738810c323ee1231dbf6331c3da92d6463f3aea5c1c" }, "downloads": -1, "filename": "sejings-0.0.5.tar.gz", "has_sig": false, "md5_digest": "332bb14b4cfe20c152e36b3ab73745cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5739, "upload_time": "2019-12-30T16:16:16", "upload_time_iso_8601": "2019-12-30T16:16:16.574427Z", "url": "https://files.pythonhosted.org/packages/b4/04/58cca18067f6b1c481b8c39acff4aac9f4fc26cc6081ad6a6f3099246c27/sejings-0.0.5.tar.gz", "yanked": false, "yanked_reason": null } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "a7e485b3f8b634a1fcdefcf686b20a88", "sha256": "9e5302e95eef703fd6c61a6db76c3c1dea40769e87ad23747fff64f6a37af142" }, "downloads": -1, "filename": "sejings-0.0.6.tar.gz", "has_sig": false, "md5_digest": "a7e485b3f8b634a1fcdefcf686b20a88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6329, "upload_time": "2020-01-02T14:17:58", "upload_time_iso_8601": "2020-01-02T14:17:58.410311Z", "url": "https://files.pythonhosted.org/packages/ad/28/492279115a58b32dbeb6449d333ee1be36d7ef89337d27fa79fea52b5bb3/sejings-0.0.6.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a7e485b3f8b634a1fcdefcf686b20a88", "sha256": "9e5302e95eef703fd6c61a6db76c3c1dea40769e87ad23747fff64f6a37af142" }, "downloads": -1, "filename": "sejings-0.0.6.tar.gz", "has_sig": false, "md5_digest": "a7e485b3f8b634a1fcdefcf686b20a88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6329, "upload_time": "2020-01-02T14:17:58", "upload_time_iso_8601": "2020-01-02T14:17:58.410311Z", "url": "https://files.pythonhosted.org/packages/ad/28/492279115a58b32dbeb6449d333ee1be36d7ef89337d27fa79fea52b5bb3/sejings-0.0.6.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }