Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bazel-contrib/rules_python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.25.0
Choose a base ref
...
head repository: bazel-contrib/rules_python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.26.0
Choose a head ref
Loading
Showing with 9,349 additions and 886 deletions.
  1. +30 −29 .bazelci/presubmit.yml
  2. +7 −0 .bazelignore
  3. +2 −2 .bazelrc
  4. +1 −1 .bcr/config.yml
  5. +7 −0 BUILD.bazel
  6. +77 −2 CHANGELOG.md
  7. +4 −1 MODULE.bazel
  8. +1 −1 README.md
  9. +14 −3 WORKSPACE
  10. +54 −63 docs/BUILD.bazel
  11. +5 −2 docs/packaging.md
  12. +3 −27 docs/pip_repository.md
  13. +87 −0 docs/py_console_script_binary.md
  14. +0 −1 examples/build_file_generation/BUILD.bazel
  15. +8 −5 examples/build_file_generation/WORKSPACE
  16. +0 −2 examples/bzlmod/BUILD.bazel
  17. +1 −4 examples/bzlmod/MODULE.bazel
  18. +0 −20 examples/bzlmod/entry_point/BUILD.bazel
  19. +33 −0 examples/bzlmod/entry_points/BUILD.bazel
  20. +63 −0 examples/bzlmod/entry_points/tests/BUILD.bazel
  21. +6 −0 examples/bzlmod/entry_points/tests/file_with_pylint_errors.py
  22. +72 −0 examples/bzlmod/entry_points/tests/pylint_deps_test.py
  23. +57 −0 examples/bzlmod/entry_points/tests/pylint_test.py
  24. +13 −3 examples/bzlmod/{entry_point/test_entry_point.py → entry_points/tests/yamllint_test.py}
  25. +1 −0 examples/bzlmod/requirements.in
  26. +6 −0 examples/bzlmod/requirements_lock_3_10.txt
  27. +12 −4 examples/bzlmod/requirements_lock_3_9.txt
  28. +6 −0 examples/bzlmod/requirements_windows_3_10.txt
  29. +12 −4 examples/bzlmod/requirements_windows_3_9.txt
  30. +1 −1 examples/bzlmod_build_file_generation/BUILD.bazel
  31. +1 −2 examples/bzlmod_build_file_generation/gazelle_python.yaml
  32. +6 −4 examples/bzlmod_build_file_generation/requirements_lock.txt
  33. +6 −4 examples/bzlmod_build_file_generation/requirements_windows.txt
  34. +0 −4 examples/multi_python_versions/requirements/BUILD.bazel
  35. +71 −49 examples/multi_python_versions/requirements/requirements_lock_3_10.txt
  36. +71 −49 examples/multi_python_versions/requirements/requirements_lock_3_11.txt
  37. +71 −49 examples/multi_python_versions/requirements/requirements_lock_3_8.txt
  38. +71 −49 examples/multi_python_versions/requirements/requirements_lock_3_9.txt
  39. +1 −2 examples/pip_install/BUILD.bazel
  40. +1 −1 examples/pip_install/pip_install_test.py
  41. +1 −1 examples/pip_install/requirements.in
  42. +9 −6 examples/pip_install/requirements.txt
  43. +12 −9 examples/pip_install/requirements_windows.txt
  44. +0 −1 examples/pip_parse/BUILD.bazel
  45. +1 −1 examples/pip_parse/pip_parse_test.py
  46. +1 −1 examples/pip_parse/requirements.in
  47. +9 −6 examples/pip_parse/requirements_lock.txt
  48. +1 −1 examples/pip_parse_vendored/BUILD.bazel
  49. +1 −1 examples/pip_parse_vendored/requirements.bzl
  50. +1 −0 examples/pip_parse_vendored/requirements.in
  51. +6 −4 examples/pip_parse_vendored/requirements.txt
  52. +0 −1 examples/pip_repository_annotations/BUILD.bazel
  53. +1 −0 examples/pip_repository_annotations/requirements.in
  54. +9 −7 examples/pip_repository_annotations/requirements.txt
  55. +40 −1 examples/wheel/BUILD.bazel
  56. +45 −7 examples/wheel/wheel_test.py
  57. +2 −2 gazelle/MODULE.bazel
  58. +10 −6 gazelle/README.md
  59. +6 −4 gazelle/WORKSPACE
  60. +1 −1 gazelle/go.mod
  61. +2 −2 gazelle/go.sum
  62. +14 −7 gazelle/manifest/defs.bzl
  63. +1 −1 gazelle/python/BUILD.bazel
  64. +5 −0 gazelle/python/configure.go
  65. +31 −11 gazelle/python/generate.go
  66. +2 −1 gazelle/python/kinds.go
  67. +9 −2 gazelle/python/parser.go
  68. +4 −4 gazelle/python/resolve.go
  69. +10 −3 gazelle/python/std_modules.go
  70. +1 −0 gazelle/python/testdata/dont_rename_target/BUILD.in
  71. +11 −0 gazelle/python/testdata/per_file/BUILD.in
  72. +24 −0 gazelle/python/testdata/per_file/BUILD.out
  73. +5 −0 gazelle/python/testdata/per_file/README.md
  74. +1 −0 gazelle/python/testdata/per_file/WORKSPACE
  75. 0 gazelle/python/testdata/per_file/__init__.py
  76. +15 −0 gazelle/python/testdata/per_file/bar.py
  77. +15 −0 gazelle/python/testdata/per_file/baz.py
  78. +15 −0 gazelle/python/testdata/per_file/foo.py
  79. +15 −0 gazelle/python/testdata/per_file/test.yaml
  80. +3 −0 gazelle/python/testdata/per_file_non_empty_init/BUILD.in
  81. +16 −0 gazelle/python/testdata/per_file_non_empty_init/BUILD.out
  82. +3 −0 gazelle/python/testdata/per_file_non_empty_init/README.md
  83. +1 −0 gazelle/python/testdata/per_file_non_empty_init/WORKSPACE
  84. +15 −0 gazelle/python/testdata/per_file_non_empty_init/__init__.py
  85. +15 −0 gazelle/python/testdata/per_file_non_empty_init/foo.py
  86. +15 −0 gazelle/python/testdata/per_file_non_empty_init/test.yaml
  87. +3 −0 gazelle/python/testdata/per_file_subdirs/BUILD.in
  88. +10 −0 gazelle/python/testdata/per_file_subdirs/BUILD.out
  89. +3 −0 gazelle/python/testdata/per_file_subdirs/README.md
  90. +1 −0 gazelle/python/testdata/per_file_subdirs/WORKSPACE
  91. 0 gazelle/python/testdata/per_file_subdirs/bar/BUILD.in
  92. +13 −0 gazelle/python/testdata/per_file_subdirs/bar/BUILD.out
  93. +15 −0 gazelle/python/testdata/per_file_subdirs/bar/__init__.py
  94. +16 −0 gazelle/python/testdata/per_file_subdirs/bar/foo.py
  95. +15 −0 gazelle/python/testdata/per_file_subdirs/baz/baz.py
  96. +15 −0 gazelle/python/testdata/per_file_subdirs/foo.py
  97. +15 −0 gazelle/python/testdata/per_file_subdirs/test.yaml
  98. +16 −0 gazelle/pythonconfig/pythonconfig.go
  99. +3 −3 internal_deps.bzl
  100. +3 −0 internal_setup.bzl
  101. +83 −7 python/BUILD.bazel
  102. +1 −0 python/config_settings/BUILD.bazel
  103. +7 −0 python/config_settings/private/BUILD.bazel
  104. +2 −3 python/config_settings/transition.bzl
  105. +39 −0 python/entry_points/BUILD.bazel
  106. +79 −0 python/entry_points/py_console_script_binary.bzl
  107. +57 −92 python/extensions/pip.bzl
  108. +2 −0 python/extensions/private/internal_deps.bzl
  109. +3 −8 python/extensions/private/pythons_hub.bzl
  110. +12 −6 python/extensions/python.bzl
  111. +2 −1 python/packaging.bzl
  112. +2 −2 python/pip.bzl
  113. +67 −0 python/pip_install/BUILD.bazel
  114. +0 −35 python/pip_install/pip_hub_repository_requirements_bzlmod.bzl.tmpl
  115. +46 −76 python/pip_install/pip_repository.bzl
  116. +17 −3 python/pip_install/pip_repository_requirements_bzlmod.bzl.tmpl
  117. +14 −0 python/pip_install/private/BUILD.bazel
  118. +25 −20 python/pip_install/repositories.bzl
  119. +5 −2 python/pip_install/requirements.bzl
  120. +10 −10 python/pip_install/tools/requirements.txt
  121. +1 −0 python/pip_install/tools/wheel_installer/BUILD.bazel
  122. +173 −24 python/private/BUILD.bazel
  123. +70 −0 python/private/autodetecting_toolchain.bzl
  124. +57 −0 python/private/autodetecting_toolchain_interpreter.sh
  125. +204 −0 python/private/common/BUILD.bazel
  126. +242 −0 python/private/common/attributes.bzl
  127. +30 −0 python/private/common/attributes_bazel.bzl
  128. +23 −0 python/private/common/cc_helper.bzl
  129. +526 −0 python/private/common/common.bzl
  130. +109 −0 python/private/common/common_bazel.bzl
  131. +224 −0 python/private/common/providers.bzl
  132. +21 −0 python/private/common/py_binary_macro_bazel.bzl
  133. +49 −0 python/private/common/py_binary_rule_bazel.bzl
  134. +861 −0 python/private/common/py_executable.bzl
  135. +484 −0 python/private/common/py_executable_bazel.bzl
  136. +26 −0 python/private/common/py_internal.bzl
  137. +101 −0 python/private/common/py_library.bzl
  138. +19 −0 python/private/common/py_library_macro_bazel.bzl
  139. +47 −0 python/private/common/py_library_rule_bazel.bzl
  140. +22 −0 python/private/common/py_runtime_macro.bzl
  141. +216 −0 python/private/common/py_runtime_rule.bzl
  142. +21 −0 python/private/common/py_test_macro_bazel.bzl
  143. +56 −0 python/private/common/py_test_rule_bazel.bzl
  144. +34 −0 python/private/common/semantics.bzl
  145. +43 −0 python/private/full_version.bzl
  146. +99 −0 python/private/internal_config_repo.bzl
  147. +87 −0 python/private/py_console_script_binary.bzl
  148. +93 −0 python/private/py_console_script_gen.bzl
  149. +180 −0 python/private/py_console_script_gen.py
  150. +27 −0 python/private/py_runtime_pair_macro.bzl
  151. +138 −0 python/private/py_runtime_pair_rule.bzl
  152. +81 −4 python/private/py_wheel.bzl
  153. +519 −0 python/private/py_wheel_normalize_pep440.bzl
  154. +559 −0 python/private/python_bootstrap_template.txt
  155. +18 −1 python/private/toolchains_repo.bzl
  156. +3 −12 {tools/build_defs/python/tests → python/proto}/BUILD.bazel
  157. +6 −2 python/py_binary.bzl
  158. +3 −1 python/py_info.bzl
  159. +6 −2 python/py_library.bzl
  160. +6 −2 python/py_runtime.bzl
  161. +3 −1 python/py_runtime_info.bzl
  162. +5 −1 python/py_runtime_pair.bzl
  163. +6 −1 python/py_test.bzl
  164. +46 −21 python/repositories.bzl
  165. +3 −1 python/tests/toolchains/workspace_template/WORKSPACE.tmpl
  166. +92 −4 python/versions.bzl
  167. +1 −0 tests/BUILD.bazel
  168. +13 −0 tests/base_rules/BUILD.bazel
  169. +2 −2 {tools/build_defs/python/tests → tests/base_rules}/base_tests.bzl
  170. 0 {tools/build_defs/python/tests → tests/base_rules}/py_binary/BUILD.bazel
  171. +1 −1 {tools/build_defs/python/tests → tests/base_rules}/py_binary/py_binary_tests.bzl
  172. +40 −2 {tools/build_defs/python/tests → tests/base_rules}/py_executable_base_tests.bzl
  173. 0 {tools/build_defs/python/tests → tests/base_rules}/py_info_subject.bzl
  174. 0 {tools/build_defs/python/tests → tests/base_rules}/py_library/BUILD.bazel
  175. +2 −2 {tools/build_defs/python/tests → tests/base_rules}/py_library/py_library_tests.bzl
  176. 0 {tools/build_defs/python/tests → tests/base_rules}/py_test/BUILD.bazel
  177. +7 −8 {tools/build_defs/python/tests → tests/base_rules}/py_test/py_test_tests.bzl
  178. 0 {tools/build_defs/python/tests → tests/base_rules}/util.bzl
  179. +27 −0 tests/cc/BUILD.bazel
  180. +0 −12 tests/compile_pip_requirements/BUILD.bazel
  181. +2 −0 tests/compile_pip_requirements/requirements_lock.txt
  182. +2 −0 tests/compile_pip_requirements/requirements_lock_darwin.txt
  183. +2 −0 tests/compile_pip_requirements/requirements_lock_linux.txt
  184. +2 −0 tests/compile_pip_requirements/requirements_lock_windows.txt
  185. +2 −0 tests/compile_pip_requirements/requirements_nohashes_lock.txt
  186. +39 −0 tests/entry_points/BUILD.bazel
  187. +197 −0 tests/entry_points/py_console_script_gen_test.py
  188. +31 −0 tests/entry_points/simple_macro.bzl
  189. +3 −1 tests/ignore_root_user_error/WORKSPACE
  190. +0 −1 tests/pip_repository_entry_points/BUILD.bazel
  191. +4 −1 tests/pip_repository_entry_points/requirements.in
  192. +15 −11 tests/pip_repository_entry_points/requirements.txt
  193. +15 −11 tests/pip_repository_entry_points/requirements_windows.txt
  194. +17 −0 tests/py_runtime/BUILD.bazel
  195. +262 −0 tests/py_runtime/py_runtime_tests.bzl
  196. +101 −0 tests/py_runtime_info_subject.bzl
  197. +17 −0 tests/py_runtime_pair/BUILD.bazel
  198. +66 −0 tests/py_runtime_pair/py_runtime_pair_tests.bzl
  199. 0 {tools/build_defs/python/tests → tests/py_wheel}/py_wheel/BUILD.bazel
  200. +1 −1 {tools/build_defs/python/tests → tests/py_wheel}/py_wheel/py_wheel_tests.bzl
  201. +103 −0 tests/py_wheel/py_wheel_tests.bzl
  202. +34 −0 tests/pycross/BUILD.bazel
  203. +48 −0 tests/pycross/py_wheel_library_test.py
  204. +39 −0 tests/support/BUILD.bazel
  205. +20 −0 tests/support/test_platforms.bzl
  206. +201 −0 third_party/rules_pycross/LICENSE
  207. +14 −0 third_party/rules_pycross/pycross/private/BUILD.bazel
  208. +32 −0 third_party/rules_pycross/pycross/private/providers.bzl
  209. +26 −0 third_party/rules_pycross/pycross/private/tools/BUILD.bazel
  210. +138 −0 third_party/rules_pycross/pycross/private/tools/wheel_installer.py
  211. +137 −0 third_party/rules_pycross/pycross/private/wheel_library.bzl
  212. +1 −0 tools/BUILD.bazel
  213. +27 −0 tools/build_defs/python/private/BUILD.bazel
  214. +30 −0 tools/build_defs/python/private/py_internal_renamed.bzl
  215. +102 −9 tools/wheelmaker.py
