build(deps): bump black from 26.5.1 to 26.10.1 in /tests/uv/lock/workspaces in the uv group across 1 directory (#4336) Bumps the uv group with 1 update in the /tests/uv/lock/workspaces directory: [black](https://github.com/psf/black). Updates `black` from 26.5.1 to 26.10.1 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/psf/black/releases">black's releases</a>.</em></p> <blockquote> <h2>26.10.1</h2> <h3>Highlights</h3> <p>This release fixes a security issue in Black's bundled GitHub Action. Repositories that use the action are encouraged to update to the latest version of Black immediately. This update is received automatically when using <code>psf/black@stable</code>, and is independent of the version of Black installed by the action.</p> <p>When the GitHub Action reads version specifiers from <code>tool.black.required-version</code>, it now only accepts released versions of Black, as it already did for <code>black</code> requirements in dependency lists. Other values, such as URL references, are now rejected. This issue has been registered as <code>GHSA-cg8m-r9f2-5wm2</code>; a CVE identifier is pending.</p> <h3>Stable style</h3> <ul> <li>Fix a long Jupyter notebook assignment magic (for example <code>x = !ls -la</code>) being wrapped in parentheses, which IPython can no longer run; such cells are now left unchanged (<a href="https://redirect.github.com/psf/black/issues/5481">#5481</a>)</li> <li>Keep repeated lines outside the selected <code>--line-ranges</code> unchanged (<a href="https://redirect.github.com/psf/black/issues/5436">#5436</a>)</li> <li>Fix <code>--line-ranges</code> formatting lines that follow a statement when formatting joins or re-indents that statement (<a href="https://redirect.github.com/psf/black/issues/5484">#5484</a>)</li> <li>Fix <code>--line-ranges</code> crashing with an internal error when an unselected statement has a <code># fmt: skip</code> comment on the last line before a closing bracket (<a href="https://redirect.github.com/psf/black/issues/5477">#5477</a>)</li> <li>Prevent moving an encoding declaration (for example <code># -*- coding: latin-1 -*-</code>) onto the first two lines of a file (<a href="https://redirect.github.com/psf/black/issues/5487">#5487</a>)</li> <li>Fix adding an extra trailing blank line inside a multi-line module docstring when its last line is near the line length limit (<a href="https://redirect.github.com/psf/black/issues/5494">#5494</a>)</li> </ul> <h3>Preview style</h3> <ul> <li>Do not split short expressions on delimiters (such as binary operators, comparisons, or comprehensions) inside brackets when preceded by a standalone comment (<a href="https://redirect.github.com/psf/black/issues/5455">#5455</a>)</li> <li>Fix the unstable <code>string_processing</code> feature removing backslash-newline sequences from raw strings, which changed their value (<a href="https://redirect.github.com/psf/black/issues/5482">#5482</a>)</li> <li>Avoid adding unnecessary parentheses around unbreakable right-hand side expressions in assignments (such as annotated assignments or subscript targets) (<a href="https://redirect.github.com/psf/black/issues/5473">#5473</a>)</li> <li>Parenthesize expressions with parameter comments when they exceed the line length under <code>--preview</code> (<a href="https://redirect.github.com/psf/black/issues/5442">#5442</a>)</li> <li>Fix <code>wrap_long_dict_values_in_parens</code> dropping the parentheses around a right-hand side that contains a dictionary, leaving a line over the length limit (<a href="https://redirect.github.com/psf/black/issues/5492">#5492</a>)</li> <li>Fix the unstable <code>string_processing</code> feature adding a space after <code>*</code> or <code>**</code> in a PEP 695 type parameter (<code>* Ts = ...</code>) when it splits a string in the parameter's default (<a href="https://redirect.github.com/psf/black/issues/5504">#5504</a>)</li> <li>Avoid unnecessary line splits of trailers (such as indexing/subscripts) when an earlier bracket split exceeds the line length only due to a trailing comment (<a href="https://redirect.github.com/psf/black/issues/5498">#5498</a>)</li> </ul> <h3>Configuration</h3> <ul> <li>Add <code>--cache-dir</code> to configure the cache directory from the command line (<a href="https://redirect.github.com/psf/black/issues/5433">#5433</a>)</li> <li>Don't cache a file as formatted after formatting or checking it with <code>--line-ranges</code>,</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/psf/black/blob/main/CHANGES.md">black's changelog</a>.</em></p> <blockquote> <h2>Version 26.10.1</h2> <h3>Highlights</h3> <p>This release fixes a security issue in Black's bundled GitHub Action. Repositories that use the action are encouraged to update to the latest version of Black immediately. This update is received automatically when using <code>psf/black@stable</code>, and is independent of the version of Black installed by the action.</p> <p>When the GitHub Action reads version specifiers from <code>tool.black.required-version</code>, it now only accepts released versions of Black, as it already did for <code>black</code> requirements in dependency lists. Other values, such as URL references, are now rejected. This issue has been registered as <code>GHSA-cg8m-r9f2-5wm2</code>; a CVE identifier is pending.</p> <h3>Stable style</h3> <ul> <li>Fix a long Jupyter notebook assignment magic (for example <code>x = !ls -la</code>) being wrapped in parentheses, which IPython can no longer run; such cells are now left unchanged (<a href="https://redirect.github.com/psf/black/issues/5481">#5481</a>)</li> <li>Keep repeated lines outside the selected <code>--line-ranges</code> unchanged (<a href="https://redirect.github.com/psf/black/issues/5436">#5436</a>)</li> <li>Fix <code>--line-ranges</code> formatting lines that follow a statement when formatting joins or re-indents that statement (<a href="https://redirect.github.com/psf/black/issues/5484">#5484</a>)</li> <li>Fix <code>--line-ranges</code> crashing with an internal error when an unselected statement has a <code># fmt: skip</code> comment on the last line before a closing bracket (<a href="https://redirect.github.com/psf/black/issues/5477">#5477</a>)</li> <li>Prevent moving an encoding declaration (for example <code># -*- coding: latin-1 -*-</code>) onto the first two lines of a file (<a href="https://redirect.github.com/psf/black/issues/5487">#5487</a>)</li> <li>Fix adding an extra trailing blank line inside a multi-line module docstring when its last line is near the line length limit (<a href="https://redirect.github.com/psf/black/issues/5494">#5494</a>)</li> <li>Keep the parentheses around a walrus that is the only item in a set (for example <code>{(x := f())}</code>) when targeting Python 3.9 or older, since Python 3.8 and 3.9.0 can't parse it without them (<a href="https://redirect.github.com/psf/black/issues/5502">#5502</a>)</li> </ul> <h3>Preview style</h3> <ul> <li>Do not split short expressions on delimiters (such as binary operators, comparisons, or comprehensions) inside brackets when preceded by a standalone comment (<a href="https://redirect.github.com/psf/black/issues/5455">#5455</a>)</li> <li>Fix the unstable <code>string_processing</code> feature removing backslash-newline sequences from raw strings, which changed their value (<a href="https://redirect.github.com/psf/black/issues/5482">#5482</a>)</li> <li>Avoid adding unnecessary parentheses around unbreakable right-hand side expressions in assignments (such as annotated assignments or subscript targets) (<a href="https://redirect.github.com/psf/black/issues/5473">#5473</a>)</li> <li>Parenthesize expressions with parameter comments when they exceed the line length under <code>--preview</code> (<a href="https://redirect.github.com/psf/black/issues/5442">#5442</a>)</li> <li>Fix <code>wrap_long_dict_values_in_parens</code> dropping the parentheses around a right-hand side that contains a dictionary, leaving a line over the length limit (<a href="https://redirect.github.com/psf/black/issues/5492">#5492</a>)</li> <li>Fix the unstable <code>string_processing</code> feature adding a space after <code>*</code> or <code>**</code> in a PEP 695 type parameter (<code>* Ts = ...</code>) when it splits a string in the parameter's default (<a href="https://redirect.github.com/psf/black/issues/5504">#5504</a>)</li> <li>Avoid unnecessary line splits of trailers (such as indexing/subscripts) when an earlier bracket split exceeds the line length only due to a trailing comment (<a href="https://redirect.github.com/psf/black/issues/5498">#5498</a>)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/psf/black/commit/258e7dbf348bc23cb70b8cdf693481c04634ebcc"><code>258e7db</code></a> Prepare release 26.10.1 (<a href="https://redirect.github.com/psf/black/issues/5511">#5511</a>)</li> <li><a href="https://github.com/psf/black/commit/ac1f71563aeccf73cf13ece00f231d9d6c66a514"><code>ac1f715</code></a> Action: validate required-version better (<a href="https://redirect.github.com/psf/black/issues/5510">#5510</a>)</li> <li><a href="https://github.com/psf/black/commit/fe241ccc443acbabbd75c8240d2fbc06ba4e52d6"><code>fe241cc</code></a> Avoid splitting trailers when earlier bracket split exceeds length due to com...</li> <li><a href="https://github.com/psf/black/commit/4fb2897a7ac539cc14d993e3697469e2529a265e"><code>4fb2897</code></a> Bump actions/upload-artifact from 7.0.1 to 7.0.2 (<a href="https://redirect.github.com/psf/black/issues/5500">#5500</a>)</li> <li><a href="https://github.com/psf/black/commit/6d0f5575575dfc5d51e88a3b114816640e933388"><code>6d0f557</code></a> Bump actions/download-artifact from 8.0.1 to 8.0.2 (<a href="https://redirect.github.com/psf/black/issues/5501">#5501</a>)</li> <li><a href="https://github.com/psf/black/commit/c45f21d0399747189eedcc6c9a1614b3cf49dc0f"><code>c45f21d</code></a> Handle PEP 695 type parameter whitespace in whitespace() (<a href="https://redirect.github.com/psf/black/issues/5504">#5504</a>)</li> <li><a href="https://github.com/psf/black/commit/8ec61a7fb6f1961377afd28bbe71f8a2095916ac"><code>8ec61a7</code></a> Skip UTF-8 BOM when reading .gitignore (<a href="https://redirect.github.com/psf/black/issues/5497">#5497</a>)</li> <li><a href="https://github.com/psf/black/commit/c9b1148b5b8799758756cbec7c0d1ac187d37f1a"><code>c9b1148</code></a> Fix module docstring last_line_length when docstring ends with newline (<a href="https://redirect.github.com/psf/black/issues/5494">#5494</a>)</li> <li><a href="https://github.com/psf/black/commit/eb8835829969f82c2567119f528b188769f3ac6d"><code>eb88358</code></a> Parenthesize expressions with parameter comments in preview (<a href="https://redirect.github.com/psf/black/issues/3113">#3113</a>) (<a href="https://redirect.github.com/psf/black/issues/5442">#5442</a>)</li> <li><a href="https://github.com/psf/black/commit/939fa93a1327d2a5f2829e6c1d7e4bd25a17b0f7"><code>939fa93</code></a> Keep the parentheses around a right-hand side when a dict value's parentheses...</li> <li>Additional commits viewable in <a href="https://github.com/psf/black/compare/26.5.1...26.10.1">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/bazel-contrib/rules_python/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This repository is the home of the core Python rules -- py_library, py_binary, py_test, and related symbols that provide the basis for Python support in Bazel. It also contains package installation rules for integrating with PyPI and other indices.
Documentation for rules_python is at https://rules-python.readthedocs.io and in the Bazel Build Encyclopedia.
Examples live in the examples directory.
The core rules are stable. Their implementation is subject to Bazel's backward compatibility policy. This repository aims to follow semantic versioning.
The Bazel community maintains this repository. Neither Google nor the Bazel team provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases. See How to contribute page for information on our development workflow.
requirements.txt is how users have been defining dependencies for a long time. We support this to support legacy usecases or package managers that we don't support directly. Any additional information that we need will be retrieved from the SimpleAPI during the bzlmod extension evaluation phase. Then it will be written to the MODULE.bazel.lock file for future reuse. We have plans to support uv.lock file directly. uv is recommended for generating a fully locked requirements.txt file and we do provide a rule for it.py_binary, py_test rules should scale to large monorepos and we work hard to minimize the work done during analysis and build phase. What is more, the space requirements for should be minimal, so we strive to use symlinks rather than extracting wheels at build time. This means that for different configurations of the same build, we are not extracting the wheel multiple times thus scaling better over the time. From 2.0 onwards we are creating a virtual env for each target by creating an actual minimal virtual environment using symlinks. We plan on creating the traditional site-packages layout in the future by default.rules_python and this has resulted in a few PEPs supported within pure starlark - PEP440, PEP509.Common misconceptions:
rules_python has to keep backwards compatibility with google3. Whilst this might have been true in the past, rules_python is an open source project and any compatibility needs should come from the community - we have no requirement to keep this compatibility and are allowed to make our decisions. However, we do want to keep backwards compatibility as long as possible to not upset users with never ending migrations.rules_python is not caching pip downloads. With 2.0, we use Bazel's downloader by default and rely on bazel to provide the repository caching mechanisms. This means that for simpler setups this should result in transparent and scalable caching with the most recent bazel versions unless there are issues in the bazel itself.For detailed documentation, see https://rules-python.readthedocs.io
See Bzlmod support for more details.