Skip to content

Releases: bazelbuild/rules_python

0.32.1

13 May 06:54
9fa38df
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.32.1")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "b289b0b023c71b80f26d39476e5e2c3cf72d21cb2759bcf02638ba3cc480e9df",
    strip_prefix = "rules_python-0.32.1",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.32.1/rules_python-0.32.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "b289b0b023c71b80f26d39476e5e2c3cf72d21cb2759bcf02638ba3cc480e9df",
    strip_prefix = "rules_python-0.32.1/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.32.1/rules_python-0.32.1.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

  • fix(bcr): add mandatory gazelle bcr presubmit attrs by @aignas in #1894

Full Changelog: 0.32.0...0.32.1

0.32.0

13 May 02:14
407826a
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.32.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "f4770504f74b9ef87984224a06df35b931d35a2e695ea898102bd9df30ce4fe6",
    strip_prefix = "rules_python-0.32.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.32.0/rules_python-0.32.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "f4770504f74b9ef87984224a06df35b931d35a2e695ea898102bd9df30ce4fe6",
    strip_prefix = "rules_python-0.32.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.32.0/rules_python-0.32.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

  • chore(examples/bzlmod): bump deps to use wheels on linux_x86_64 by @aignas in #1758
  • test(bzlmod): make the check for hub repo naming less strict by @aignas in #1757
  • internal: support repo prefixes and config settings in alias rendering by @aignas in #1756
  • build(deps): bump certifi from 2022.12.7 to 2023.7.22 in /examples/pip_parse by @dependabot in #1374
  • build(deps): bump certifi from 2022.12.7 to 2023.7.22 in /examples/bzlmod_build_file_generation by @dependabot in #1378
  • build(deps): bump certifi from 2022.12.7 to 2023.7.22 in /tools/publish by @dependabot in #1377
  • build(deps): bump jinja2 from 3.0.3 to 3.1.3 in /tests/integration/pip_repository_entry_points by @dependabot in #1684
  • docs(getting-started): fix link to python-build-standalone quirks by @mattnworb in #1771
  • fix(internal): correctly template error message in repository rules by @jesses-canva in #1779
  • docs(gazelle): Add details about python_root directive. by @dougthor42 in #1782
  • chore: add python 3.12.2, 3.11.8 toolchain by @trentontrees in #1781
  • feat(gazelle): Add "python_visibility" directive that appends additional visibility labels by @dougthor42 in #1784
  • build(internal_deps): Update 'maintained by' comments to be correct by @dougthor42 in #1794
  • docs: Update notice about rctx.getenv on Bazel 7 by @vonschultz in #1797
  • docs(changelog) Update changelog from PR #1784 by @dougthor42 in #1802
  • docs: Add some missing attribute docs by @rickeylev in #1805
  • chore: update coveragepy to 7.4.3 by @oxidase in #1798
  • feat(gazelle): Add "python_default_visibility" directive by @dougthor42 in #1787
  • internal(config_settings): make config_setting creation reusable by @aignas in #1750
  • fix(whl_library): correctly parse wheel target platforms by @aignas in #1811
  • cleanup: Remove uses of legacy struct providers by @comius in #1812
  • feat: Make Sphinx integration experimental publicly visible by @castler in #1813
  • fix(gazelle): Do not create invalid py_test rules in project generation mode by @amartani in #1809
  • fix(internal): add WORKSPACE.bzlmod to ensure dependency separation by @aignas in #1806
  • feat: Add support for python-wheel data directory by @BradHolmes in #1801
  • feat(twine): support 'bzlmod' users out of the box by @aignas in #1572
  • fix(whl_library): only add group machinery when it is needed by @aignas in #1822
  • feat(toolchains): Add armv7 linux platform to available toolchain platforms by @UebelAndre in #1770
  • fix(bzlmod): allow users using X.Y.Z python_version in pip.parse by @aignas in #1830
  • feat: Allow additional tools for sphinx_docs by @castler in #1831
  • feat(gazelle): Add "python_test_file_pattern" directive by @dougthor42 in #1819
  • docs: Add basic docs for using credential helper with Bazel downloader of python packages by @dougthor42 in #1834
  • fix(gazelle): Consistent substitution pattern for python_default_visibility directive by @dougthor42 in #1835
  • refactor: toolchainize py_proto_library by @thesayyn in #1577
  • fix: using thread pool on macOS by @linzhp in #1861
  • refactor: Run isort and black on all python files by @dougthor42 in #1859
  • build(deps): Bump pip tools to >= 7.4.0 by @dougthor42 in #1841
  • feat(bzlmod): add a flag to control if the parallel downloading is used by @aignas in #1854
  • docs: document how to configure MODULE.bazel for different use cases by @rickeylev in #1864
  • docs: Fix link to toolchain configuration doc in side bar by @rickeylev in #1866
  • refactor: use bazel-skylib for creating hub repo aliases by @aignas in #1855
  • deps: load cc symbols from @rules_cc by @martis42 in #1852
  • feat(pip_parse): support referencing dependencies to packages via hub by @aignas in #1856
  • feat(gazelle): Add "include_dep" Python comment annotation by @dougthor42 in #1863
  • Fix typo in changelog text from #1863 by @dougthor42 in #1889
  • build(deps): bump jinja2 from 3.1.3 to 3.1.4 in /docs/sphinx by @dependabot in #1884
  • build(deps): bump jinja2 from 3.1.3 to 3.1.4 in /examples/pip_parse by @dependabot in #1882
  • build(deps): bump idna from 3.4 to 3.7 in /examples/pip_repository_annotations by @dependabot in #1847
  • build(deps): bump jinja2 from 3.1.3 to 3.1.4 in /tests/integration/pip_repository_entry_points by @dependabot in #1880
  • build(deps): bump idna from 3.3 to 3.7 in /tests/integration/pip_repository_entry_points by @dependabot in #1846
  • build(deps): bump idna from 3.6 to 3.7 in /docs/sphinx by @dependabot in #1851
  • fix(whl_library): stop duplicating deps in whl_library by @aignas in #1874
  • chore: bump toolchain versions by @aignas in #1878
  • chore: release notes for 0.32.0 by @rickeylev in #1893