59 changes: 30 additions & 29 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -93,6 +93,36 @@ tasks:
<<: *reusable_config
name: Default test on Ubuntu
platform: ubuntu2004
ubuntu_bazel_rolling:
<<: *reusable_config
name: "Default test: Ubuntu, Pystar, workspace"
platform: ubuntu2004
# TODO: Change to "rolling" once
# https://github.com/bazelbuild/bazel/commit/f3aafea59ae021c6a12086cb2cd34c5fa782faf1
# is available in rolling.
bazel: "last_green"
environment:
RULES_PYTHON_ENABLE_PYSTAR: "1"
test_flags:
# The doc check tests fail because the Starlark implementation makes the
# PyInfo and PyRuntimeInfo symbols become documented.
- "--test_tag_filters=-integration-test,-doc_check_test"
ubuntu_bazel_rolling_bzlmod:
<<: *reusable_config
<<: *common_bzlmod_flags
name: "Default test: Ubuntu, Pystar, bzlmod"
platform: ubuntu2004
# TODO: Change to "rolling" once
# https://github.com/bazelbuild/bazel/commit/f3aafea59ae021c6a12086cb2cd34c5fa782faf1
# is available in rolling.
bazel: "last_green"
environment:
RULES_PYTHON_ENABLE_PYSTAR: "1"
test_flags:
# The doc check tests fail because the Starlark implementation makes the
# PyInfo and PyRuntimeInfo symbols become documented.
- "--test_tag_filters=-integration-test,-doc_check_test"

