|
1 | 1 | # Python Gazelle plugin |
2 | 2 |
|
3 | | -[Gazelle](https://github.com/bazelbuild/bazel-gazelle) |
4 | | -is a build file generator for Bazel projects. It can create new BUILD.bazel files for a project that follows language conventions, and it can update existing build files to include new sources, dependencies, and options. |
| 3 | +:::{note} |
| 4 | +The gazelle plugin docs are being migrated to our primary documentation on |
| 5 | +ReadTheDocs. Please see https://rules-python.readthedocs.io/gazelle/docs/index.html. |
| 6 | +::: |
5 | 7 |
|
6 | | -Gazelle may be run by Bazel using the gazelle rule, or it may be installed and run as a command line tool. |
7 | | - |
8 | | -This directory contains a plugin for |
9 | | -[Gazelle](https://github.com/bazelbuild/bazel-gazelle) |
10 | | -that generates BUILD files content for Python code. When Gazelle is run as a command line tool with this plugin, it embeds a Python interpreter resolved during the plugin build. |
11 | | -The behavior of the plugin is slightly different with different version of the interpreter as the Python `stdlib` changes with every minor version release. |
12 | | -Distributors of Gazelle binaries should, therefore, build a Gazelle binary for each OS+CPU architecture+Minor Python version combination they are targeting. |
13 | | - |
14 | | -The following instructions are for when you use [bzlmod](https://docs.bazel.build/versions/5.0.0/bzlmod.html). |
15 | | -Please refer to older documentation that includes instructions on how to use Gazelle |
16 | | -without using bzlmod as your dependency manager. |
17 | 8 |
|
18 | 9 | ## Example |
19 | 10 |
|
@@ -153,18 +144,6 @@ gazelle( |
153 | 144 | That's it, now you can finally run `bazel run //:gazelle` anytime |
154 | 145 | you edit Python code, and it should update your `BUILD` files correctly. |
155 | 146 |
|
156 | | -## Usage |
157 | | - |
158 | | -Gazelle is non-destructive. |
159 | | -It will try to leave your edits to BUILD files alone, only making updates to `py_*` targets. |
160 | | -However it will remove dependencies that appear to be unused, so it's a |
161 | | -good idea to check in your work before running Gazelle so you can easily |
162 | | -revert any changes it made. |
163 | | - |
164 | | -The rules_python extension assumes some conventions about your Python code. |
165 | | -These are noted below, and might require changes to your existing code. |
166 | | - |
167 | | -Note that the `gazelle` program has multiple commands. At present, only the `update` command (the default) does anything for Python code. |
168 | 147 |
|
169 | 148 | ### Directives |
170 | 149 |
|
|
0 commit comments