New Contributors

Full Changelog: 0.31.0...0.32.0

0.31.0

13 Feb 04:57
5f51a44
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.31.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311",
    strip_prefix = "rules_python-0.31.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311",
    strip_prefix = "rules_python-0.31.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

This release is the same as 0.30.0, except the rules_python implementation of the rules is enabled for Bazel 7. Earlier Bazel versions are unaffected. If you encounter issues, please report them! The rules_python implementation can be disabled by any of the following:

  • Setting RULES_PYTHON_ENABLE_PYSTAR=0 in your environment or using --action_env
  • Downgrading to 0.30.0

Below is a list of commits:

  • feat: enable rules_python Starlark implemention by default for Bazel 7+ by @rickeylev in #1699
  • chore: Update changelog for 0.31.0 by @rickeylev in #1754

Full Changelog: 0.30.0...0.31.0

0.30.0

12 Feb 23:23
f1d1732
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.30.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "3b8b4cdc991bc9def8833d118e4c850f1b7498b3d65d5698eea92c3528b8cf2c",
    strip_prefix = "rules_python-0.30.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.30.0/rules_python-0.30.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "3b8b4cdc991bc9def8833d118e4c850f1b7498b3d65d5698eea92c3528b8cf2c",
    strip_prefix = "rules_python-0.30.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.30.0/rules_python-0.30.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

  • feat(py_wheel): Added requires_file and extra_requires_files attrs by @UebelAndre in #1710
  • refactor: move bzl tests from pip_install to //tests by @aignas in #1716
  • fix: make windows ignore pycs in runtime by @rickeylev in #1715
  • fix: fix launching Python 3.11 from <3.8 on macOS by @armandomontanez in #1709
  • fix(bzlmod): do not fail pip.parse with empty requirements.txt by @aignas in #1718
  • fix(py_wheel): Fix parsing errors with requires_file attribute. by @UebelAndre in #1719
  • feat: expose runtime's shared libraries through toolchain by @rickeylev in #1717
  • feat: support parsing whl METADATA on any python version by @aignas in #1693
  • refactor: provide more detailed error message when wheel installer fails by @rickeylev in #1724
  • chore: add python 3.11.7, 3.12.1 toolchain by @trentontrees in #1725
  • feat(toolchain): support specifying x.y versions in transitions by @aignas in #1720
  • Ensure regular file bit set in wheel archives by @lamcw in #1731
  • feat: Add support for envsubst in extra_pip_args by @vonschultz in #1673
  • feat: add debug logging of repo sub processes by @rickeylev in #1735
  • test: config_settings matching latest minor versions by @aignas in #1738
  • fix(coverage): generating lcov was causing issues by @trentontrees in #1734
  • fix(coverage) add coverage support for python 3.12 by @trentontrees in #1727
  • build(deps): bump cryptography from 39.0.0 to 41.0.6 in /tools/publish by @dependabot in #1581
  • fix(toolchain): symlink all toolchain files for the host toolchain by @aignas in #1745
  • feat(gazelle): Remove integrity field from Gazelle manifest by @adzenith in #1666
  • fix(PyRuntimeInfo): use builtin PyRuntimeInfo unless pystar is enabled. by @rickeylev in #1748
  • tests(cclibs): Basic test that the current_py_cc_libs target works by @rickeylev in #1749
  • chore: Update changelog for 0.30.0 release by @rickeylev in #1752
  • tests(bcr): Set Bazel version in BCR presubmit config. by @rickeylev in #1753

