Releases: bazelbuild/rules_python
0.10.0
WORKSPACE setup:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "56dc7569e5dd149e576941bdb67a57e19cd2a7a63cc352b62ac047732008d7e1",
strip_prefix = "rules_python-0.10.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.10.0.tar.gz",
)
What's Changed
- feat: cc_import for libpython by @f0rmiga in #727
- pip: 22.0.4 -> 22.1.2; pip-tools: 6.6.0 -> 6.6.2 by @groodt in #718
- Fix #721. Remove self-link dependency pulled in sometimes by extras by @thundergolfer in #730
- fix: versioned shared object for libpython on Linux by @f0rmiga in #729
- Support configuration variables in py_wheel "version" attirbute. by @pstradomski in #640
- Provide current_py_toolchain by @jheaff1 in #731
- Validation to ensure requirements_lock is pinned. by @groodt in #732
- Use PEP 508 rules when setting deps from extras by @mattoberle in #724
- pip_compile: remove external/workspace_name prefix from generated requirements.txt by @BoleynSu in #690
- chore: update to Bazel 5.2.0 by @alexeagle in #736
- Remove //experimental by @groodt in #738
- Use
installer
to remove custom unzip and spread code by @groodt in #715 - More verbose 'fail' msgs. Don't rely on executed tools err msg by @thundergolfer in #737
- refactor: move all re-exports to private/reexports.bzl by @mattem in #739
- Patch pip environment with xcode sdk location. by @hrfuller in #697
New Contributors
- @mattoberle made their first contribution in #724
- @BoleynSu made their first contribution in #690
Full Changelog: 0.9.0...0.10.0
0.9.0
WORKSPACE setup:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
strip_prefix = "rules_python-0.9.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
)
What's Changed
- Fix example link in gazelle readme by @Whoaa512 in #693
- Check return code of zstd make by @jameskuszmaul-brt in #695
- Remove duplicate method invocation in entry_point generation by @thundergolfer in #696
- Add caveat about python_register_toolchain's hermeticty to README by @thundergolfer in #698
- Handle entry_points that end with .py by @groodt in #702
- Use "shared" msvc hermetic toolchain by @jheaff1 in #694
- Init: pypa/installer by @groodt in #700
- Fixed missing bzl sources from bzl filegroup by @UebelAndre in #712
- python: Update minor toolchain versions by @phlax in #707
- Made version failure message better reflect the issue by @jdob in #717
- Fix python3.8 type compatibility by @keith in #722
- pip/deps: Bump
pip-tools
-> 6.6.0 by @phlax in #692 - Remove legacy pip_import by @groodt in #726
New Contributors
- @Whoaa512 made their first contribution in #693
- @jameskuszmaul-brt made their first contribution in #695
- @jdob made their first contribution in #717
Full Changelog: 0.8.1...0.9.0
0.8.1
WORKSPACE setup:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "cdf6b84084aad8f10bf20b46b77cb48d83c319ebe6458a18e9d2cebf57807cdd",
strip_prefix = "rules_python-0.8.1",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.1.tar.gz",
)
What's Changed
- Exposed python headers from toolchains as cc_library by @UebelAndre in #666
- Fix issue #682 by @pstradomski in #685
- Allow toolchain registration to be optional by @UebelAndre in #674
- linux-arm64 python binary support by @lazcamus in #669
- bump: go from 1.17 to 1.18 by @f0rmiga in #686
- Replace host cfg with exec by @alexeagle in #688
- change approach for vendoring parsed requirements by @alexeagle in #679
- Allow for requirements files to differ per platform by @alexeagle in #531
New Contributors
Full Changelog: 0.8.0...0.8.1
0.8.0
WORKSPACE setup:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "9fcf91dbcc31fde6d1edb15f117246d912c33c36f44cf681976bd886538deba6",
strip_prefix = "rules_python-0.8.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.0.tar.gz",
)
BREAKING CHANGES
In 0.7.0 we introduced the hermetic Python interpreter toolchain, with a repository rule python_register_toolchains
that generated a "magically-named" repo with _resolved_interpreter
as the suffix, like this:
python_register_toolchains(
name = "python3_9",
# Available versions are listed in @rules_python//python:versions.bzl.
# We recommend using the same version your team is already standardized on.
python_version = "3.9",
)
load("@python3_9_resolved_interpreter//:defs.bzl", "interpreter")
In 0.8.0 that suffix is removed, so the resolved toolchain is just named the same as you provide. In that example the last line would now be
load("@python3_9//:defs.bzl", "interpreter")
What's Changed
- release: Fix release snippet by @alexeagle in #651
- docs: avoid users on 3.10 by accident by @alexeagle in #653
- fix: take custom tools versions into account when selecting Python interpreter by @mattem in #654
- Allow for custom python versions in
python_register_toolchains
by @UebelAndre in #657 - Update CODEOWNERS. remove andy scott as maintainer by @thundergolfer in #658
- Document how to vendor a pip_parse requirements.bzl file by @alexeagle in #655
- Expose
defs.bzl
formresolved_interpreter_os_alias
as a target by @UebelAndre in #659 - Allow
python_register_toolchains.name
to be the resolved interpreter repo by @UebelAndre in #656 - Fix annotations_test on windows systems that don't support symlinks by @UebelAndre in #665
- Added support for custom
strip_prefix
args in toolchains by @UebelAndre in #664 - Updated
pip
,pkginfo
,setuptools
, andwheel
. by @UebelAndre in #661
Full Changelog: 0.7.0...0.8.0
0.7.0
WORKSPACE setup:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "15f84594af9da06750ceb878abbf129241421e3abbd6e36893041188db67f2fb",
strip_prefix = "rules_python-0.7.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.7.0.tar.gz",
)
News
rules_python can now fetch a hermetic pre-built Python interpreter from the excellent https://github.com/indygreg/python-build-standalone project.
Thank you @indygreg for providing this resource!
To use it, see the docs for python_register_toolchains
on https://github.com/bazelbuild/rules_python#getting-started
What's Changed
- Fix buildozer command for substituting deps by @hrfuller in #596
- Added
.gitignore
files to example directories by @UebelAndre in #599 - Fix undefined name in purelib.py by @hrfuller in #604
- changes to pip_repository source files now re-trigger the repo rule by @UebelAndre in #601
- Added support for annotating rendered pip dependencies by @UebelAndre in #589
- bump: go version from 1.16 to 1.17.6 by @f0rmiga in #610
- Fixed extra_pip_arg parsing error in pip_repository rules. by @UebelAndre in #613
- fix compile_pip_requirements on windows by @jheaff1 in #595
- Use
@rules_python//python/runfiles
for examples and tests by @UebelAndre in #614 - Make python only
bzl_library
target publicly visible by @UebelAndre in #611 - restrict visibility on filegroup target only consumed in 1 place by @thundergolfer in #605
- Added integration test for testing nuances of pip_repository macros by @UebelAndre in #615
- Removed examples that are not platform agnostic by @UebelAndre in #620
- Fixed buildifier defects by @UebelAndre in #621
- Fix false positive tests in CI for Windows by @UebelAndre in #598
- chore: bump local version of bazel used to 4.2.0 by @mattem in #616
- Fixed incorrect custom compile commands from
compile_pip_requirements
by @UebelAndre in #627 - conditionally log unused annotations by @UebelAndre in #629
- Exclude dist-info data from pip_repository targets by @UebelAndre in #626
- feat: concurrent parsing for Gazelle by @f0rmiga in #630
- Updated pip_repository data ignore patterns by @UebelAndre in #632
- Allow
*.dist-info/WHEEL
files intopip_repository
generated targets by @UebelAndre in #634 - feat: support pip_parse in Gazelle by @f0rmiga in #633
- Allow METADATA files in pip_repository generated targets by @UebelAndre in #637
- feat: cpython toolchains by @f0rmiga in #618
- fix: lazy fetch checksums for toolchains by @f0rmiga in #648
- feat: allow overriding tool versions and base url for predefined Python interpreters by @mattem in #647
- chore: update GitHub archive url to produce stable SHA by @alexeagle in #650
New Contributors
Full Changelog: 0.6.0...0.7.0
0.6.0
WORKSPACE setup:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "a30abdfc7126d497a7698c29c46ea9901c6392d6ed315171a6df5ce433aa4502",
strip_prefix = "rules_python-0.6.0",
url = "https://github.com/bazelbuild/rules_python/archive/0.6.0.tar.gz",
)
Breaking Changes
If you used the gazelle plugin, the workspace call to modules_mapping()
should now be moved to a BUILD file as it is a regular rule. See the updates to examples/build_file_generation
in https://github.com/bazelbuild/rules_python/pull/578/files
Users of pip_parse
(or pip_repository(incremental=True)
) will have the generated repositories change, e.g. from @pip_pypi__amqp//:pkg
to @amqp//:pkg
. If you use the requirements()
helper, this won't affect you, but if you referred to the generated labels directly it will.
You can add the attribute repo_prefix = "pip_pypi__"
on pip_parse
to restore the previous default.
What's Changed
- Fix regression in parsing requirements due to invalid entry points config. by @UebelAndre in #536
- Add tags pypi_name and pypi_version to generated py_library targets by @alexeagle in #530
- Exposed docs for
compile_pip_requirements
by @UebelAndre in #534 - Revert "py_library generated from wheel shouldn't include tests/ fold… by @alexeagle in #539
- Updated min tested Bazel version to 4.0.0 by @UebelAndre in #533
- Added additional tests for
pip_parse
andpip_install
utilties by @UebelAndre in #524 - docs: enforce that api docs are up-to-date by @alexeagle in #540
- fix: rules_python 0.4.0 is not recent enough for pip_install example by @thundergolfer in #547
- Typo: s/requiremenst/requirements by @b0ri5 in #552
- fix bazel_integration_test runner to allow non-release URLs by @alexeagle in #556
- Remove 'experimental' from pip_parse section by @jvolkman in #551
- Update docstrings for packaging rules/macros by @thundergolfer in #535
- Turn
//python/private
into a package. by @UebelAndre in #555 - Added
stamp
attribute topy_wheel
by @UebelAndre in #554 - Add support for relative requirements in pip_install by @aaliddell in #433
- Release 0.5.0 by @alexeagle in #558
- Fixed
stamp.bzl
missing form@rules_python//:bzl
target. by @UebelAndre in #560 - Fix minor typo in stamp.bzl by @thundergolfer in #559
- Fix #507 - Always run from WORKSPACE root in compile_pip_requirements update exe by @thundergolfer in #564
- Use 0.5.0 in README by @SUPERCILEX in #562
- Fixed stable stamping of wheels by @UebelAndre in #567
- pip: entry_point: Add support for exit codes by @gibfahn in #550
- Gazelle extension for Python by @f0rmiga in #514
- Remove return code type check. by @phst in #573
- Ignore
__pycache__
contents and*.pyc
files in external dependencies by @UebelAndre in #570 - fix(gazelle): include file path in manifest parsing error message by @mattem in #579
- Allow controlling the prefix added to repos/packages by @person142 in #459
- Deleted legacy pip_import rule by @UebelAndre in #582
- sorted imports statements and apply "black" formatting by @UebelAndre in #583
- Fix broken pre-commit hook by @UebelAndre in #590
- Make spread_purelib_into_root behave like the wheel was installed by pip by @hrfuller in #581
- Bump gopkg.in/yaml.v2 from 2.2.2 to 2.2.8 by @dependabot in #584
- Fix entry point discovery on Windows. by @phst in #572
- Remove forgotten fragments of
pip_import
rule. by @UebelAndre in #588 - Simplify release by @alexeagle in #587
- fix: release tags don't include v prefix by @alexeagle in #591
- Add missing file for release automation by @alexeagle in #592
- Enabled CI for Windows by @UebelAndre in #585
- Update README to say that using
requirement()
is optional by @person142 in #594 - fix release automation: script was not chmod u+x by @alexeagle in #593
- refactor: make modules_mapping a regular rule by @f0rmiga in #578
New Contributors
- @b0ri5 made their first contribution in #552
- @jvolkman made their first contribution in #551
- @aaliddell made their first contribution in #433
- @SUPERCILEX made their first contribution in #562
- @gibfahn made their first contribution in #550
- @f0rmiga made their first contribution in #514
- @phst made their first contribution in #573
Full Changelog: 0.4.0...0.6.0
0.5.0
WORKSPACE setup
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.5.0/rules_python-0.5.0.tar.gz",
sha256 = "cd6730ed53a002c56ce4e2f396ba3b3be262fd7cb68339f0377a45e8227fe332",
)
Warning
#571 reports that the pip_parse
rule which is newly promoted from experimental may be non-deterministic. We don't recommend using it until that issue is resolved.
Breaking changes
rules_python supports Bazel Long-Term Support versions, 4.0.0 or higher. The repository rules will fail with an error if your Bazel version is older.
You can patch out that check if you really want to upgrade rules_python with Bazel 3 or lower, however this isn't supported.
What's Changed
- Fix regression in parsing requirements due to invalid entry points config. by @UebelAndre in #536
- Add tags pypi_name and pypi_version to generated py_library targets by @alexeagle in #530
- Exposed docs for
compile_pip_requirements
by @UebelAndre in #534 - Revert "py_library generated from wheel shouldn't include tests/ fold… by @alexeagle in #539
- Updated min tested Bazel version to 4.0.0 by @UebelAndre in #533
- Added additional tests for
pip_parse
andpip_install
utilties by @UebelAndre in #524 - docs: enforce that api docs are up-to-date by @alexeagle in #540
- fix: rules_python 0.4.0 is not recent enough for pip_install example by @thundergolfer in #547
- Typo: s/requiremenst/requirements by @b0ri5 in #552
- fix bazel_integration_test runner to allow non-release URLs by @alexeagle in #556
- Remove 'experimental' from pip_parse section by @jvolkman in #551
- Update docstrings for packaging rules/macros by @thundergolfer in #535
- Turn
//python/private
into a package. by @UebelAndre in #555 - Added
stamp
attribute topy_wheel
by @UebelAndre in #554 - Add support for relative requirements in pip_install by @aaliddell in #433
New Contributors
- @b0ri5 made their first contribution in #552
- @jvolkman made their first contribution in #551
- @aaliddell made their first contribution in #433
Full Changelog: 0.4.0...0.5.0
0.4.0
Changes from last release
WORKSPACE setup
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "954aa89b491be4a083304a2cb838019c8b8c3720a7abb9c4cb81ac7a24230cea",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.4.0/rules_python-0.4.0.tar.gz",
"https://github.com/bazelbuild/rules_python/releases/download/0.4.0/rules_python-0.4.0.tar.gz",
],
)
Using the rules
See the source.
0.3.0
New Features
compile_pip_requirements
- rule for easily producing a requirements.lock file (experimental).
Contributions
- 03c4523 Smarter namespace pkg detection in pip_install (issue #381) (#483)
- 6202ed2 Replace
<code>
with backticks in docs. Addresses #255 (#486) - f1b6b74 Check pip-compile failed to resolve requirements (#482). Thanks to @reiyw
- 915f21b Make lazily fetching dependencies compatible to disallow_empty_glob (#477). Thanks to @martis42
- ce19337 pip_install: avoid assuming 'Root-Is-Purelib' is provided in all WHEEL files
- d95e89f Migrate from bazelbuild/skydoc to bazelbuild/stardoc (#484)
- bccb3c5 Add a buildifier pre-commit hook (#481). Thanks to @alexeagle
- 4b114a4 Ignore global pip config files for pip-compile (#473). Thanks to @keith
- eaed210 Added packaging docs (#480). Thanks to @UebelAndre
- ed6cc8f Allow overriding CUSTOM_COMPILE_COMMAND (#472). Thanks to @keith
- 53ba6cb Remove leading ./ in compile_pip_requirements (#471). Thanks to @person142
- ef4d735 fix defaulted macro args behaviour so users can actually set their values (#467)
- 1dc8ed9 Introduce compile_pip_requirements rule (#373). Thanks to @alexeagle
- 1b4f61b Replace old pip_install_incremental reference (#462). Thanks to @person142
- 6a9311c Add
py_import
rule (#174). Thanks to @beasleyr-vmw - a4c375b
requirements.bzl
is now visible outsidepip_repository
s (#463). Thanks to @UebelAndre - 017eb4f Don't delete wheels from external repos with pip_parse (#458). Thanks to @person142
- 04c6d7f Also name the BUILD file in external repository roots BUILD.bazel (#457). Thanks to @person142
- 37f04a4 Parse requirements files for global pip flags. (#456). Thanks to @hrfuller
- bc256ef Ran buildifier (#449). Thanks to @UebelAndre
Incompatible Changes
None
WORKSPACE setup
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.3.0/rules_python-0.3.0.tar.gz",
sha256 = "934c9ceb552e84577b0faf1e5a2f0450314985b4d8712b2b70717dc679fdc01b",
)
Using the rules
See the source.
0.2.0
New Features
- Wheel building code has graduated out of
//experimental
. See #418 rules_python
no longer mistakenly depends on bazel-skylib.- Support for incremental wheel downloading if using a locked requirements file. See #432
Incompatible Changes
pip_install
packaging rule no longer supports Python 3.5 (which is end-of-life) due to upgrade ofpip
. See: #412
WORKSPACE setup
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_python",
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
"https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
],
)
Using the rules
See the source.