Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: run pre-commit on all files #199

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fixedReleaser:
login: mattem
email: [email protected]
email: [email protected]
24 changes: 11 additions & 13 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"homepage": "https://docs.aspect.build/rules/aspect_rules_py",
"maintainers": [
{
"email": "[email protected]",
"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": "[email protected]",
"github": "aspect-build",
"name": "Aspect team"
}
],
"repository": ["github:aspect-build/rules_py"],
"versions": [],
"yanked_versions": {}
}
6 changes: 3 additions & 3 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -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"
}
4 changes: 2 additions & 2 deletions examples/django/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions py/private/providers.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# buildifier: disable=module-docstring
PyWheelInfo = provider(
doc = "Provides information about a Python Wheel",
fields = {
Expand Down
4 changes: 2 additions & 2 deletions py/private/py_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion py/private/py_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions py/private/toolchain/autodetecting.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# buildifier: disable=module-docstring
load("//py/private:utils.bzl", "INTERPRETER_FLAGS")

def _autodetecting_py_wrapper_impl(rctx):
Expand Down
2 changes: 2 additions & 0 deletions py/private/utils.bzl
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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]

Expand Down
2 changes: 2 additions & 0 deletions py/private/venv/venv.bzl
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
4 changes: 2 additions & 2 deletions py/tests/containers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion py/tests/containers/py_image_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ commandTests:
command: /usr/bin/python
args:
- /app/py/tests/containers/py_image.binary
expectedOutput: ["Hello rules_py - 3.14"]
expectedOutput: ["Hello rules_py - 3.14"]
1 change: 1 addition & 0 deletions py/tests/external-deps/custom-macro/macro.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# buildifier: disable=module-docstring
load("//py:defs.bzl", "py_binary", "py_library")

def click_cli_binary(name, deps = [], **kwargs):
Expand Down
3 changes: 3 additions & 0 deletions py/tests/import-pathing/tests.bzl
Original file line number Diff line number Diff line change
@@ -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")

Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion py/tests/internal-deps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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",
Expand Down