{"id":13502452,"url":"https://github.com/ned14/automodinit","last_synced_at":"2025-05-06T02:33:14.639Z","repository":{"id":2634494,"uuid":"3622910","full_name":"ned14/automodinit","owner":"ned14","description":"Solves the problem of forgetting to keep __init__.py files up to date","archived":false,"fork":false,"pushed_at":"2017-03-05T16:46:10.000Z","size":15,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T11:23:57.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pypi.python.org/pypi/automodinit","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ned14.png","metadata":{"files":{"readme":"Readme.txt","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-05T01:38:06.000Z","updated_at":"2024-10-18T02:38:00.000Z","dependencies_parsed_at":"2022-08-29T17:20:54.015Z","dependency_job_id":null,"html_url":"https://github.com/ned14/automodinit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ned14%2Fautomodinit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ned14%2Fautomodinit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ned14%2Fautomodinit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ned14%2Fautomodinit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ned14","download_url":"https://codeload.github.com/ned14/automodinit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252609899,"owners_count":21775899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:02:14.383Z","updated_at":"2025-05-06T02:33:14.317Z","avatar_url":"https://github.com/ned14.png","language":"Python","readme":"automodinit v0.16 5th March 2017:\r\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\r\nNiall Douglas http://www.nedproductions.biz/\r\nSee http://pypi.python.org/pypi/automodinit for latest version\r\nGo to http://github.com/ned14/automodinit to report bugs\r\n\r\nThis package fixes a small problem which has been bugging me throughout\r\nyears of python development: forgetting to keep a module's __init__.py\r\nup to date with new files added. This causes the following, irritating\r\nproblems:\r\n\r\n1. Test suites don't find docstring tests.\r\n2. Static analysis tools don't see some module content in __all__.\r\n3. Things which scan themselves for plugins mismatch what os.listdir()\r\n   returns as against what the module import table has.\r\n4. I waste time over something which should take care of itself.\r\n5. os.listdir() based solutions tend to fail when freezed into\r\n   an executable binary because they don't understand running from\r\n   inside a ZIP archive.\r\n   \r\nSo here's how to make the problem go away forever:\r\n \r\n1. Include the automodinit package into your setup.py dependencies.\r\n2. Replace all __init__.py files like this:\r\n \r\n__all__ = [\"I will get rewritten\"]\r\n# Don't modify the line above, or this line!\r\nimport automodinit\r\nautomodinit.automodinit(__name__, __file__, globals())\r\ndel automodinit\r\n# Anything else you want can go after here, it won't get modified.\r\n\r\n3. That's it! From now on importing a module will set __all__ to\r\n   a list of .py[co] files in the module and will also import each\r\n   of those files as though you had typed:\r\n   \r\n   for x in __all__: import x\r\n   \r\n   Therefore the effect of \"from M import *\" matches exactly \"import M\".\r\n   \r\nCustomising:\r\n-=-=-=-=-=-=\r\nautomodinit can take the following additional parameters:\r\n\r\nfilter: This is a callable which will be passed a list of tuples\r\n        (loader, modulename, ispkg) which is the output of\r\n        pkgutil.iter_modules() for the calling module. Return only\r\n        those which you want to be imported.\r\nimportFindings: Defaults to True. Set to False to not auto-import\r\n                the contents of __all__.\r\n\r\nVersion history:\r\n-=-=-=-=-=-=-=-=\r\n * v0.16 5th Mar 2017\r\n   * Fixed stripping of __init__.py file encoding. Thanks to wtyerogers\r\nfor reporting this.\r\n   * Removed suggestion this is the smallest package on pypi. Thanks to\r\nasl97 for reporting this.\r\n   * Tell PyPi we are under the MIT licence. Thanks to njwhite for\r\nreporting this.\r\n\r\n * v0.13 9th Feb 2013\r\n   * Fixed a bug where the source distribution would fail to install due\r\nto not including distribute_setup.py. Thanks to kanzure for reporting this.\r\n\r\n * v0.12 5th Mar 2012\r\n   * Fixed a bug where isinstance would occasionally fail. Turns out the\r\npkgutil loading mechanism doesn't check to see if the module is already\r\nloaded, so it was loading duplicates whose types wouldn't compare.\r\n\r\n * v0.11 5th Mar 2012\r\n   * Fixed some typos in Readme.txt\r\n   * Typically what worked before packaging did not work after. Fixed!\r\n\r\n * v0.10 5th Mar 2012\r\n   First release\r\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fned14%2Fautomodinit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fned14%2Fautomodinit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fned14%2Fautomodinit/lists"}