New Contributors

Full Changelog: 0.29.0...0.30.0

0.29.0

22 Jan 20:20
1fd2d7d
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.29.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "d71d2c67e0bce986e1c5a7731b4693226867c45bfe0b7c5e0067228a536fc580",
    strip_prefix = "rules_python-0.29.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.29.0/rules_python-0.29.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "d71d2c67e0bce986e1c5a7731b4693226867c45bfe0b7c5e0067228a536fc580",
    strip_prefix = "rules_python-0.29.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.29.0/rules_python-0.29.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

For a human friendly description, see the changelog at: https://github.com/bazelbuild/rules_python/blob/main/CHANGELOG.md

Below is a list of commits

  • fix: Fix per-file config interaction with one py_binary per main by @adzenith in #1664
  • refactor(pip_install): make the API surface of deps parsing smaller by @aignas in #1657
  • feat(toolchain, pip.parse): introduce a new '_host' toolchain repo by @aignas in #1644
  • feat(runfiles): Add static methods to Runfiles class to simplify interface by @UebelAndre in #1656
  • chore!: remove incompatible_generate_aliases and related flags by @aignas in #1567
  • chore/fix!: remove incompatible whl packaging flags by @aignas in #1569
  • feat: add interpreter_version_info to py_runtime by @mattem in #1671
  • build(deps): bump jinja2 from 3.1.2 to 3.1.3 in /examples/pip_parse by @dependabot in #1686
  • build(deps): bump jinja2 from 3.1.2 to 3.1.3 in /docs/sphinx by @dependabot in #1688
  • chore: remove MODULE.bazel.lock and ignore it by @aignas in #1680
  • build(deps): bump jinja2 from 3.1.2 to 3.1.3 in /examples/bzlmod by @dependabot in #1687
  • fix: ignore_root_user_error should be taken from root module only by @shabanzd in #1662
  • refactor(internal): simplify and cleanup dependency resolution by @aignas in #1691
  • test: don't force bzlmod example to use Bazel 6.0 by @rickeylev in #1695
  • feat(config_settings): allow matching minor version of python_version flag by @dizzy57 in #1555
  • build(deps): bump certifi from 2022.12.7 to 2023.7.22 in /examples/bzlmod by @dependabot in #1379
  • internal(pystar): Only respect RULES_PYTHON_ENABLE_PYSTAR env var for Bazel 7+ by @rickeylev in #1698
  • fix(bzlmod): use X.Y select for the hub repo by @aignas in #1696
  • internal: update native deps and linkstamp API updates to Bazel rolling APIs by @rickeylev in #1697
  • refactor: broaden visibility and use list() instead of keys() by @rickeylev in #1704
  • test: workaround cyclic dependency bzlmod bug by disabling lockfiles by @rickeylev in #1705
  • docs: Update gazelle/README.md to fix package_name formatting by @michael-christen in #1712
  • chore: update changelog for 0.29.0 release by @rickeylev in #1714

