List all dependencies of a GitHub repository, outputs to markdown file
Pull the repository and install the dependencies:
# setup virtual environment
python3 -m venv venv
# activate virtual environment
source venv/bin/activate
# install dependencies
pip install -r requirements.txt
# create .env file with GITHUB_API_KEY
echo "GITHUB_API_KEY=your_github_api_key" > .env-
Update
config.jsonwith the organization and list of repos you want to list dependencies for.{ "organization": "your_organization", "repos": ["repo1", "repo2"], "fetchMetrics": true }NOTE:
fetchMetricsis optional and defaults tofalse. If set totrue, the script will fetch additional metrics like last push, stars, and open issues for each dependency. This may take longer to run, and requires additional API calls.NOTE: Be sure the repos you want to list dependencies for are public or you have access to them and they have the dependency graph enabled
-
Run the script
# run the script python script.py -
View the output
View the output in
deps.mdas a markdown formatted table.Sample output for this repository:
Package Github Link Version Org Repos Last Push Stars Open Issues certifi certifi/python-certifi = 2024.2.2github-deps2024-04-01 758 4 charset-normalizer Ousret/charset_normalizer = 3.3.2github-deps2024-04-08 514 8 diskcache Baughn/python-diskcache = 5.6.3github-deps2023-04-17 0 1 idna kjd/idna = 3.6github-deps2024-04-02 234 5 python-dotenv theskumar/python-dotenv = 1.0.1github-deps2024-04-08 7048 57 pyyaml yaml/pyyaml = 6.0.1github-deps2024-03-19 2416 282 requests psf/requests = 2.31.0github-deps2024-04-08 51288 273 tomark codazoda/tomark = 0.1.4github-deps2023-08-24 15 1 urllib3 urllib3/urllib3 = 2.2.1github-deps2024-04-07 3657 139 xkcd2347 edsu/xkcd2347 = 0.0.4github-deps2021-06-17 13 2