debian:
<<: *reusable_config
name: Default test on Debian
@@ -107,7 +137,6 @@ tasks:
platform: windows
test_flags:
- "--test_tag_filters=-integration-test,-fix-windows"

rbe_min:
<<: *minimum_supported_version
<<: *reusable_config
@@ -262,34 +291,6 @@ tasks:
name: multi_python_versions integration tests on Windows
working_directory: examples/multi_python_versions
platform: windows

integration_test_pip_install_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: pip_install integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/pip_install
platform: ubuntu2004
integration_test_pip_install_ubuntu:
<<: *reusable_build_test_all
name: pip_install integration tests on Ubuntu
working_directory: examples/pip_install
platform: ubuntu2004
integration_test_pip_install_debian:
<<: *reusable_build_test_all
name: pip_install integration tests on Debian
working_directory: examples/pip_install
platform: debian11
integration_test_pip_install_macos:
<<: *reusable_build_test_all
name: pip_install integration tests on macOS
working_directory: examples/pip_install
platform: macos
integration_test_pip_install_windows:
<<: *reusable_build_test_all
name: pip_install integration tests on Windows
working_directory: examples/pip_install
platform: windows

integration_test_pip_parse_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
7 changes: 7 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -6,6 +6,13 @@ bazel-rules_python
bazel-bin
bazel-out
bazel-testlogs
# Prevent the convenience symlinks within the examples from being
# treated as directories with valid BUILD files for the main repo.
# Any directory with a WORKSPACE in it should be added here, with
# an entry like `bazel-{workspacename}`
examples/bzlmod/bazel-bzlmod
examples/bzlmod/other_module/bazel-other_module
examples/bzlmod_build_file_generation/bazel-bzlmod_build_file_generation
examples/pip_parse/bazel-pip_parse
examples/py_proto_library/bazel-py_proto_library
tests/ignore_root_user_error/bazel-ignore_root_user_error
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@
# This lets us glob() up all the files inside the examples to make them inputs to tests
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
# To update these lines, run tools/bazel_integration_test/update_deleted_packages.sh
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_point,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_point,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points
build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points
query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_install,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,tests/compile_pip_requirements,tests/compile_pip_requirements_test_from_external_workspace,tests/ignore_root_user_error,tests/pip_repository_entry_points