New Contributors

Full Changelog: 0.28.0...0.29.0

0.28.0

08 Jan 23:43
231d3f6
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.28.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "d70cd72a7a4880f0000a6346253414825c19cdd40a28289bdf67b8e6480edff8",
    strip_prefix = "rules_python-0.28.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.28.0/rules_python-0.28.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "d70cd72a7a4880f0000a6346253414825c19cdd40a28289bdf67b8e6480edff8",
    strip_prefix = "rules_python-0.28.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.28.0/rules_python-0.28.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

For a human friendly overview of changes, see https://rules-python.readthedocs.io/en/latest/changelog.html

Below is a list of commits.

  • pystar: support builtin providers for compatibility by @rickeylev in #1573
  • feat: use rules_python implemented py_runtime, py_runtime_pair, PyRuntimeInfo by @rickeylev in #1574
  • feat(pip_repository): Support pip parse cycles by @arrdem in #1166
  • cleanup: delete extraneous report.txt file by @rickeylev in #1587
  • docs: fix crossrefs and allow function parameters to be referenced by @rickeylev in #1585
  • docs(pip_parse): Update docs about experimental_requirement_cycles by @mishazharov in #1588
  • docs: update docs deps to latest versions by @rickeylev in #1586
  • fix(gazelle): ensure that gazelle helper modules are on PYTHONPATH by @aignas in #1590
  • doc: add a py_proto_library example with well-known-types by @aignas in #1571
  • examples(pip_parse): fix circular deps with sphinx by breaking cycles by @rickeylev in #1596
  • ci(example): provide a specific requirements.txt on windows by @aignas in #1605
  • feat: Creating one py_binary per main module by @linzhp in #1584
  • feat(whl_library): generate platform-specific dependency closures by @aignas in #1593
  • feat: keep main module in py_library by @linzhp in #1608
  • fix(py_runtime): make py_runtime_pair return builtin PyRuntimeInfo under Bazel 6; make python_bootstrap_template public by @rickeylev in #1611
  • fix: use rules_python's py_runtime in generated toolchains by @rickeylev in #1604
  • chore: Update Bazel support: drop 5, minimum 6.2, current 7.0 by @rickeylev in #1613
  • docs: update pip.parse example in release notes by @keith in #1616
  • docs: include changelog and contributing page in generated docs. by @rickeylev in #1617
  • fix(pip.parse): allow absolute path for python_interpreter; skip hermetic toolchain lookup when used by @rickeylev in #1619
  • fix: trimming deps in py_binary by @linzhp in #1614
  • doc: switch to pypi.org by @aignas in #1622
  • refactor: extract auth.bzl out of repositories.bzl by @aignas in #1627
  • internal: support setting visibility when rendering aliases by @aignas in #1626
  • fix(bzlmod pip.parse): allow requirements with duplicate package lines by @rickeylev in #1620
  • pycross: Add patching support to py_wheel_library by @philsc in #1436
  • test(bzlmod): refactor tests to not depend on implementation details by @aignas in #1628
  • docs: use stardoc proto output to generate markdown docs by @rickeylev in #1629
  • doc: Updating doc on py_binary generation by @linzhp in #1635
  • fix(gazelle): init.py in per-file targets by @siddharthab in #1582
  • chore: fix sphinx requirements by @aignas in #1648
  • docs: document support policies by @rickeylev in #1640
  • fix(whl_library): actually apply patches and warn if RECORD file patch is needed by @aignas in #1637
  • fix: missing dependencies of py_binary by @linzhp in #1630
  • chore!: remove pip_install macro and cleanup docs by @aignas in #1570
  • chore: enable bzlmod by default (for Bazel 6) by @rickeylev in #1632
  • build(deps): bump pygments from 2.11.2 to 2.15.0 in /tests/integration/pip_repository_entry_points by @dependabot in #1650
  • fix(coverage): add test attributes in transition module by @tanan in #1649
  • refactor(whl_library): reimplement wheel platform parsing in starlark by @aignas in #1636
  • feat(runfiles): Added type hints to @rules_python//python/runfiles by @UebelAndre in #1654
  • fix(bzlmod): allow modules to register the same toolchain as rules_python's default by @rickeylev in #1642
  • build(deps): bump setuptools from 59.6.0 to 65.5.1 in /tests/integration/pip_repository_entry_points by @dependabot in #1652
  • build(deps): bump requests from 2.27.1 to 2.31.0 in /tests/integration/pip_repository_entry_points by @dependabot in #1651
  • cleanup(dev): remove remnants of old bazel_integration_test code by @rickeylev in #1668
  • chore: Migrate to rules_bazel_integration_test by @philsc in #1598
  • fix(toolchains): register py cc toolchain for workspace builds by @rickeylev in #1670
  • feat(py_runtime): Allow py_runtime to take an executable target as the interpreter by @mishazharov in #1621
  • docs: update changelog for 0.28.0 release by @rickeylev in #1672

