{"id":17993515,"url":"https://github.com/chshersh/dr-cabal","last_synced_at":"2025-03-26T01:32:15.180Z","repository":{"id":50684815,"uuid":"519307181","full_name":"chshersh/dr-cabal","owner":"chshersh","description":"📊 Haskell dependencies build times profiler","archived":false,"fork":false,"pushed_at":"2023-01-10T22:11:43.000Z","size":1449,"stargazers_count":74,"open_issues_count":10,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-21T01:34:03.644Z","etag":null,"topics":["colour","hacktoberfest","hacktoberfest2022","haskell","pretty","profile","terminal"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/dr-cabal","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chshersh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":["chshersh"]}},"created_at":"2022-07-29T18:03:37.000Z","updated_at":"2024-10-14T22:17:05.000Z","dependencies_parsed_at":"2023-02-08T20:31:19.485Z","dependency_job_id":null,"html_url":"https://github.com/chshersh/dr-cabal","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fdr-cabal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fdr-cabal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fdr-cabal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fdr-cabal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chshersh","download_url":"https://codeload.github.com/chshersh/dr-cabal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245572007,"owners_count":20637431,"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":["colour","hacktoberfest","hacktoberfest2022","haskell","pretty","profile","terminal"],"created_at":"2024-10-29T20:11:46.133Z","updated_at":"2025-03-26T01:32:14.799Z","avatar_url":"https://github.com/chshersh.png","language":"Haskell","funding_links":["https://github.com/sponsors/chshersh"],"categories":[],"sub_categories":[],"readme":"# dr-cabal\n\n[![GitHub CI](https://github.com/chshersh/dr-cabal/workflows/CI/badge.svg)](https://github.com/chshersh/dr-cabal/actions)\n[![Hackage](https://img.shields.io/hackage/v/dr-cabal.svg?logo=haskell)](https://hackage.haskell.org/package/dr-cabal)\n[![MPL-2.0 license](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](LICENSE)\n\n`dr-cabal` is a CLI tool for profiling Haskell dependencies build times.\n\n![dr-cabal demo](https://raw.githubusercontent.com/chshersh/dr-cabal/main/images/dr-cabal-demo.gif)\n\n\u003e ℹ️ **DISCLAIMER:** This project is developed and maintained in\n\u003e free time by volunteers. The development may continue for decades or\n\u003e may stop tomorrow. You can use\n\u003e [GitHub Sponsorship](https://github.com/sponsors/chshersh) to support\n\u003e the development of this project.\n\n## Install\n\n`dr-cabal` is a CLI tool written in Haskell and can be installed\neither from Hackage or from this repository.\n\n### Prerequisites\n\nTo start using `dr-cabal`, make sure you have the required version of\n`cabal-install` (a Haskell build tool) and GHC (a Haskell compiler)\ninstalled:\n\n* [Cabal ⩾ 3.6.2.0](https://www.haskell.org/cabal/)\n* [GHC ⩾ 9.0.2](https://www.haskell.org/downloads/)\n\n### Hackage\n\nTo install the latest version of `dr-cabal` from\n[Hackage](https://hackage.haskell.org/package/dr-cabal),\nfollow these steps:\n\n1. Update Hackage index:\n\n    ```shell\n\tcabal update\n\t```\n\n2. Build `dr-cabal` from Hackage and copy the resulting executable\n   into the desired location (e.g. `$HOME/.local/bin`):\n\n    ```shell\n    cabal install dr-cabal \\\n        --install-method=copy \\\n        --overwrite-policy=always \\\n        --installdir=$HOME/.local/bin\n\t```\n\n\u003e ℹ️ **NOTE:** Make sure the `$HOME/.local/bin` directory or the\n\u003e directory of your choice is listed in `$PATH`.\n\n### Sources\n\nTo build the latest version of `dr-cabal` from sources,\nfollow these steps:\n\n1. Clone this repository:\n\n    ```shell\n    git clone https://github.com/chshersh/dr-cabal.git\n\tcd dr-cabal\n\t```\n\n2. Build the package:\n\n    ```shell\n\tcabal build\n\t```\n\n3. Copy executable to the desired location:\n\n    ```shell\n    cp $(cabal list-bin exe:dr-cabal) ~/.local/bin/dr-cabal\n\t```\n\n\u003e ℹ️ **NOTE:** Make sure the `~/.local/bin` directory or the\n\u003e directory of your choice is listed in `$PATH`.\n\n## Quick start guide\n\nRun the following command to view interactive profiling report:\n\n```shell\ncabal --store-dir=$(mktemp -d) build --dependencies-only all | dr-cabal profile\n```\n\n### Explanation\n\nThis section explains the above command:\n\n1. `dr-cabal` watches the output of the `cabal build` command to\n   produce the profiling report. Step into the directory of the\n   Haskell project you want to profile and pipe the output of\n   `cabal build` to `dr-cabal profile`.\n2. Currently, `dr-cabal` can profile only dependencies. So you can\n   pass the `--dependencies-only` to avoid extra wait.\n3. `cabal` caches built dependencies. You can specify a custom\n   directory for storing build artifacts using the `--store-dir` flag\n   to build the dependencies anew.\n4. The `$(mktemp -d)` command generates a temporary directory so you\n   can run the build time profiler in an isolated location.\n\n\u003e ⚠️ **WARNING:** To get meaningful results, including downloading\n\u003e of packages, the `dr-cabal watch` command needs to be run when\n\u003e none of the dependencies are build (i.e. with cold cabal\n\u003e cache). If you've already build you project, including\n\u003e dependencies, you can purge global Cabal cache using the\n\u003e following command:\n\u003e\n\u003e ```shell\n\u003e rm -rf ~/.cabal\n\u003e ```\n\n## Usage\n\n\u003e ℹ️ In this section, a more verbose `cabal-install` command from\n\u003e \"Quick start guide\" is replaced with shorter `cabal build`.\n\n`dr-cabal` supports profiling of documentation as well, you only need\nto pass relevant flags to `cabal build`:\n\n```shell\ncabal build --enable-documentation --haddock-all | dr-cabal profile\n```\n\nTo cache the profiling results in JSON (and avoid building the project\nagain), use the `--output` flag:\n\n```shell\ncabal build | dr-cabal profile --output=my_file.json\n```\n\nOnce you successfully produced a JSON file with all the recorded\nsteps, run the following command to pretty-print the profiling output:\n\n\u003e ⚠️ **WARNING:** For better results, make your terminal full-screen.\n\n```shell\ndr-cabal profile --input=my_file.json\n```\n\nYou'll see the output like on the image below:\n\n![dr-cabal bigger example](https://raw.githubusercontent.com/chshersh/dr-cabal/main/images/dr-cabal-itself.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchshersh%2Fdr-cabal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchshersh%2Fdr-cabal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchshersh%2Fdr-cabal/lists"}