{"id":21009422,"url":"https://github.com/shangsky/module-tools","last_synced_at":"2025-07-22T04:33:03.143Z","repository":{"id":57673772,"uuid":"481897643","full_name":"ShangSky/module-tools","owner":"ShangSky","description":"python module tools","archived":false,"fork":false,"pushed_at":"2022-04-18T07:43:51.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T11:19:37.599Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShangSky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-15T08:53:07.000Z","updated_at":"2022-04-15T09:23:48.000Z","dependencies_parsed_at":"2022-08-31T13:10:32.033Z","dependency_job_id":null,"html_url":"https://github.com/ShangSky/module-tools","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ShangSky/module-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShangSky%2Fmodule-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShangSky%2Fmodule-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShangSky%2Fmodule-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShangSky%2Fmodule-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShangSky","download_url":"https://codeload.github.com/ShangSky/module-tools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShangSky%2Fmodule-tools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266428049,"owners_count":23926921,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-19T09:16:43.654Z","updated_at":"2025-07-22T04:33:03.115Z","avatar_url":"https://github.com/ShangSky.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Module Tools\n\nTools for python modules\n\n## Installation\n\n```shell\n$ pip install module-tools\n```\n\n## Examples\n\n```python\n\"\"\"\npackage\n    __init__.py\n    sub_package\n        __init__.py\n        modulec.py -\u003e var5, var6 = 3, \"c\"\n    modulea.py -\u003e var1, var2, add = 1, \"a\", lambda a, b: a + b\n    moduleb.py -\u003e var3, var4 = 2, \"b\"\n\"\"\"\n\nfrom package.modulea import add\n\nfrom module_tools import find_module_strings, find_modules, import_string, iter_objs_from_modules\n\nadd1 = import_string(\"package.modulea.add\")\nprint(add1 is add)  # True\n\nprint(set(find_module_strings(\"package\")) == {\"package.modulea\", \"package.moduleb\"})  # True\nprint(\n    set(find_module_strings(\"package\", recursive=True))\n    == {\"package.modulea\", \"package.moduleb\", \"package.sub_pakage.modulec\"}\n)  # True\nfrom package import modulea, moduleb\nfrom package.sub_package import modulec\n\nprint(set(find_modules(\"package\")) == {modulea, moduleb})  # True\nprint(set(find_modules(\"package\", recursive=True)) == {modulea, moduleb, modulec})  # True\n\nprint(set(iter_objs_from_modules([\"package\"], cls=int)) == {1, 2})  # True\nprint(set(iter_objs_from_modules([\"package\"], cls=int, recursive=True)) == {1, 2, 3})  # True\n\nprint(\n    set(iter_objs_from_modules([\"package\"], cls=int, recursive=True, func=lambda x: x \u003c 3))\n    == {1, 2}\n)  # True\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshangsky%2Fmodule-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshangsky%2Fmodule-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshangsky%2Fmodule-tools/lists"}