New Contributors

Full Changelog: 0.27.0...0.28.0

0.22.1

19 Dec 21:38
Compare
Choose a tag to compare

This is a patch release of 0.22.0 that automatically registers the @bazel_tools//tools/python:autodetecting_toolchain toolchain.

See bazelbuild/bazel#20458 for more information.

Using Bzlmod with Bazel 6

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.22.1")

pip = use_extension("@rules_python//python:extensions.bzl", "pip")

pip.parse(
    name = "pip",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

# (Optional) Register a specific python toolchain instead of using the host version
python = use_extension("@rules_python//python:extensions.bzl", "python")

python.toolchain(
    name = "python3_9",
    python_version = "3.9",
)

use_repo(python, "python3_9_toolchains")

register_toolchains(
    "@python3_9_toolchains//:all",
)

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "a5640fddd4beb03e8c1fde5ed7160c0ba6bd477e7d048661c30c06936a26fd63",
    strip_prefix = "rules_python-0.22.1",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.22.1/rules_python-0.22.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "a5640fddd4beb03e8c1fde5ed7160c0ba6bd477e7d048661c30c06936a26fd63",
    strip_prefix = "rules_python-0.22.1/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.22.1/rules_python-0.22.1.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

Full Changelog: 0.22.0...0.22.1

0.27.1

05 Dec 00:08
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.27.1")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    name = "pip",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
    strip_prefix = "rules_python-0.27.1",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
    strip_prefix = "rules_python-0.27.1/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

Full Changelog: 0.27.0...0.27.1

0.27.0

17 Nov 20:58
cde1b52
Compare
Choose a tag to compare

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.27.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    name = "pip",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "9acc0944c94adb23fba1c9988b48768b1bacc6583b52a2586895c5b7491e2e31",
    strip_prefix = "rules_python-0.27.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "9acc0944c94adb23fba1c9988b48768b1bacc6583b52a2586895c5b7491e2e31",
    strip_prefix = "rules_python-0.27.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.0/rules_python-0.27.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

See CHANGELOG 0.27.0 for
a human friendly description of what has changed. Below are an overview of commits.

  • chore: bump the CHANGELOG.md by @aignas in #1467
  • docs: document a breaking changes policy by @rickeylev in #1460
  • internal: add stub register_extension_name to make patching easier by @rickeylev in #1475
  • docs(gazelle): Update README.md for gazelle by @jsharpe in #1454
  • doc(bzlmod): bump stardoc to 0.6.2 and enable bzlmod docs building by @aignas in #1476
  • refactor(bzlmod): move bzlmod code to private/bzlmod by @aignas in #1477
  • test: use a custom rule instead of native.filegroup for testing that PyInfo is a required provider. by @rickeylev in #1479
  • docs: Fix a few typos in various docs and comments by @rickeylev in #1480
  • fix(repo setup): Skip aliases for unloaded toolchains by @kilian-funk in #1473
  • Disable Bzlmod explicitly in .bazelrc by @meteorcloudy in #1470
  • test(bzlmod): Make some tests bzlmod compatible with Bazel@HEAD by @rickeylev in #1482
  • docs: Fix URL in README.md by @dshahbaz in #1483
  • docs: allow manual edits to generated docs by @aignas in #1478
  • fix: allowing to import code generated from proto with strip_import_prefix by @linzhp in #1406
  • fix(examples): bump gazelle in examples/build_file_generation by @OliverFM in #1421
  • refactor(visibility)!: limit visibility of an internal library by @aignas in #1490
  • ci: pin pystar bazel version by @aignas in #1497
  • fix(py_wheel): produce deterministic wheel files by @dizzy57 in #1453
  • build(gazelle): embed Python zip file by @linzhp in #1485
  • refactor(whl_library): split wheel downloading and extraction into separate executions by @aignas in #1487
  • feat(whlmaker): introduce an internal _WhlFile class and stop sorting RECORD by @aignas in #1488
  • test: remove usage of deprecated method TestCase.assertEquals by @dizzy57 in #1494
  • docs: Fix typo in comment by @jjwatt in #1408
  • docs: initial doc generation using Sphinx by @rickeylev in #1489
  • test(bzlmod): support toolchain tests on bzlmod by @aignas in #1507
  • build(deps): bump urllib3 from 1.26.13 to 1.26.18 in /examples/bzlmod by @dependabot in #1505
  • build(deps): bump urllib3 from 1.26.7 to 1.26.18 in /tests/pip_repository_entry_points by @dependabot in #1500
  • build(deps): bump urllib3 from 1.26.14 to 1.26.18 in /tools/publish by @dependabot in #1499
  • build(deps): bump urllib3 from 1.26.13 to 1.26.18 in /examples/pip_parse by @dependabot in #1501
  • build(deps): bump urllib3 from 1.26.17 to 1.26.18 in /examples/pip_repository_annotations by @dependabot in #1502
  • chore!: disable pip_install and remove from examples and tests by @aignas in #1510
  • docs: make readthedocs render a bit nicer and port docs over to Sphinx by @rickeylev in #1511
  • feat(bzlmod): support patching 'whl' distributions by @aignas in #1393
  • chore!: switch py_wheel flags to True to start enforcing PEP440 by @aignas in #1513
  • refactor!: do not use a wrapper macro for pip_parse by @aignas in #1514
  • build(deps): bump requests from 2.28.2 to 2.31.0 in /docs/sphinx by @dependabot in #1512
  • build(deps): bump urllib3 from 1.26.15 to 1.26.18 in /docs/sphinx by @dependabot in #1508
  • build(deps): bump certifi from 2022.12.7 to 2023.7.22 in /docs/sphinx by @dependabot in #1509
  • internal(pystar): use rules_python PyCcLinkParamsProvider if pystar is enabled by @rickeylev in #1517
  • ci: don't run minimum bazel version tests as part of bazel downstream… by @rickeylev in #1522
  • docs: show PR warning banner and fix links doc source pages by @rickeylev in #1521
  • tests: make multi_python_verions example bzlmod compatible by @rickeylev in #1523
  • test: make compile_pip_requirements work with bzlmod enabled by @rickeylev in #1526
  • tests: explicitly disable bzlmod for pip_repository_entry_points test by @rickeylev in #1527
  • tests: explicitly disable bzlmod for pip_parse_vendored example by @rickeylev in #1529
  • chore(pip_parse, gazelle): generate/use hub repo aliases by default by @aignas in #1525
  • test: make compile_pip_requirements_test_from_external_workspace work with bzlmod by @rickeylev in #1528
  • tests: make pip_parse example work with bzlmod enabled by @rickeylev in #1524
  • refactor: use click in dependency_resolver.py by @cj81499 in #1071
  • cleanup(pystar): inline @bazel_tools and @platforms references by @rickeylev in #1531
  • cleanup: delete defunct load of bzlmod pip_repository by @rickeylev in #1533
  • feat(pip): provide pypi -> whl target mapping in requirements.bzl by @alexeagle in #1532
  • feat: support pyproject.toml in compile_pip_requirements by @aignas in #1519
  • cleanup: delete commented out line forgottenly left in by @rickeylev in #1535
  • fix(gazelle): generate a single py_test for coarse_grained setups by @aignas in #1538
  • tests: disable bzlmod for workspace-only pip_repository_annotations example by @rickeylev in #1540
  • tests: disable bzlmod for workspace-only build_file_generation example by @rickeylev in #1539
  • fix: always ignore .pyc.NNNN files from the hermetic runtime tree by @rickeylev in #1541
  • chore(wheelmaker): drop Python 2 support by @aignas in #1545
  • test(pystar): run pystar under Windows and Mac by @rickeylev in #1547
  • test(gazelle): have a go_test target for each gazelle test by @aignas in #1537
  • feat: expose 'pip_utils.normalize_name' function by @aignas in https://github.co...
Read more

0.26.0

06 Oct 06:40
fe33a45
Compare
Choose a tag to compare

Changed in this release

  • Python version patch level bumps:

    • 3.8.15 -> 3.8.18
    • 3.9.17 -> 3.9.18
    • 3.10.12 -> 3.10.13
    • 3.11.4 -> 3.11.6
  • (deps) Upgrade rules_go 0.39.1 -> 0.41.0; this is so gazelle integration works with upcoming Bazel versions

  • (multi-version) The distribs attribute is no longer propagated. This attribute has been long deprecated by Bazel and shouldn't be used.

  • Calling //python:repositories.bzl#py_repositories() is required. It has always been documented as necessary, but it was possible to omit it in certain cases. An error about @rules_python_internal means the py_repositories() call is missing in WORKSPACE.

  • (bzlmod) The pip.parse extension will generate os/arch specific lock file entries on bazel>=6.4.

Removed in this release

  • (bzlmod) The entry_point macro is no longer supported and has been removed in favor of the py_console_script_binary macro for bzlmod users.
  • (bzlmod) The pip.parse no longer generates {hub_name}_{py_version} hub repos as the entry_point macro has been superseded by py_console_script_binary.
  • (bzlmod) The pip.parse no longer generates {hub_name}_{distribution} hub repos.

Added in this release

  • (bzlmod, entry_point) Added py_console_script_binary, which allows adding custom dependencies to a package's entry points and customizing the py_binary rule used to build it.
  • New Python versions available: 3.8.17, 3.11.5 using
    https://github.com/indygreg/python-build-standalone/releases/tag/20230826.
  • (gazelle) New # gazelle:python_generation_mode file directive to support generating one py_library per file.
  • (python_repository) Support netrc and auth_patterns attributes to enable authentication against private HTTP hosts serving Python toolchain binaries.
  • //python:packaging_bzl added, a bzl_library for the Starlark files //python:packaging.bzl requires.
  • (py_wheel) Added the incompatible_normalize_name feature flag to normalize the package distribution name according to latest Python packaging standards. Defaults to False for the time being.
  • (py_wheel) Added the incompatible_normalize_version feature flag to normalize the package version according to PEP440 standard. This also adds support for local version specifiers (versions with a + in them), in accordance with PEP440. Defaults to False for the time being.
  • New Python versions available: 3.8.18, 3.9.18, 3.10.13, 3.11.6, 3.12.0 using https://github.com/indygreg/python-build-standalone/releases/tag/20231002. 3.12.0 support is considered beta and may have issues.

Fixed in this release

  • (whl_library) No longer restarts repository rule when fetching external dependencies improving initial build times involving external dependency fetching.
  • (gazelle) Improve runfiles lookup hermeticity.

Using Bzlmod with Bazel 6

NOTE: bzlmod support is still beta. APIs subject to change.

Add to your MODULE.bazel file:

bazel_dep(name = "rules_python", version = "0.26.0")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

pip.parse(
    name = "pip",
    requirements_lock = "//:requirements_lock.txt",
)

use_repo(pip, "pip")

Using WORKSPACE

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "rules_python",
    sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
    strip_prefix = "rules_python-0.26.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

Gazelle plugin

Paste this snippet into your WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_python_gazelle_plugin",
    sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b",
    strip_prefix = "rules_python-0.26.0/gazelle",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.26.0/rules_python-0.26.0.tar.gz",
)

