Skip to content

Commit

Permalink
refactor!: Remove entrypoint (bazelbuild#1987)
Browse files Browse the repository at this point in the history
Removes the entrypoint macro. This has been replaced with
`py_console_script_binary`.

I was getting familiar again with the code-base today and remembered
that we were on a path to deprecate `entrypoint` in favor of
`py_console_script_binary`. So I did a very quick clean-up.

It has been mentioned for a while that it would be removed, so I *think*
removal is valid now from a compatibility standpoint:
https://github.com/bazelbuild/rules_python/pull/1987/files#diff-fed3a6d7d568aea2237b65544571ef9519b5f249ddbb23d521e6e55161c10452L33

Either way, we probably don't want to carry this into the 1.0
  • Loading branch information
groodt authored Jun 20, 2024
1 parent a124c84 commit 0b6b471
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 669 deletions.
12 changes: 0 additions & 12 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,6 @@ tasks:
- "bazel run //:os_specific_requirements.update"
- "git diff --exit-code"

integration_test_pip_repository_entry_points_macos_workspace:
<<: *reusable_build_test_all
<<: *common_workspace_flags
name: "pip_repository_entry_points: macOS, workspace"
working_directory: tests/integration/pip_repository_entry_points
platform: macos
integration_test_pip_repository_entry_points_windows_workspace:
<<: *reusable_build_test_all
<<: *common_workspace_flags
name: "pip_repository_entry_points: Windows, workspace"
working_directory: tests/integration/pip_repository_entry_points
platform: windows

integration_test_ignore_root_user_error_macos_workspace:
<<: *reusable_build_test_all
Expand Down
1 change: 0 additions & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ examples/py_proto_library/bazel-py_proto_library
tests/integration/compile_pip_requirements/bazel-compile_pip_requirements
tests/integration/ignore_root_user_error/bazel-ignore_root_user_error
tests/integration/local_toolchains/bazel-local_toolchains
tests/integration/pip_repository_entry_points/bazel-pip_repository_entry_points
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
# To update these lines, execute
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
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_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/dupe_requirements,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_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/pip_repository_entry_points,tests/integration/py_cc_toolchain_registered
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_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/dupe_requirements,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_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/pip_repository_entry_points,tests/integration/py_cc_toolchain_registered
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/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,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_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered
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/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,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_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered

test --test_output=errors

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ A brief description of the categories of changes:
`interpreter_version_info` arg.

### Removed
* Nothing yet
* (pip): Removes the `entrypoint` macro that was replaced by `py_console_script_binary` in 0.26.0.

## [0.33.2] - 2024-06-13

Expand Down
5 changes: 0 additions & 5 deletions examples/pip_parse_vendored/requirements.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ def data_requirement(name):
def dist_info_requirement(name):
return "@my_project_pip_deps_vendored_{}//:{}".format(pip_utils.normalize_name(name), "dist_info")

def entry_point(pkg, script = None):
if not script:
script = pkg
return "@my_project_pip_deps_vendored_" + pip_utils.normalize_name(pkg) + "//:rules_python_wheel_entry_point_" + script

def _get_annotation(requirement):
# This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11`
# down to `setuptools`.
Expand Down
3 changes: 0 additions & 3 deletions python/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ def data_requirement(name):
def dist_info_requirement(name):
return "{macro_tmpl}".format(pip_utils.normalize_name(name), "dist_info")
def entry_point(pkg, script = None):
fail("Not implemented yet")
def install_deps(**whl_library_kwargs):
{install_deps_calls}
for wheel_name in _wheel_names:
Expand Down
5 changes: 0 additions & 5 deletions python/pip_install/pip_repository_requirements.bzl.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ def data_requirement(name):
def dist_info_requirement(name):
return "%%MACRO_TMPL%%".format(pip_utils.normalize_name(name), "dist_info")

def entry_point(pkg, script = None):
if not script:
script = pkg
return "@%%NAME%%_" + pip_utils.normalize_name(pkg) + "//:rules_python_wheel_entry_point_" + script

def _get_annotation(requirement):
# This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11`
# down to `setuptools`.
Expand Down
20 changes: 0 additions & 20 deletions python/private/bzlmod/requirements.bzl.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,3 @@ def data_requirement(name):

def dist_info_requirement(name):
return "%%MACRO_TMPL%%".format(pip_utils.normalize_name(name), "dist_info")

def entry_point(pkg, script = None):
"""entry_point returns the target of the canonical label of the package entrypoints.
"""
actual_script = script or pkg

fail("""Please replace this instance of entry_point with the following:

```
load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")

py_console_script_binary(
name = "{pkg}",
pkg = "@%%NAME%%//{pkg}",{script}
)
```
""".format(
pkg = pip_utils.normalize_name(pkg),
script = "" if not script else "\n script = \"%s\"," % actual_script,
))
9 changes: 0 additions & 9 deletions tests/integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ default_test_runner(

# TODO: add compile_pip_requirements_test_from_external_repo

rules_python_integration_test(
name = "pip_repository_entry_points_workspace_test",
timeout = "long",
bzlmod = False,
# The dependencies needed for this test are not cross-platform: https://github.com/bazelbuild/rules_python/issues/260
tags = ["fix-windows"],
workspace_path = "pip_repository_entry_points",
)

rules_python_integration_test(
name = "compile_pip_requirements_test",
)
Expand Down
10 changes: 0 additions & 10 deletions tests/integration/pip_repository_entry_points/.bazelrc

This file was deleted.

4 changes: 0 additions & 4 deletions tests/integration/pip_repository_entry_points/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions tests/integration/pip_repository_entry_points/BUILD.bazel

This file was deleted.

32 changes: 0 additions & 32 deletions tests/integration/pip_repository_entry_points/WORKSPACE

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions tests/integration/pip_repository_entry_points/requirements.in

This file was deleted.

Loading

0 comments on commit 0b6b471

Please sign in to comment.