diff --git a/.bcr/config.yml b/.bcr/config.yml index 0a31de8c..88f3683b 100644 --- a/.bcr/config.yml +++ b/.bcr/config.yml @@ -1,3 +1,3 @@ fixedReleaser: login: mattem - email: matt@aspect.dev \ No newline at end of file + email: matt@aspect.dev diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json index d0ee3a72..b2962afe 100644 --- a/.bcr/metadata.template.json +++ b/.bcr/metadata.template.json @@ -1,15 +1,13 @@ { - "homepage": "https://docs.aspect.build/rules/aspect_rules_py", - "maintainers": [ - { - "email": "hello@aspect.dev", - "github": "aspect-build", - "name": "Aspect team" - } - ], - "repository": [ - "github:aspect-build/rules_py" - ], - "versions": [], - "yanked_versions": {} + "homepage": "https://docs.aspect.build/rules/aspect_rules_py", + "maintainers": [ + { + "email": "hello@aspect.dev", + "github": "aspect-build", + "name": "Aspect team" + } + ], + "repository": ["github:aspect-build/rules_py"], + "versions": [], + "yanked_versions": {} } diff --git a/.bcr/source.template.json b/.bcr/source.template.json index acee4b17..7fb5985d 100644 --- a/.bcr/source.template.json +++ b/.bcr/source.template.json @@ -1,5 +1,5 @@ { - "integrity": "**leave this alone**", - "strip_prefix": "{REPO}-{VERSION}", - "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz" + "integrity": "**leave this alone**", + "strip_prefix": "{REPO}-{VERSION}", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz" } diff --git a/examples/django/README.md b/examples/django/README.md index 78d05290..de2ef4d7 100644 --- a/examples/django/README.md +++ b/examples/django/README.md @@ -1,6 +1,6 @@ # Django application with rules_py -This is a minimal example of using Django with rules_py. It relies on the hermetic Python 3.9 interpreter +This is a minimal example of using Django with rules_py. It relies on the hermetic Python 3.9 interpreter from rules_python and uses `pip_parse` to fetch PyPi dependencies. This demo shows the interaction of external wheels, as well as the ability to create a simple Python virtual environment @@ -12,7 +12,7 @@ To start the interactive shell, at the root of this workspace: $ bazel run django ``` -A Python virtual environment can be created that is suitable for IDE consumption. IDEs such as VSCode and PyCharm can be +A Python virtual environment can be created that is suitable for IDE consumption. IDEs such as VSCode and PyCharm can be configured to use this local venv, therefore using the bazel managed interpreter, pip and fetched PyPi packages. To create the venv, run the following: diff --git a/py/private/providers.bzl b/py/private/providers.bzl index 407629ec..d46f1481 100644 --- a/py/private/providers.bzl +++ b/py/private/providers.bzl @@ -1,3 +1,4 @@ +# buildifier: disable=module-docstring PyWheelInfo = provider( doc = "Provides information about a Python Wheel", fields = { diff --git a/py/private/py_binary.bzl b/py/private/py_binary.bzl index 8169ab76..a0bde4af 100644 --- a/py/private/py_binary.bzl +++ b/py/private/py_binary.bzl @@ -76,8 +76,8 @@ def _py_binary_rule_imp(ctx): imports = _py_library.make_imports_depset(ctx) instrumented_files_info = _py_library.make_instrumented_files_info( - ctx, - extra_source_attributes = ["main"] + ctx, + extra_source_attributes = ["main"], ) py_wheel_info = py_wheel.make_py_wheel_info(ctx, ctx.attr.deps) diff --git a/py/private/py_library.bzl b/py/private/py_library.bzl index 370a53ac..af809111 100644 --- a/py/private/py_library.bzl +++ b/py/private/py_library.bzl @@ -65,7 +65,7 @@ def _make_imports_depset(ctx): for im in ctx.attr.imports ] + [ # Add the workspace name in the imports such that repo-relative imports work. - ctx.workspace_name + ctx.workspace_name, ] return depset( diff --git a/py/private/toolchain/autodetecting.bzl b/py/private/toolchain/autodetecting.bzl index dc26f277..8fa3a27d 100644 --- a/py/private/toolchain/autodetecting.bzl +++ b/py/private/toolchain/autodetecting.bzl @@ -1,3 +1,4 @@ +# buildifier: disable=module-docstring load("//py/private:utils.bzl", "INTERPRETER_FLAGS") def _autodetecting_py_wrapper_impl(rctx): diff --git a/py/private/utils.bzl b/py/private/utils.bzl index c522f658..935822f5 100644 --- a/py/private/utils.bzl +++ b/py/private/utils.bzl @@ -1,3 +1,4 @@ +"General utilities for building python rules." PY_TOOLCHAIN = "@bazel_tools//tools/python:toolchain_type" SH_TOOLCHAIN = "@bazel_tools//tools/sh:toolchain_type" @@ -9,6 +10,7 @@ def dict_to_exports(env): for (k, v) in env.items() ] +# buildifier: disable=function-docstring def resolve_toolchain(ctx): toolchain_info = ctx.toolchains[PY_TOOLCHAIN] diff --git a/py/private/venv/venv.bzl b/py/private/venv/venv.bzl index 783bf221..c6fbc4dd 100644 --- a/py/private/venv/venv.bzl +++ b/py/private/venv/venv.bzl @@ -1,3 +1,5 @@ +"Implementations for the py_venv rule." + load("@aspect_bazel_lib//lib:paths.bzl", "BASH_RLOCATION_FUNCTION", "to_manifest_path") load("//py/private:providers.bzl", "PyWheelInfo") load("//py/private:py_library.bzl", _py_library = "py_library_utils") diff --git a/py/tests/containers/BUILD.bazel b/py/tests/containers/BUILD.bazel index bd0fff8d..9e68d321 100644 --- a/py/tests/containers/BUILD.bazel +++ b/py/tests/containers/BUILD.bazel @@ -5,12 +5,12 @@ load("//py:defs.bzl", "py_binary") py_binary( name = "main_bin", srcs = ["__main__.py"], + tags = ["manual"], deps = [ "//py/tests/containers/branding", "//py/tests/internal-deps/adder", "@pypi_colorama//:pkg", ], - tags = ["manual"], ) # py3_image container support reverts us back to the rules_python way of invoking the binary, @@ -26,8 +26,8 @@ py3_image( name = "py_image", srcs = ["__main__.py"], main = "__main__.py", - deps = [":main_bin"], tags = ["manual"], + deps = [":main_bin"], ) container_test( diff --git a/py/tests/containers/py_image_test.yaml b/py/tests/containers/py_image_test.yaml index f9d91472..9df880c5 100644 --- a/py/tests/containers/py_image_test.yaml +++ b/py/tests/containers/py_image_test.yaml @@ -11,4 +11,4 @@ commandTests: command: /usr/bin/python args: - /app/py/tests/containers/py_image.binary - expectedOutput: ["Hello rules_py - 3.14"] \ No newline at end of file + expectedOutput: ["Hello rules_py - 3.14"] diff --git a/py/tests/external-deps/custom-macro/macro.bzl b/py/tests/external-deps/custom-macro/macro.bzl index 9ed82314..a9ccb08c 100644 --- a/py/tests/external-deps/custom-macro/macro.bzl +++ b/py/tests/external-deps/custom-macro/macro.bzl @@ -1,3 +1,4 @@ +# buildifier: disable=module-docstring load("//py:defs.bzl", "py_binary", "py_library") def click_cli_binary(name, deps = [], **kwargs): diff --git a/py/tests/import-pathing/tests.bzl b/py/tests/import-pathing/tests.bzl index a9ed5d9f..c9ca2edb 100644 --- a/py/tests/import-pathing/tests.bzl +++ b/py/tests/import-pathing/tests.bzl @@ -1,3 +1,4 @@ +# buildifier: disable=module-docstring load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest") load("//py/private:py_library.bzl", _py_library = "py_library", py_library = "py_library_utils") @@ -99,6 +100,8 @@ _fails_on_absolute_imp_test = analysistest.make( expect_failure = True, ) +# buildifier: disable=function-docstring +# buildifier: disable=unnamed-macro def py_library_import_pathing_test_suite(): unittest.suite( "py_library_import_pathing_test_suite", diff --git a/py/tests/internal-deps/BUILD.bazel b/py/tests/internal-deps/BUILD.bazel index 260db2ab..0055cc02 100644 --- a/py/tests/internal-deps/BUILD.bazel +++ b/py/tests/internal-deps/BUILD.bazel @@ -1,5 +1,4 @@ load("//py:defs.bzl", "py_binary", "py_test", rules_py_py_library = "py_library") -load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") rules_py_py_library( name = "init",