{"id":15161349,"url":"https://github.com/kubernetes-sigs/depstat","last_synced_at":"2026-02-07T18:07:00.744Z","repository":{"id":38001474,"uuid":"338051008","full_name":"kubernetes-sigs/depstat","owner":"kubernetes-sigs","description":"depstat is a dependency analyzer for Go modules enabled projects. It runs as part of the Kubernetes CI pipeline to help evaluate dependency updates to Kubernetes.","archived":false,"fork":false,"pushed_at":"2024-11-04T20:58:04.000Z","size":39459,"stargazers_count":36,"open_issues_count":0,"forks_count":17,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-21T06:55:25.612Z","etag":null,"topics":["cli","cobra","dependency","dependency-analyzer","golang","k8s-sig-architecture","kubernetes","kubernetes-ci-pipeline"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kubernetes-sigs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-11T14:23:46.000Z","updated_at":"2025-04-17T13:11:53.000Z","dependencies_parsed_at":"2025-02-09T23:32:31.272Z","dependency_job_id":"7b1aed9b-727c-4796-bd5c-f518c50dad9d","html_url":"https://github.com/kubernetes-sigs/depstat","commit_stats":null,"previous_names":["rinkiyakedad/dependency-analyzer-poc"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fdepstat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fdepstat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fdepstat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubernetes-sigs%2Fdepstat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubernetes-sigs","download_url":"https://codeload.github.com/kubernetes-sigs/depstat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253759430,"owners_count":21959766,"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":["cli","cobra","dependency","dependency-analyzer","golang","k8s-sig-architecture","kubernetes","kubernetes-ci-pipeline"],"created_at":"2024-09-27T00:04:49.699Z","updated_at":"2026-02-05T04:03:55.739Z","avatar_url":"https://github.com/kubernetes-sigs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# depstat\n\n`depstat` is a command-line tool for analyzing dependencies of Go modules enabled projects. \n\n![depstat demo with k8s repo](./depstat-demo.gif)\n\n## Installation \nTo install depstat you can run\n\n```\ngo install github.com/kubernetes-sigs/depstat@latest\n```\n\n## Usage\n\n- `depstat` can be used as a standalone command-line application. You can use `depstat` to produce metrics about the dependencies of your Go modules enabled project.\n\n- Another common way to run `depstat` is in the CI pipeline of your project. This would help you analyze the dependency changes which come with PRs. \nYou can look at how this is done for the [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) repo using [prow](https://github.com/kubernetes/test-infra/tree/master/prow) [here](https://github.com/kubernetes/test-infra/blob/master/config/jobs/kubernetes/sig-arch/kubernetes-depstat.yaml). \n\n## Commands\n\nTo see the list of commands `depstat` offers you can run `depstat help`. `depstat` currently supports the following commands:\n\n### cycles\n\n`depstat cycles` shows all the cycles present in the dependencies of the project.\n\nAn example of a cycle in project dependenies is:\n`golang.org/x/net -\u003e golang.org/x/crypto -\u003e golang.org/x/net`\n\n`--json` prints the output of the cycles command in JSON format. For the above example the JSON output would look like this:\n```\n{\n  \"cycles\": [\n    [\n      \"golang.org/x/net\",\n      \"golang.org/x/crypto\",\n      \"golang.org/x/net\"\n    ]\n  ]\n}\n```\n\n### graph\n\n`depstat graph` will generate a `graph.dot` file which can be used with [Graphviz](https://graphviz.org)'s dot command to visualize the dependencies of a project.\n\nFor example, after running `depstat graph`, an SVG can be created using:\n`twopi -Tsvg -o dag.svg graph.dot`\n\nBy default, the graph would be created around the main module (first module in the `go mod graph` output), but you can choose to create a graph around a particular dependency using the `--dep` flag.\n\n### list\n\n`depstat list` shows a sorted list of all project dependencies. These include both direct and transitive dependencies.\n\n1. Direct dependencies: Dependencies that are directly used in the code of the project. These do not include standard go packages like `fmt`, etc. These are dependencies that appear on the right side of the main module in the `go mod graph` output.\n\n2. Transitive dependencies: These are dependencies that get imported because they are needed by some direct dependency of the project. These are dependencies that appear on the right side of a dependency that isn't the main module in the `go mod graph` output.\n\n### stats\n\n`depstat stats` will provide the following metrics about the dependencies of the project:\n\n1. Direct Dependencies: Total number of dependencies required by the [main module(s)](#main-module) directly.\n\n2. Transitive Dependencies: Total number of transitive dependencies (dependencies which are further needed by direct dependencies of the project).\n\n3. Total Dependencies: Total number of dependencies of the [main module(s)](#main-module).\n\n4. Max Depth of Dependencies: Length of the longest chain starting from the first [main module](#main-module); defaults to length from the first module encountered in \"go mod graph\" output.\n\n- The `--json` flag gives this output in a JSON format.\n- `--verbose` mode will help provide you with the list of all the dependencies and will also print the longest dependency chain.\n\n#### main module\nBy default, the first module encountered in \"go mod graph\" output is treated as the main module by `depstat`. Depstat uses this main module to determine the direct and transitive dependencies. This behavior can be changed by specifying the main module manually using the `--mainModules` flag with the stats command. The flag takes a list of modules names, for example:\n\n```\ndepstat stats --mainModules=\"k8s.io/kubernetes,k8s.io/kubectl\"\n```\n\n## Project Goals\n`depstat` is being developed under the code organization sub-project under [SIG Architecture](https://github.com/kubernetes/community/tree/master/sig-architecture). The goal is to make it easy to evaluate dependency updates to Kubernetes. This is done by running `depstat` as part of the Kubernetes CI pipeline.\n\n## Community Contact Information\nYou can reach the maintainers of this project at:\n\n[#k8s-code-organization](https://kubernetes.slack.com/messages/k8s-code-organization) on the [Kubernetes slack](http://slack.k8s.io).\n\n### Code of conduct\n\nParticipation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubernetes-sigs%2Fdepstat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubernetes-sigs%2Fdepstat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubernetes-sigs%2Fdepstat/lists"}