test --test_output=errors

2 changes: 1 addition & 1 deletion .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -14,5 +14,5 @@

fixedReleaser:
login: f0rmiga
email: thulio@aspect.dev
email: 3149049+f0rmiga@users.noreply.github.com
moduleRoots: [".", "gazelle"]
7 changes: 7 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load(":version.bzl", "BAZEL_VERSION")

package(default_visibility = ["//visibility:public"])
@@ -44,6 +45,12 @@ filegroup(
],
)

bzl_library(
name = "version_bzl",
srcs = ["version.bzl"],
visibility = ["//:__subpackages__"],
)

# Reexport of all bzl files used to allow downstream rules to generate docs
# without shipping with a dependency on Skylib
filegroup(
79 changes: 77 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -17,10 +17,87 @@ A brief description of the categories of changes:
* Particular sub-systems are identified using parentheses, e.g. `(bzlmod)` or
`(docs)`.

## Unreleased

### Changed

* 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`.


### Added

* (bzlmod, entry_point) Added
[`py_console_script_binary`](./docs/py_console_script_binary.md), 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.

### Removed

* (bzlmod) The `entry_point` macro is no longer supported and has been removed
in favour 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.

### Fixed

* (whl_library) No longer restarts repository rule when fetching external
dependencies improving initial build times involving external dependency
fetching.

* (gazelle) Improve runfiles lookup hermeticity.

## [0.25.0] - 2023-08-22

### Changed

* Python version patch level bumps:
* 3.9.16 -> 3.9.17
* 3.10.9 -> 3.10.12
* 3.11.1 -> 3.11.4
* (bzlmod) `pip.parse` can no longer automatically use the default
Python version; this was an unreliable and unsafe behavior. The
`python_version` arg must always be explicitly specified.
@@ -76,5 +153,3 @@ A brief description of the categories of changes:
* Expose Python C headers through the toolchain.

[0.24.0]: https://github.com/bazelbuild/rules_python/releases/tag/0.24.0


5 changes: 4 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -4,8 +4,9 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "bazel_features", version = "1.1.0")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "platforms", version = "0.0.4")

# Those are loaded only when using py_proto_library
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
@@ -15,6 +16,7 @@ internal_deps = use_extension("@rules_python//python/extensions/private:internal
internal_deps.install()
use_repo(
internal_deps,
"rules_python_internal",
# START: maintained by 'bazel run //tools/private:update_pip_deps'
"pypi__build",
"pypi__click",
@@ -26,6 +28,7 @@ use_repo(
"pypi__pep517",
"pypi__pip",
"pypi__pip_tools",
"pypi__pyproject_hooks",
"pypi__setuptools",
"pypi__tomli",
"pypi__wheel",
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python Rules for Bazel

[![Build status](https://badge.buildkite.com/1bcfe58b6f5741aacb09b12485969ba7a1205955a45b53e854.svg?branch=main)](https://buildkite.com/bazel/python-rules-python-postsubmit)
[![Build status](https://badge.buildkite.com/0bcfe58b6f5741aacb09b12485969ba7a1205955a45b53e854.svg?branch=main)](https://buildkite.com/bazel/rules-python-python)

## Overview

17 changes: 14 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -30,11 +30,11 @@ load("//python:versions.bzl", "MINOR_MAPPING")

python_register_multi_toolchains(
name = "python",
default_version = MINOR_MAPPING.values()[-1],
default_version = MINOR_MAPPING.values()[-2],
python_versions = MINOR_MAPPING.values(),
)

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

# Used for Bazel CI
http_archive(
@@ -72,7 +72,7 @@ _py_gazelle_deps()
# Install twine for our own runfiles wheel publishing.
# Eventually we might want to install twine automatically for users too, see:
# https://github.com/bazelbuild/rules_python/issues/1016.
load("@python//3.11.4:defs.bzl", "interpreter")
load("@python//3.11.6:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
@@ -86,3 +86,14 @@ pip_parse(
load("@publish_deps//:requirements.bzl", "install_deps")

install_deps()

# This wheel is purely here to validate the wheel extraction code. It's not
# intended for anything else.
http_file(
name = "wheel_for_testing",
downloaded_file_path = "numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
sha256 = "0d60fbae8e0019865fc4784745814cff1c421df5afee233db6d88ab4f14655a2",
urls = [
"https://files.pythonhosted.org/packages/50/67/3e966d99a07d60a21a21d7ec016e9e4c2642a86fea251ec68677daf71d4d/numpy-1.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
],
)
Loading