{"id":15519821,"url":"https://github.com/tomaarsen/module_dependencies","last_synced_at":"2025-09-15T18:54:27.003Z","repository":{"id":38392878,"uuid":"430374769","full_name":"tomaarsen/module_dependencies","owner":"tomaarsen","description":"Gather module dependencies of source code","archived":false,"fork":false,"pushed_at":"2023-07-21T14:38:18.000Z","size":11211,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T18:52:42.537Z","etag":null,"topics":["dependency-analysis","dependency-graph","module","modules","python"],"latest_commit_sha":null,"homepage":"https://tomaarsen.github.io/module_dependencies/","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/tomaarsen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-21T13:30:08.000Z","updated_at":"2024-04-01T19:06:24.000Z","dependencies_parsed_at":"2024-11-08T20:13:16.671Z","dependency_job_id":null,"html_url":"https://github.com/tomaarsen/module_dependencies","commit_stats":{"total_commits":65,"total_committers":4,"mean_commits":16.25,"dds":0.07692307692307687,"last_synced_commit":"185ca0ff9d802a6a9c6ed582c6269c18457c0a2f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tomaarsen/module_dependencies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2Fmodule_dependencies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2Fmodule_dependencies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2Fmodule_dependencies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2Fmodule_dependencies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomaarsen","download_url":"https://codeload.github.com/tomaarsen/module_dependencies/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomaarsen%2Fmodule_dependencies/sbom","scorecard":{"id":891894,"data":{"date":"2025-08-18","repo":{"name":"github.com/tomaarsen/module_dependencies","commit":"185ca0ff9d802a6a9c6ed582c6269c18457c0a2f"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/deploy.yaml:1","Warn: no topLevel permission defined: .github/workflows/test.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/deploy.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/deploy.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/deploy.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/deploy.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/tomaarsen/module_dependencies/test.yaml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yaml:31","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yaml:32","Warn: pipCommand not pinned by hash: .github/workflows/deploy.yaml:33","Warn: pipCommand not pinned by hash: .github/workflows/test.yaml:38","Warn: pipCommand not pinned by hash: .github/workflows/test.yaml:39","Warn: pipCommand not pinned by hash: .github/workflows/test.yaml:40","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":1,"reason":"9 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2018-66 / GHSA-562c-5r94-xh97","Warn: Project is vulnerable to: PYSEC-2019-179 / GHSA-5wv5-4vpf-pj6m","Warn: Project is vulnerable to: PYSEC-2023-62 / GHSA-m2qf-hxjv-5gpq","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: PYSEC-2017-74"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T12:10:41.510Z","repository_id":38392878,"created_at":"2025-08-24T12:10:41.510Z","updated_at":"2025-08-24T12:10:41.510Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274777736,"owners_count":25347659,"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-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["dependency-analysis","dependency-graph","module","modules","python"],"created_at":"2024-10-02T10:22:58.217Z","updated_at":"2025-09-15T18:54:26.980Z","avatar_url":"https://github.com/tomaarsen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Module Dependencies\n## Brief overview\nThe ``module_dependencies`` Python module allows you to gather the dependencies of specific modules in source code. It has been split into two main sections: ``Module`` and ``Source``.\n\nThe former, ``Module``, supports functionality for mapping a module name to the usage of that module within open source repositories.\nThis is very useful when we are interested in determining which sections of a Python module is most frequently used. For example:\n\n```python\nfrom module_dependencies import Module\nfrom pprint import pprint\n\n# Attempt to find 1000 imports of the \"nltk\" module\n# in both Python files and Jupyter Notebooks each\nmodule = Module(\"nltk\", count=\"1000\")\npprint(module.usage()[:15])\nmodule.plot()\n```\n\nThis program outputs:\n```python\n[2022-01-03 14:14:39,127] [module_dependencies.module.session] [INFO    ] - Fetching Python source code containing imports of `nltk`...\n[2022-01-03 14:14:42,824] [module_dependencies.module.session] [INFO    ] - Fetched Python source code containing imports of `nltk` (status code 200)\n[2022-01-03 14:14:42,825] [module_dependencies.module.session] [INFO    ] - Parsing 6,830,859 bytes of Python source code as JSON...\n[2022-01-03 14:14:42,865] [module_dependencies.module.session] [INFO    ] - Parsed 6,830,859 bytes of Python source code as JSON...\n[2022-01-03 14:14:42,866] [module_dependencies.module.session] [INFO    ] - Extracting dependencies of 725 files of Python source code...\nParsing Files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 725/725 [00:02\u003c00:00, 258.48files/s]\n[2022-01-03 14:14:45,702] [module_dependencies.module.session] [INFO    ] - Extracted dependencies of 725 files of Python source code.\n[2022-01-03 14:14:45,703] [module_dependencies.module.session] [INFO    ] - Fetching Jupyter Notebook source code containing imports of `nltk`...\n[2022-01-03 14:14:48,726] [module_dependencies.module.session] [INFO    ] - Fetched Jupyter Notebook source code containing imports of `nltk` (status code 200)\n[2022-01-03 14:14:48,726] [module_dependencies.module.session] [INFO    ] - Parsing 25,713,281 bytes of Jupyter Notebook source code as JSON...\n[2022-01-03 14:14:48,886] [module_dependencies.module.session] [INFO    ] - Parsed 25,713,281 bytes of Jupyter Notebook source code as JSON...\n[2022-01-03 14:14:48,888] [module_dependencies.module.session] [INFO    ] - Extracting dependencies of 495 files of Jupyter Notebook source code...\nParsing Files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 495/495 [00:02\u003c00:00, 167.09files/s]\n[2022-01-03 14:14:51,851] [module_dependencies.module.session] [INFO    ] - Extracted dependencies of 495 files of Jupyter Notebook source code.\n[('nltk.tokenize.word_tokenize', 327),\n('nltk.download', 298),\n('nltk.corpus.stopwords.words', 257),\n('nltk.tokenize.sent_tokenize', 126),\n('nltk.stem.porter.PorterStemmer', 115),\n('nltk.stem.wordnet.WordNetLemmatizer', 99),\n('nltk.tag.pos_tag', 75),\n('nltk.stem.snowball.SnowballStemmer', 48),\n('nltk.data.path.append', 42),\n('nltk.probability.FreqDist', 42),\n('nltk.tokenize.RegexpTokenizer', 42),\n('nltk.tokenize.TweetTokenizer', 35),\n('nltk.corpus.wordnet.synsets', 33),\n('nltk.data.load', 32),\n('nltk.translate.bleu_score.corpus_bleu', 29)]\n```\n\nAnd then opens an interactive version of the following plot:\n![usage](https://user-images.githubusercontent.com/37621491/147952784-57691744-b0e9-4ef1-a970-fe528bf1f029.png)\n\n(Note that the true plot [is interactive](https://tomaarsen.github.io/module_dependencies/), but this copy for GitHub is just a png)\n\nWith the methods provided in the ``Module`` class, it becomes elementary to see which sections of code are frequently used, allowing you to prioritise these sections over rarely used sections.\n\n---\n\n``module_dependencies`` also provides ``Source``, wich implements functionality for mapping Python source code to the dependencies and imports within that file. For example:\n\n```python\nfrom module_dependencies import Source\nfrom pprint import pprint\n\n# This creates a Source instance for this file itself\nsrc = Source.from_file(__file__)\n\npprint(src.dependencies())\npprint(src.imports())\n```\n\nThis program outputs:\n```python\n['module_dependencies.Source.from_file', 'pprint.pprint']\n['module_dependencies', 'pprint']\n```\n\n---\n\n## Documentation\nMore detailed documentation, including examples and an API Reference, can be found in the [online documentation](https://tomaarsen.github.io/module_dependencies/). I also wrote a [paper](https://github.com/tomaarsen/module_dependencies/blob/main/paper.pdf) about `module_dependencies`.\n\n## Installation\n``module_dependencies`` can be installed directly via pip. It is recommended to set up a virtualenvironment before installation, although this is not strictly a requirement.\n\nThe command to install ``module_dependencies`` is:\n```\npip install module_dependencies\n```\n\nNote that ``module_dependencies`` requires Python 3.7 onwards.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomaarsen%2Fmodule_dependencies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomaarsen%2Fmodule_dependencies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomaarsen%2Fmodule_dependencies/lists"}