{"id":23032705,"url":"https://github.com/johanfylling/opa-dependency-manager","last_synced_at":"2025-07-20T15:03:44.533Z","repository":{"id":163669292,"uuid":"635311548","full_name":"johanfylling/opa-dependency-manager","owner":"johanfylling","description":"OPA Dependency Manager (ODM)","archived":false,"fork":false,"pushed_at":"2024-06-17T10:46:48.000Z","size":116,"stargazers_count":12,"open_issues_count":16,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T20:22:55.543Z","etag":null,"topics":["dependency-management","opa","open-policy-agent","openpolicyagent","rego"],"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/johanfylling.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-05-02T12:30:04.000Z","updated_at":"2024-09-24T05:11:56.000Z","dependencies_parsed_at":"2023-10-01T17:32:56.703Z","dependency_job_id":"f886e920-b20a-4889-84f3-e130926b6a40","html_url":"https://github.com/johanfylling/opa-dependency-manager","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/johanfylling/opa-dependency-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanfylling%2Fopa-dependency-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanfylling%2Fopa-dependency-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanfylling%2Fopa-dependency-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanfylling%2Fopa-dependency-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johanfylling","download_url":"https://codeload.github.com/johanfylling/opa-dependency-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanfylling%2Fopa-dependency-manager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266143941,"owners_count":23883069,"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":["dependency-management","opa","open-policy-agent","openpolicyagent","rego"],"created_at":"2024-12-15T15:55:48.681Z","updated_at":"2025-07-20T15:03:44.510Z","avatar_url":"https://github.com/johanfylling.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OPA Dependency Manager (ODM)\n\nODM is a tool for managing dependencies for [Open Policy Agent](https://www.openpolicyagent.org/) (OPA) projects.\n\n__NOTE__: This is an experimental project not officially supported by the OPA team or Styra. \n\n```bash\n$ odm init my_project\n$ cd my_project\n$ odm depend --no-namespace rego-test-assertions \\\n      git+https://github.com/anderseknert/rego-test-assertions\n$ mkdir src\n\n$ cat \u003c\u003cEOF \u003e src/policy.rego\npackage main\n\nimport data.test.assert\n\nfoo := 42\n\ntest_foo {\n    assert.equals(42, foo)\n}\nEOF\n\n$ odm test\n```\n\nAn example project can be found [here](https://github.com/johanfylling/odm-example-project).\n\n## Running\n\nWhere you have your `.rego` project/files.\n\n### Setup new project\n\n```bash\n$ odm init [project name]\n```\n\n### Add a dependency\n\n```bash\n$ odm depend \u003cdependency name\u003e \u003cdependency path\u003e\n```\n\nIn `opa.project`:\n\n```yaml\ndependencies:\n  \u003cdependency name\u003e: \u003cdependency path\u003e\n```\n\n#### Local dependency\n\nLocal dependencies can be specified with relative or absolute paths, or URLs.:\n\n* `file:/\u003cpath\u003e`\n\nExamples:\n\n* Absolute path: `file://tmp/my/dependency`\n* Relative path: `file:/../my/dependency`\n\n#### Git dependency\n\nGit dependencies are URLs prefixed with `git+`:\n\n* `git+http://\u003cpath\u003e[#tag|branch|commit]]`\n* `git+https://\u003cpath\u003e[#tag|branch|commit]]`\n* `git+ssh://\u003cpath\u003e[#tag|branch|commit]]`\n\nExamples:\n\n* GitHub dependency at `HEAD` of repo: `git+https://github.com/johanfylling/odm-example-dependency.git`\n* GitHub dependency at `v1.0` tag: `git+https://github.com/johanfylling/odm-example-dependency.git#v1.0`\n* GitHub dependency at `foo` branch: `git+https://github.com/johanfylling/odm-example-dependency.git#foo`\n* GitHub dependency at `88c5cde` commit: `git+https://github.com/johanfylling/odm-example-dependency.git#88c5cde`\n\n### Update dependencies\n\n```bash\n$ odm update\n```\n\n### Evaluating policies\n\nExample:\n```bash\n$ odm eval -- 'data.main.allow'\n```\n\nif a `source` folder is specified in `opa.project`, it will be automatically included in the evaluation.\n\n### Testing policies\n\nExample:\n```bash\n$ odm test -- -d policy.rego\n```\n\nif a `source` folder is specified in `opa.project`, it will be automatically included in the evaluation.\n\n## Namespacing\n\nBy default, dependencies are namespaced by their declared name.\n\nWhen a dependency is namespaced, all contained Rego packages will be prefixed with the namespace.\nE.g.: a dependency with the following package structure:\n\n```\nfoo\n +-- bar\n |   +-- baz\n +-- qux   \n```\n\nwhen namespaced with `utils`, it will have the following structure:\n\n```\nutils\n +-- foo\n     +-- bar\n     |   +-- baz\n     +-- qux   \n```\n\nTransitive dependencies will be namespaced as well.\nAny transitive dependency already namespaced by its enclosing dependency project will have its packages prefixed by the namespace assigned by the enclosing project, and then by the namespace defined in the main project, recursively.\n\n### Custom namespace\n\n```bash\n$ odm dep my_dep file:/path/to/dependency -n mynamespace\n```\n\nIn `opa.project`:\n\n```yaml\ndependencies:\n  my_dep: \n    path: file:/path/to/dependency\n    namespace: mynamespace\n```\n\n### Disabling namespacing\n\n```bash\n$ odm dep my_dep file:/path/to/dependency --no-namespace\n```\n\nIn `opa.project`:\n\n```yaml\ndependencies:\n  my_dep: \n    path: file:/path/to/dependency\n    namespace: false\n```\n\n## The `opa.project` file\n\nThe `opa.project` file is a YAML file that contains the project configuration.\n\nExample:\n\n```yaml\nname: \u003cproject name\u003e\nsource: \u003csource path\u003e\ndependencies:\n  \u003cdependency name\u003e: \u003cdependency path\u003e\n```\n\n### Attributes\n\n| Attribute                       | Type                 | Default                 | Description                                                                                                                                                                                                 |\n|---------------------------------|----------------------|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name`                          | `string`             | none                    | The name of the project.                                                                                                                                                                                    |\n| `source`                        | `string`, `[]string` | none                    | The path to the source folder. If specified, the source directory will be automatically included in the `eval` and `test` commands. Can either be the path of a single directory, or a list of directories. |\n| `tests`                         | `string`, `[]string` | none                    | The path to the test folder. If specified, the test directory will be automatically included in the `test` command. Can either be the path of a single directory, or a list of directories.                 |\n| `dependencies`                  | `map`                |                         | A map of dependency declaration, keyed by their name.                                                                                                                                                       |\n| `dependencies.\u003cname\u003e`           | `map`, `string`      | none                    | A dependency declaration. A short form is supported, where the dependency value is its location as a string.                                                                                                |\n| `dependencies.\u003cname\u003e.location`  | `string`             | none                    | The location of the dependency.                                                                                                                                                                             |\n| `dependencies.\u003cname\u003e.namespace` | `string`, `bool`     | `true`                  | If a `string`: the namespace to use for the dependency.  If a `bool`: if `true`, use the dependency `name` as namespace; if `false`, don't namesapace the dependency.                                       |\n| `build`                         | `map`                |                         | Settings for building bundles.                                                                                                                                                                              |\n| `build.output`                  | `string`             | `./build/bundle.tar.gz` | The location of the target bundle.                                                                                                                                                                          |\n| `build.target`                  | `string`             | `rego`                  | The target bundle format. E.g. `rego`, `wasm`, or `plan`                                                                                                                                                    |\n| `build.entrypoints`             | `[]string`           | `[]`                    | List of entrypoints.                                                                                                                                                                                        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanfylling%2Fopa-dependency-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohanfylling%2Fopa-dependency-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanfylling%2Fopa-dependency-manager/lists"}