{"id":28615591,"url":"https://github.com/ocamlpro/swhid","last_synced_at":"2025-10-25T17:17:22.397Z","repository":{"id":47704635,"uuid":"387843907","full_name":"OCamlPro/swhid","owner":"OCamlPro","description":"swhid is an OCaml library to work with persistent identifiers found in Software Heritage, also known as swhid","archived":false,"fork":false,"pushed_at":"2023-11-14T21:50:08.000Z","size":319,"stargazers_count":2,"open_issues_count":6,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-12T02:09:30.658Z","etag":null,"topics":["identifiers","ocaml","persistent","software","swhid"],"latest_commit_sha":null,"homepage":"https://ocamlpro.github.io/swhid/","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OCamlPro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2021-07-20T15:58:36.000Z","updated_at":"2023-08-04T14:11:48.000Z","dependencies_parsed_at":"2025-06-12T02:09:34.855Z","dependency_job_id":"a36fe94d-92c0-4107-8bb0-04bf61ad5998","html_url":"https://github.com/OCamlPro/swhid","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/OCamlPro/swhid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OCamlPro%2Fswhid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OCamlPro%2Fswhid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OCamlPro%2Fswhid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OCamlPro%2Fswhid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OCamlPro","download_url":"https://codeload.github.com/OCamlPro/swhid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OCamlPro%2Fswhid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263234937,"owners_count":23434916,"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":["identifiers","ocaml","persistent","software","swhid"],"created_at":"2025-06-12T02:09:28.712Z","updated_at":"2025-10-25T17:17:22.390Z","avatar_url":"https://github.com/OCamlPro.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swhid [![Actions Status](https://github.com/ocamlpro/swhid/workflows/build/badge.svg)](https://github.com/ocamlpro/swhid/actions) [![coverage percentage](https://raw.githubusercontent.com/ocamlpro/swhid/gh-pages/coverage/badge.svg)](https://ocamlpro.github.io/swhid/coverage/)\n\n[swhid] is an [OCaml] executable and library to work with [persistent identifiers] found in [Software Heritage], also known as swhid. It provides:\n\n* a parser and a printer for swhid (`Swhid_core.Object` module)\n* functions to compute a swhid for a given object of any kind : content, directory, revision, release or snapshot (`Swhid.Compute`)\n* functions to query the swh API in order to get an URL from which you can download a given object (`Swhid.Download`)\n\n## Installation\n\n`swhid` can be installed with [opam]:\n\n```sh\nopam install swhid\n```\n\nIf you don't have `opam`, you can install it following the [how to install opam] guide.\n\nIf you can't or don't want to use `opam`, consult the [opam file] for build instructions.\n\n## Quickstart\n\n### Executable\n\n```shell-session\n$ swhid-compute content-string \"let rec f x = f x\\n\"\nswh:1:cnt:032873006d15555befc1b39017a342580b01f1be\n$ swhid compute content-file LICENSE.md\nswh:1:cnt:6ea040672f7995fb6d850519df1b1a5408b243a0\n$ swhid compute directory src\nswh:1:dir:3e89af4dd5b7110d511867be65d25dd51c198ad4\n$ swhid download swh:1:dir:3eb35765545dcca55cb5a7f30ab31d794cc36c95\nhttps://archive.softwareheritage.org/api/1/vault/flat/swh:1:dir:3eb35765545dcca55cb5a7f30ab31d794cc36c95/raw/\n```\n\n### Library\n\n```ocaml\nlet id = \"swh:1:rev:db21f0afdb54c16b265754ca599869fda0ca4bfc\"\n\nlet url =\n  match Swhid_core.Object.of_string id with\n  | Error e -\u003e Error e\n  | Ok id -\u003e Swhid.Download.revision id\n\nlet () =\n  match url with\n  | Error e -\u003e Format.eprintf \"can't get download URL: `%s`@.\" e\n  | Ok url -\u003e\n    Format.printf \"you can download the revision at the URL: `%s`@.\" url\n```\n\nFor more, have a look at the [example] folder, at the [documentation] or at the [test suite].\n\n## About\n\n- [LICENSE]\n- [CHANGELOG]\n\n[CHANGELOG]: ./CHANGES.md\n[example]: ./example/\n[LICENSE]: ./LICENSE.md\n[opam file]: ./swhid.opam\n[test suite]: ./test/\n\n[documentation]: https://ocamlpro.github.io/swhid/api/swhid/\n[how to install opam]: https://opam.ocaml.org/doc/Install.html\n[OCaml]: https://ocaml.org\n[opam]: https://opam.ocaml.org/\n[persistent identifiers]: https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html\n[Software Heritage]: https://www.softwareheritage.org\n[swhid]: https://ocamlpro.github.io/swhid/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focamlpro%2Fswhid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focamlpro%2Fswhid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focamlpro%2Fswhid/lists"}