{"id":13450813,"url":"https://github.com/tuomasr/pazel","last_synced_at":"2025-08-11T04:04:32.567Z","repository":{"id":31758170,"uuid":"128809192","full_name":"tuomasr/pazel","owner":"tuomasr","description":"pazel - generate Bazel BUILD files for Python","archived":false,"fork":false,"pushed_at":"2023-06-06T04:30:15.000Z","size":60,"stargazers_count":41,"open_issues_count":10,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-09T17:06:15.006Z","etag":null,"topics":["bazel","code-generation","programmable","python","python-script"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuomasr.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-04-09T17:26:30.000Z","updated_at":"2025-05-23T13:57:19.000Z","dependencies_parsed_at":"2024-04-06T03:32:19.114Z","dependency_job_id":"624cfb22-4f30-4261-a175-87a483cf463c","html_url":"https://github.com/tuomasr/pazel","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"7109fe565aa50d15ec6de1b6f0bae5ac06a28a3a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tuomasr/pazel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuomasr%2Fpazel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuomasr%2Fpazel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuomasr%2Fpazel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuomasr%2Fpazel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuomasr","download_url":"https://codeload.github.com/tuomasr/pazel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuomasr%2Fpazel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268099777,"owners_count":24196101,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bazel","code-generation","programmable","python","python-script"],"created_at":"2024-07-31T07:00:38.816Z","updated_at":"2025-08-11T04:04:32.538Z","avatar_url":"https://github.com/tuomasr.png","language":"Python","funding_links":[],"categories":["Tooling"],"sub_categories":["Project generators"],"readme":"# pazel - generate Bazel BUILD files for Python\n\n[![Build Status](https://travis-ci.org/tuomasr/pazel.svg?branch=master)](https://travis-ci.org/tuomasr/pazel)\n\n## Requirements\n\n### pazel\nNo requirements. Tested on Python 2.7 and 3.6 on Ubuntu 16.04 and macOS High Sierra.\n\n### Bazel\nTested on Bazel 0.11.1. All recent versions are expected to work.\n\n## Installation\n\n```\n\u003e git clone https://github.com/tuomasr/pazel.git\n\u003e cd pazel\n\u003e python setup.py install\n```\n\n## Usage\n\nNOTE: `pazel` overwrites any existing BUILD files. Please use version control or have backups of\nyour current BUILD files before using `pazel`.\n\n### Default usage with Bazel\n\nThe following example generates all BUILD files for the sample Python project in `sample_app`.\nStart from the `pazel` root directory to which the repository was cloned.\n\n```\n\u003e bazel run //pazel:app -- \u003cpazel_root_dir\u003e/sample_app -r \u003cpazel_root_dir\u003e/sample_app\n-c \u003cpazel_root_dir\u003e/sample_app/.pazelrc\nGenerated BUILD files for \u003cpazel_root_dir\u003e/sample_app.\n```\n\n### Default usage without Bazel\n\nStart from the `pazel` root directory.\n\n```\n\u003e cd sample_app\n\u003e pazel\nGenerated BUILD files for \u003cpazel_install_dir\u003e/sample_app.\n```\n\n### Testing the generated BUILD files\n\nNow, we can build, test, and run the sample project by running the following invocations in the\n`sample_app` directory, respectively.\n\n```\n\u003e bazel build\n\u003e bazel test ...\n\u003e bazel run foo:bar3\n```\n\n### Command-line options\n\n`pazel -h` shows a summary of the command-line options. Each of them is explained below.\n\nBy default, BUILD files are generated recursively for the current working directory.\nUse `pazel \u003csome_path\u003e` to generate BUILD file(s) recursively for another directory\nor for a single Python file.\n\nAll imports are assumed to be relative to the current working directory. For example,\n`sample_app/foo/bar2.py` imports from `sample_app/foo/bar1.py` using `from foo.bar1 import sample`.\nUse `pazel -r \u003csome_path\u003e` to override the path to which the imports are relative.\n\nBy default, `pazel` adds rules to install all external Python packages. If your environment has\npre-installed packages for which these rules are not required, then use `pazel -p`.\n\n`pazel` config file `.pazelrc` is read from the current working directory. Use\n`pazel -c \u003cpazelrc_path\u003e` to specify an alternative path.\n\n### Ignoring rules in existing BUILD files\n\nThe tag `# pazel-ignore` causes `pazel` to ignore the rule that immediately follows the tag in an\nexisting BUILD file. In particular, the tag can be used to skip custom rules that `pazel` does not \nhandle. `pazel` places the ignored rules at the bottom of the BUILD file. See `sample_app/foo/BUILD`\nfor an example using the tag.\n\n\n### Customizing and extending pazel\n\n`pazel` can be programmed using a `.pazelrc` Python file, which is read from the current\nworking directory or provided explicitly with `pazel -c \u003cpazelrc_path\u003e`.\n\nThe user can define variables `HEADER` and `FOOTER` to add custom header and footer to\nall BUILD files, respectively. See `sample_app/.pazelrc` and `sample_app/BUILD` for an example that\nadds the same `visibility` to all BUILD files.\n\nIf some pip package has different install name than import name, then the user\nshould define `EXTRA_IMPORT_NAME_TO_PIP_NAME` dictionary accordingly. `sample_app/.pazelrc` has\n`{'yaml': 'pyyaml'}` as an example. In addition, the user can specify local packages and their\ncorresponding Bazel dependencies using the `EXTRA_LOCAL_IMPORT_NAME_TO_DEP` dictionary.\n\nThe user can add support for custom Bazel rules by defining a new class implementing the `BazelRule`\ninterface in `pazel/bazel_rules.py` and by adding that class to `EXTRA_BAZEL_RULES` list in\n`.pazelrc`. `sample_app/.pazelrc` defines a custom `PyDoctestRule` class that identifies all\ndoctests and generates custom `py_doctest` Bazel rules for them as defined in\n`sample_app/custom_rules.bzl`.\n\nIn addition, the user can implement custom rules for mapping Python imports to Bazel dependencies\nthat are not natively supported. That is achieved by defining a new class implementing the\n`InferenceImportRule` interface in `pazel/import_inference_rules.py` and by adding the class to\n`EXTRA_IMPORT_INFERENCE_RULES` list in `.pazelrc`. `sample_app/.pazelrc` defines a custom\n`LocalImportAllInferenceRule` class that generates the correct Bazel dependencies for\n`from X import *` type of imports where `X` is a local package.\n\n\n## BUILD file formatting\n\n`pazel` generates BUILD files that are nearly compatible with\n[Buildifier](https://github.com/bazelbuild/buildtools/tree/master/buildifier). Buildifier can be\napplied on `pazel`-generated BUILD files to remove the remaining differences, if needed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuomasr%2Fpazel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuomasr%2Fpazel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuomasr%2Fpazel/lists"}