Skip to content
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ repos:
- id: sync-downloader-configs
name: Sync downloader configs
language: system
entry: ./tools/private/sync_downloader_configs.py
entry: ./dev/sync_downloader_configs.py
files: downloader_config\.cfg$
pass_filenames: false
- id: gazelle
name: Run Gazelle
language: system
entry: bazel run //tools/private/gazelle
entry: bazel run //dev/gazelle
files: (\.bzl|\.bazel|BUILD|WORKSPACE(\.bzlmod)?)$
pass_filenames: false
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def main():
repo_root = Path(__file__).resolve().parent.parent.parent
repo_root = Path(__file__).resolve().parent.parent
canonical = repo_root / "downloader_config.cfg"

subworkspaces = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ licenses(["notice"])
py_library(
name = "args",
srcs = ["args.py"],
imports = ["../../.."],
imports = ["../.."],
deps = ["//python/runfiles"],
)

py_library(
name = "update_file",
srcs = ["update_file.py"],
imports = ["../../.."],
imports = ["../.."],
)

py_binary(
Expand All @@ -40,7 +40,7 @@ py_binary(
env = {
"UPDATE_FILE": "$(rlocationpath //python/private:coverage_deps_filegroup)",
},
imports = ["../../.."],
imports = ["../.."],
deps = [
":args",
":update_file",
Expand All @@ -58,7 +58,7 @@ py_binary(
"DEPS_BZL": "$(rlocationpath //python/private/pypi:deps.bzl)",
"REQUIREMENTS_TXT": "$(rlocationpath //python/private/pypi:requirements_txt)",
},
imports = ["../../.."],
imports = ["../.."],
visibility = ["//:__subpackages__"],
deps = [
":args",
Expand All @@ -69,7 +69,7 @@ py_binary(
pytest_test(
name = "update_file_test",
srcs = ["update_file_test.py"],
imports = ["../../.."],
imports = ["../.."],
target_compatible_with = SUPPORTS_BZLMOD,
deps = [
":update_file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def path_from_runfiles(input: str) -> pathlib.Path:
Returns:
the pathlib.Path path to a file which is verified to exist.
"""
rf = runfiles.Create()
assert rf is not None # type assert
rf = runfiles.CreateOrRaise()
rlocation_path = rf.Rlocation(input)
assert rlocation_path is not None # type assert
path = pathlib.Path(rlocation_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from typing import Any
from urllib import request

from tools.private.update_deps.args import path_from_runfiles
from tools.private.update_deps.update_file import update_file
from dev.update_deps.args import path_from_runfiles
from dev.update_deps.update_file import update_file

# This should be kept in sync with //python:versions.bzl
_supported_platforms = {
Expand Down Expand Up @@ -208,8 +208,8 @@ def main():
"",
]
),
start_marker="# START: maintained by 'bazel run //tools/private/update_deps:update_coverage_deps <version>'",
end_marker="# END: maintained by 'bazel run //tools/private/update_deps:update_coverage_deps <version>'",
start_marker="# START: maintained by 'bazel run //dev/update_deps:update_coverage_deps <version>'",
end_marker="# END: maintained by 'bazel run //dev/update_deps:update_coverage_deps <version>'",
dry_run=args.dry_run,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ def update_file(
_writelines(path, out)
return

relative = path.relative_to(
pathlib.Path(__file__).resolve().parent.parent.parent.parent
)
relative = path.relative_to(pathlib.Path(__file__).resolve().parent.parent.parent)
name = f"{relative}"
diff = unified_diff(name, current, out)
if diff:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import pytest

from tools.private.update_deps.update_file import replace_snippet, unified_diff
from dev.update_deps.update_file import replace_snippet, unified_diff


def test_replace_simple():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

from pip._internal.cli.main import main as pip_main # pyrefly: ignore[missing-import]

from tools.private.update_deps.args import path_from_runfiles
from tools.private.update_deps.update_file import update_file
from dev.update_deps.args import path_from_runfiles
from dev.update_deps.update_file import update_file


@dataclass
Expand Down Expand Up @@ -111,13 +111,13 @@ def main():
parser.add_argument(
"--start",
type=str,
default="# START: maintained by 'bazel run //tools/private/update_deps:update_pip_deps'",
default="# START: maintained by 'bazel run //dev/update_deps:update_pip_deps'",
help="The text to match in a file when updating them.",
)
parser.add_argument(
"--end",
type=str,
default="# END: maintained by 'bazel run //tools/private/update_deps:update_pip_deps'",
default="# END: maintained by 'bazel run //dev/update_deps:update_pip_deps'",
help="The text to match in a file when updating them.",
)
parser.add_argument(
Expand Down
6 changes: 3 additions & 3 deletions docs/devguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ integration test.

1. Modify the `./python/private/pypi/requirements.txt` file and run:
```
bazel run //tools/private/update_deps:update_pip_deps
bazel run //dev/update_deps:update_pip_deps
```
1. Run the following target to update `twine` dependencies:
```
bazel run //dev:all_requirements.update
```
1. Bump the coverage dependencies using the script using:
```
bazel run //tools/private/update_deps:update_coverage_deps <VERSION>
bazel run //dev/update_deps:update_coverage_deps <VERSION>
# for example:
# bazel run //tools/private/update_deps:update_coverage_deps 7.10.7
# bazel run //dev/update_deps:update_coverage_deps 7.10.7
```

## Updating tool dependencies
Expand Down
2 changes: 1 addition & 1 deletion python/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ filegroup(
filegroup(
name = "coverage_deps_filegroup",
srcs = ["coverage_deps.bzl"],
visibility = ["//tools/private/update_deps:__pkg__"],
visibility = ["//:__subpackages__"],
)

# Filegroup of bzl files that can be used by downstream rules for documentation generation
Expand Down
4 changes: 2 additions & 2 deletions python/private/coverage_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//python/private:version_label.bzl", "version_label")

# START: maintained by 'bazel run //tools/private/update_deps:update_coverage_deps <version>'
# START: maintained by 'bazel run //dev/update_deps:update_coverage_deps <version>'
_default = (
"https://files.pythonhosted.org/packages/ec/16/114df1c291c22cac3b0c127a73e0af5c12ed7bbb6558d310429a0ae24023/coverage-7.10.7-py3-none-any.whl",
"f7941f6f2fe6dd6807a1208737b8a0cbcf1cc6d7b07d24998ad2d63590868260",
Expand Down Expand Up @@ -166,7 +166,7 @@ _coverage_deps = {
),
},
}
# END: maintained by 'bazel run //tools/private/update_deps:update_coverage_deps <version>'
# END: maintained by 'bazel run //dev/update_deps:update_coverage_deps <version>'

_coverage_patch = Label("//python/private:coverage.patch")

Expand Down
9 changes: 3 additions & 6 deletions python/private/pypi/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ alias(

exports_files(
srcs = ["deps.bzl"],
visibility = ["//tools/private/update_deps:__pkg__"],
visibility = ["//:__subpackages__"],
)

filegroup(
Expand All @@ -86,16 +86,13 @@ filegroup(
filegroup(
name = "bzl",
srcs = glob(["**/*.bzl"]),
visibility = [
"//python/private:__pkg__",
"//tools/private:__pkg__",
],
visibility = ["//:__subpackages__"],
)

filegroup(
name = "requirements_txt",
srcs = ["requirements.txt"],
visibility = ["//tools/private/update_deps:__pkg__"],
visibility = ["//:__subpackages__"],
)

bzl_library(
Expand Down
4 changes: 2 additions & 2 deletions python/private/pypi/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

_RULE_DEPS = [
# START: maintained by 'bazel run //tools/private/update_deps:update_pip_deps'
# START: maintained by 'bazel run //dev/update_deps:update_pip_deps'
(
"pypi__build",
"https://files.pythonhosted.org/packages/c5/0d/84a4380f930db0010168e0aa7b7a8fed9ba1835a8fbb1472bc6d0201d529/build-1.4.0-py3-none-any.whl",
Expand Down Expand Up @@ -94,7 +94,7 @@ _RULE_DEPS = [
"https://files.pythonhosted.org/packages/2e/54/647ade08bf0db230bfea292f893923872fd20be6ac6f53b2b936ba839d75/zipp-3.23.0-py3-none-any.whl",
"071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e",
),
# END: maintained by 'bazel run //tools/private/update_deps:update_pip_deps'
# END: maintained by 'bazel run //dev/update_deps:update_pip_deps'
]

_GENERIC_WHEEL = """\
Expand Down
3 changes: 1 addition & 2 deletions python/uv/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ bzl_library(
name = "lock",
srcs = ["lock.bzl"],
visibility = [
"//python/uv:__subpackages__",
"//tools/private:__subpackages__",
"//:__subpackages__",
],
deps = [
":toolchain_types",
Expand Down
2 changes: 1 addition & 1 deletion tools/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ filegroup(
bzl_library(
name = "publish_deps",
srcs = ["publish_deps.bzl"],
deps = ["//python/uv/private:lock"],
deps = ["//python/uv:lock"],
)
6 changes: 3 additions & 3 deletions tools/private/publish_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""A simple macro to lock the requirements for twine
"""

load("//python/uv/private:lock.bzl", "lock") # buildifier: disable=bzl-visibility
load("//python/uv:lock.bzl", "lock")

def publish_deps(*, name, args, outs, **kwargs):
"""Generate all of the requirements files for all platforms.
Expand All @@ -27,9 +27,9 @@ def publish_deps(*, name, args, outs, **kwargs):
for each requirement file to be generated.
**kwargs: Extra args passed to the {rule}`lock` rule.
"""
all_args = args
all_args = list(args or [])
for out, platform in outs.items():
args = [] + all_args
args = list(all_args)
if platform:
args.append("--python-platform=" + platform)
else:
Expand Down