# To compile the rules_python gazelle extension from source,
# we must fetch some third-party go dependencies that it uses.

load("@rules_python_gazelle_plugin//:deps.bzl", _py_gazelle_deps = "gazelle_deps")

_py_gazelle_deps()

What's Changed

  • doc: Note Python version changes in CHANGELOG by @rickeylev in #1391
  • fix: bcr releaser email by @f0rmiga in #1392
  • Adding kwargs to gazelle_python_manifest by @linzhp in #1289
  • docs: Use correct link to build badge image and build status page. by @rickeylev in #1390
  • feat(py_console_script_binary)!: entry points with custom dependencies by @aignas in #1363
  • fix(whl_library): avoid unnecessary repository rule restarts by @aignas in #1400
  • refactor: add missing //python/config_settings/private:distribution target by @philsc in #1402
  • Import pycross_wheel_library by @philsc in #1403
  • refactor: upgrade certifi by @cflewis in #1397
  • fix: don't set distribs in version transitioning rule by @comius in #1412
  • fix(gazelle): upgrade rules_go: 0.39.1 -> 0.41.0 to work with upcoming Bazel versions by @sgowroji in #1410
  • fix: gazelle: Fix non-hermetic runfiles lookup by @fmeum in #1415
  • feat: create toolchain type for py_proto_library by @comius in #1416
  • internal: copy Starlark rule implementation from Bazel by @rickeylev in #1418
  • feat: add new Python toolchain versions by @aignas in #1414
  • internal(pystar): make starlark impl (mostly) loadable by @rickeylev in #1422
  • feat: generate py_library per file by @raylu in #1398
  • chore: bump default python versions by @aignas in #1425
  • feat: Support netrc-based authentication for python_repository rule by @LINKIWI in #1417
  • refactor(pystar): load (but don't use) Starlark implementation. by @rickeylev in #1428
  • fix(gazelle): runfiles discovery by @aignas in #1429
  • feat, refactor(pystar): bzl_library for packaging.bzl; fix pystar doc building and py_wheel by @rickeylev in #1432
  • refactor(toolchain): use a helper method to convert an X.Y version to X.Y.Z by @aignas in #1423
  • pycross: Rename pycross_wheel_library and make it work by @philsc in #1413
  • fix: Skip printing unneccesary warning. by @matts1 in #1407
  • refactor(bzlmod)!: simplify pip.parse repository layout by @aignas in #1395
  • feat(bzlmod): mark pip extension as os/arch dependent by @aignas in #1433
  • chore: bump internal_deps by @aignas in #1322
  • tests(pystar): CI configs that uses Starlark implementation of rules by @rickeylev in #1435
  • internal(pystar): Copy @bazel_tools//tools/python files to rules_python by @rickeylev in #1437
  • internal(pystar): Make py_runtime_pair and autodetecting toolchain mostly loadable. by @rickeylev in #1439
  • tests: Move base rule tests under tests instead of //tools/build_defs/python by @rickeylev in #1440
  • tests(pystar): py_runtime_pair and py_runtime analysis tests by @rickeylev in #1441
  • fix(pystar): Use py_internal for runfiles_enabled, declare_shareable_artifact, share_native_deps by @rickeylev in #1443
  • build(deps): bump urllib3 from 1.26.13 to 1.26.17 in /examples/pip_repository_annotations by @dependabot in #1447
  • build(deps): bump urllib3 from 1.25.11 to 1.26.17 in /examples/pip_install by @dependabot in #1444
  • fix: add missing @bazel_tools files to bzl_library dependencies. by @rickeylev in #1457
  • tests(pystar): add analysis tests to cover basic windows building by @rickeylev in #1452
  • docs: move dependency management into respective bzl packages by @rickeylev in #1459
  • feat(py_wheel): Normalize name and version by @vonschultz in #1331
  • chore: add new Python toolchains from indygreg by @aignas in #1461

New Contributors

Read more