diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json index e033173..562a9bc 100644 --- a/.bcr/metadata.template.json +++ b/.bcr/metadata.template.json @@ -1,5 +1,5 @@ { - "homepage": "https://github.com/oxidase/rules_ophiuchus", + "homepage": "https://github.com/oxidase/ofiuco", "maintainers": [ { "email": "michael.krasnyk@gmail.com", @@ -8,7 +8,7 @@ } ], "repository": [ - "github:oxidase/rules_ophiuchus" + "github:oxidase/ofiuco" ], "versions": [], "yanked_versions": {} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index 6de95da..a11a74d 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -12,8 +12,8 @@ tasks: platform: ${{ platform }} bazel: ${{ bazel }} build_targets: - - '@rules_ophiuchus//python/...' - - '@rules_ophiuchus//lib/...' + - '@ofiuco//python/...' + - '@ofiuco//lib/...' bcr_test_module: module_path: "examples/transitions" matrix: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b31858..cd608e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,6 @@ on: jobs: test: - name: Test rules_ophiuchus runs-on: ${{ matrix.os }} timeout-minutes: 40 strategy: diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4fa6885..4c03f31 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -20,6 +20,11 @@ jobs: run: | set -euo pipefail + export RULES_PYTHON_RELEASE=$(curl -s https://api.github.com/repos/bazelbuild/rules_python/releases/latest | jq -c .) + export RULES_PYTHON_TAG=$(echo $RULES_PYTHON_RELEASE | jq -r '.tag_name') + export RULES_PYTHON_URL=$(echo $RULES_PYTHON_RELEASE | jq -r '.assets[].browser_download_url') + export RULES_PYTHON_SHA256=$(curl -s $RULES_PYTHON_URL | sha256sum) + git config user.name "${{ github.triggering_actor }}" git config user.email "${{ github.triggering_actor }}@users.noreply.github.com" @@ -33,6 +38,6 @@ jobs: cat .github/workflows/release-notes.md | envsubst > notes.md gh release create "v$TAG" --title "$TAG" --target $sha --generate-notes --notes "$(cat notes.md)" $ARCHIVE env: - NAME: "rules_ophiuchus" + NAME: "ofiuco" TAG: ${{ inputs.tag }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-notes.md b/.github/workflows/release-notes.md index 910b0ae..b22ac63 100644 --- a/.github/workflows/release-notes.md +++ b/.github/workflows/release-notes.md @@ -5,9 +5,9 @@ Add to your `MODULE.bazel` file: * for packaging and dependency management with [Poetry](https://python-poetry.org/) ```starlark -bazel_dep(name = "rules_ophiuchus", version = "${TAG}") +bazel_dep(name = "ofiuco", version = "${TAG}") -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "//:poetry.lock", @@ -25,17 +25,36 @@ Paste this snippet into your `WORKSPACE` file: ```starlark load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +toolchain_name = "python" +python_version = "3.12" + +# Setup rules_python +http_archive( + name = "rules_python", + sha256 = "${RULES_PYTHON_SHA256}", + strip_prefix = "rules_python-${RULES_PYTHON_TAG}", + url = "${RULES_PYTHON_URL}", +) + +load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") + +py_repositories() + +python_register_toolchains(toolchain_name, python_version) + +# Setup ofiuco http_archive( - name = "rules_ophiuchus", + name = "ofiuco", sha256 = "${SHA256}", strip_prefix = "${PREFIX}", - url = "https://github.com/oxidase/rules_ophiuchus/releases/download/v${TAG}/${ARCHIVE}", + url = "https://github.com/oxidase/ofiuco/releases/download/v${TAG}/${ARCHIVE}", ) -load("@rules_ophiuchus//python:poetry_parse.bzl", "poetry_parse") -load("@rules_ophiuchus//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") +load("@ofiuco//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") + +install_poetry_dependencies(toolchain_name, python_version) -install_poetry_dependencies() +load("@ofiuco//python:poetry_parse.bzl", "poetry_parse") poetry_parse( name = "poetry", diff --git a/AUTHORS b/AUTHORS index 993ffee..a5f473d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -# This the official list of rules_ophiuchus authors for copyright purposes. +# This the official list of ofiuco authors for copyright purposes. # This file is distinct from the CONTRIBUTORS files. # See the latter for an explanation. diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d393d..68e518a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,26 +13,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Fixed -## [v0.2.0](https://github.com/oxidase/rules_ophiuchus/tree/v0.2.0) - 2023-05-18 +## [v0.2.0](https://github.com/oxidase/ofiuco/tree/v0.2.0) - 2023-05-18 -[Full Changelog](https://github.com/oxidase/rules_ophiuchus/compare/v0.1.0...v0.2.0) +[Full Changelog](https://github.com/oxidase/ofiuco/compare/v0.1.0...v0.2.0) ### Added -- chore: add transitions example [#25](https://github.com/oxidase/rules_ophiuchus/pull/25) -- feat: split download and install steps [#23](https://github.com/oxidase/rules_ophiuchus/pull/23) -- feat: add interpreter_markers attribute [#22](https://github.com/oxidase/rules_ophiuchus/pull/22) -- feat: add source_url argument [#21](https://github.com/oxidase/rules_ophiuchus/pull/21) -- feat: remove awk dependency [#14](https://github.com/oxidase/rules_ophiuchus/pull/14) -- feat: add py_zip rule [#13](https://github.com/oxidase/rules_ophiuchus/pull/13) +- chore: add transitions example [#25](https://github.com/oxidase/ofiuco/pull/25) +- feat: split download and install steps [#23](https://github.com/oxidase/ofiuco/pull/23) +- feat: add interpreter_markers attribute [#22](https://github.com/oxidase/ofiuco/pull/22) +- feat: add source_url argument [#21](https://github.com/oxidase/ofiuco/pull/21) +- feat: remove awk dependency [#14](https://github.com/oxidase/ofiuco/pull/14) +- feat: add py_zip rule [#13](https://github.com/oxidase/ofiuco/pull/13) ### Fixed -- fix: add platform_machine to platform tags [#24](https://github.com/oxidase/rules_ophiuchus/pull/24) -- fix: cleanup [#15](https://github.com/oxidase/rules_ophiuchus/pull/15) -- fix: workflows naming [#11](https://github.com/oxidase/rules_ophiuchus/pull/11) +- fix: add platform_machine to platform tags [#24](https://github.com/oxidase/ofiuco/pull/24) +- fix: cleanup [#15](https://github.com/oxidase/ofiuco/pull/15) +- fix: workflows naming [#11](https://github.com/oxidase/ofiuco/pull/11) -## [v0.1.0](https://github.com/oxidase/rules_ophiuchus/tree/v0.1.0) - 2023-04-01 +## [v0.1.0](https://github.com/oxidase/ofiuco/tree/v0.1.0) - 2023-04-01 -[Full Changelog](https://github.com/oxidase/rules_ophiuchus/compare/6f8ac8716f8ab65d115c678feed3a473f71ebcfb...v0.1.0) +[Full Changelog](https://github.com/oxidase/ofiuco/compare/6f8ac8716f8ab65d115c678feed3a473f71ebcfb...v0.1.0) diff --git a/MODULE.bazel b/MODULE.bazel index 02d6d6b..8032536 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,5 +1,5 @@ module( - name = "rules_ophiuchus", + name = "ofiuco", version = "0", compatibility_level = 1, ) @@ -11,5 +11,5 @@ bazel_dep(name = "rules_python", version = "0.33.2") python = use_extension("@rules_python//python/extensions:python.bzl", "python") use_repo(python, "python_3_11_host") -internal_deps = use_extension("@rules_ophiuchus//python:internal_deps.bzl", "internal_deps") -use_repo(internal_deps, "rules_ophiuchus_defs", "rules_ophiuchus_pip", "rules_ophiuchus_poetry_deps") +internal_deps = use_extension("@ofiuco//python:internal_deps.bzl", "internal_deps") +use_repo(internal_deps, "ofiuco_defs", "ofiuco_pip", "ofiuco_poetry_deps") diff --git a/README.md b/README.md index 6f7bfc1..5863f66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ⛎ Ophiuchus Rules for Bazel +# ⛎ Ofiuco Rules for Bazel ## Overview @@ -12,9 +12,9 @@ Minimum requirements: ## Getting started -### Import `rules_ophiuchus` as a module +### Import `ofiuco` as a module -To import `rules_ophiuchus` in your project, you first need to add it to your `MODULE.bazel` file +To import `ofiuco` in your project, you first need to add it to your `MODULE.bazel` file ```python bazel_dep(name = "rules_python", version = "0.33.2") @@ -23,9 +23,9 @@ python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain(python_version = "3.12") use_repo(python, "python_3_12") -bazel_dep(name = "rules_ophiuchus", version = "0.3.7") +bazel_dep(name = "ofiuco", version = "0.3.7") -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "@//path/to:poetry.lock", @@ -57,7 +57,7 @@ poetry update or using a pre-defined target ``` -load("@rules_ophiuchus//python:poetry.bzl", "poetry_update") +load("@ofiuco//python:poetry.bzl", "poetry_update") poetry_update( name = "update_lock", diff --git a/WORKSPACE b/WORKSPACE index 4f9718f..1b58da5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1 +1 @@ -workspace(name = "rules_ophiuchus") +workspace(name = "ofiuco") diff --git a/examples/aspect_rules_py/MODULE.bazel b/examples/aspect_rules_py/MODULE.bazel index 1a8f243..2cdaf46 100644 --- a/examples/aspect_rules_py/MODULE.bazel +++ b/examples/aspect_rules_py/MODULE.bazel @@ -16,13 +16,13 @@ python.toolchain( ) use_repo(python, "python_3_11") -bazel_dep(name = "rules_ophiuchus", version = "0.0.0") +bazel_dep(name = "ofiuco", version = "0.0.0") local_path_override( - module_name = "rules_ophiuchus", + module_name = "ofiuco", path = "../..", ) -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "//:poetry.lock", diff --git a/examples/cc_toolchain/MODULE.bazel b/examples/cc_toolchain/MODULE.bazel index 28c28a4..6afffb6 100644 --- a/examples/cc_toolchain/MODULE.bazel +++ b/examples/cc_toolchain/MODULE.bazel @@ -4,13 +4,13 @@ python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain(python_version = "3.12") use_repo(python, "python_3_12") -bazel_dep(name = "rules_ophiuchus", version = "0.0.0") +bazel_dep(name = "ofiuco", version = "0.0.0") local_path_override( - module_name = "rules_ophiuchus", + module_name = "ofiuco", path = "../..", ) -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "//:poetry.lock", diff --git a/examples/integration_test.sh b/examples/integration_test.sh index 62fa4f4..efc406f 100755 --- a/examples/integration_test.sh +++ b/examples/integration_test.sh @@ -8,8 +8,8 @@ export HOME=$TEST_TMPDIR cd examples/$1 ARGS="--test_output=errors --spawn_strategy=local --verbose_failures" -ARGS="$ARGS --override_repository=rules_ophiuchus=$BUILD_WORKSPACE_DIRECTORY" -[ -f MODULE.bazel ] && ARGS="$ARGS --override_module=rules_ophiuchus=$BUILD_WORKSPACE_DIRECTORY" +ARGS="$ARGS --override_repository=ofiuco=$BUILD_WORKSPACE_DIRECTORY" +[ -f MODULE.bazel ] && ARGS="$ARGS --override_module=ofiuco=$BUILD_WORKSPACE_DIRECTORY" echo "Using $(bazelisk version)" bazelisk test ... $ARGS diff --git a/examples/markers/BUILD.bazel b/examples/markers/BUILD.bazel index 5cfa7d4..518e8c1 100644 --- a/examples/markers/BUILD.bazel +++ b/examples/markers/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_ophiuchus//python:poetry.bzl", "poetry_update") +load("@ofiuco//python:poetry.bzl", "poetry_update") py_test( name = "test", diff --git a/examples/markers/MODULE.bazel b/examples/markers/MODULE.bazel index aac38f2..9c79f17 100644 --- a/examples/markers/MODULE.bazel +++ b/examples/markers/MODULE.bazel @@ -11,13 +11,13 @@ use_repo( "python_" + python_version, ) -bazel_dep(name = "rules_ophiuchus", version = "0.0.0") +bazel_dep(name = "ofiuco", version = "0.0.0") local_path_override( - module_name = "rules_ophiuchus", + module_name = "ofiuco", path = "../..", ) -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "python", lock = "//:poetry.lock", diff --git a/examples/simple/BUILD.bazel b/examples/simple/BUILD.bazel index 13c9795..481be27 100644 --- a/examples/simple/BUILD.bazel +++ b/examples/simple/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_ophiuchus//python:poetry.bzl", "poetry_update") +load("@ofiuco//python:poetry.bzl", "poetry_update") py_test( name = "test", diff --git a/examples/simple/MODULE.bazel b/examples/simple/MODULE.bazel index 28c28a4..6afffb6 100644 --- a/examples/simple/MODULE.bazel +++ b/examples/simple/MODULE.bazel @@ -4,13 +4,13 @@ python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain(python_version = "3.12") use_repo(python, "python_3_12") -bazel_dep(name = "rules_ophiuchus", version = "0.0.0") +bazel_dep(name = "ofiuco", version = "0.0.0") local_path_override( - module_name = "rules_ophiuchus", + module_name = "ofiuco", path = "../..", ) -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "//:poetry.lock", diff --git a/examples/simple/README.md b/examples/simple/README.md index 1c41ea5..bf14474 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -1,6 +1,6 @@ # Simple example -This example shows how to use rules_ophiuchus to fetch external dependencies from a pyproject.toml file +This example shows how to use `ofiuco` to fetch external dependencies from a pyproject.toml file and than use in BUILD files as dependencies of Bazel targets. The `poetry.lock` file can be updated with diff --git a/examples/torch/BUILD.bazel b/examples/torch/BUILD.bazel index f6b9198..1ab20c4 100644 --- a/examples/torch/BUILD.bazel +++ b/examples/torch/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_ophiuchus//python:poetry.bzl", "poetry_update") -load("@rules_ophiuchus//python:py_venv.bzl", "py_venv") +load("@ofiuco//python:poetry.bzl", "poetry_update") +load("@ofiuco//python:py_venv.bzl", "py_venv") py_venv( name = "torch_venv", diff --git a/examples/torch/MODULE.bazel b/examples/torch/MODULE.bazel index 28c28a4..6afffb6 100644 --- a/examples/torch/MODULE.bazel +++ b/examples/torch/MODULE.bazel @@ -4,13 +4,13 @@ python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain(python_version = "3.12") use_repo(python, "python_3_12") -bazel_dep(name = "rules_ophiuchus", version = "0.0.0") +bazel_dep(name = "ofiuco", version = "0.0.0") local_path_override( - module_name = "rules_ophiuchus", + module_name = "ofiuco", path = "../..", ) -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "//:poetry.lock", diff --git a/examples/torch/README.md b/examples/torch/README.md index ccc16ad..511792e 100644 --- a/examples/torch/README.md +++ b/examples/torch/README.md @@ -1,6 +1,6 @@ # Torch example -This example shows how to use rules_ophiuchus to fetch external dependencies from a pyproject.toml file +This example shows how to use `ofiuco` to fetch external dependencies from a pyproject.toml file using PyPI repository and a direct URL as ``` torch = [ @@ -26,14 +26,14 @@ __init__.py cublas cuda_cupti cuda_nvrtc cuda_runtime cudnn cufft curand ls -l bazel-bin/venv/torch_venv/nvidia/cudnn/lib/ total 32 -lrwxrwxrwx 1 test test 128 Mar 25 10:31 __init__.py -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/__init__.py -lrwxrwxrwx 1 test test 130 Mar 25 10:31 libcudnn.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn.so.8 -lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_adv_infer.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_adv_infer.so.8 -lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_adv_train.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_adv_train.so.8 -lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_cnn_infer.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_cnn_infer.so.8 -lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_cnn_train.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_cnn_train.so.8 -lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_ops_infer.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_ops_infer.so.8 -lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_ops_train.so.8 -> ../../../../../external/rules_ophiuchus~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_ops_train.so.8 +lrwxrwxrwx 1 test test 128 Mar 25 10:31 __init__.py -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/__init__.py +lrwxrwxrwx 1 test test 130 Mar 25 10:31 libcudnn.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn.so.8 +lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_adv_infer.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_adv_infer.so.8 +lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_adv_train.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_adv_train.so.8 +lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_cnn_infer.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_cnn_infer.so.8 +lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_cnn_train.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_cnn_train.so.8 +lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_ops_infer.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_ops_infer.so.8 +lrwxrwxrwx 1 test test 140 Mar 25 10:31 libcudnn_ops_train.so.8 -> ../../../../../external/ofiuco~~poetry~poetry/3.12/x86_64-unknown-linux-gnu/nvidia-cudnn-cu12/nvidia/cudnn/lib/libcudnn_ops_train.so.8 ``` diff --git a/examples/transitions/BUILD.bazel b/examples/transitions/BUILD.bazel index 01bf28b..2d4a6f0 100644 --- a/examples/transitions/BUILD.bazel +++ b/examples/transitions/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel_tools//tools/cpp:empty_cc_toolchain_config.bzl", "cc_toolchain_config") -load("@rules_ophiuchus//lib:py_zip.bzl", "py_zip") +load("@ofiuco//lib:py_zip.bzl", "py_zip") load(":transitions.bzl", "py_binary_linux_x86_64") platform( diff --git a/examples/transitions/MODULE.bazel b/examples/transitions/MODULE.bazel index 571d826..17f339a 100644 --- a/examples/transitions/MODULE.bazel +++ b/examples/transitions/MODULE.bazel @@ -5,13 +5,13 @@ python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain(python_version = "3.12") use_repo(python, "python_3_12") -bazel_dep(name = "rules_ophiuchus", version = "0.0.0") +bazel_dep(name = "ofiuco", version = "0.0.0") local_path_override( - module_name = "rules_ophiuchus", + module_name = "ofiuco", path = "../..", ) -poetry = use_extension("@rules_ophiuchus//python:extensions.bzl", "poetry") +poetry = use_extension("@ofiuco//python:extensions.bzl", "poetry") poetry.parse( name = "poetry", lock = "//:poetry.lock", diff --git a/examples/transitions/README.md b/examples/transitions/README.md index 005b60e..b47b6b4 100644 --- a/examples/transitions/README.md +++ b/examples/transitions/README.md @@ -1,6 +1,6 @@ # Transitions example -This example shows how to use rules_ophiuchus to fetch external dependencies for different platforms and build Python artifacts. +This example shows how to use `ofiuco` to fetch external dependencies for different platforms and build Python artifacts. The test asserts that `deploy_arm64.zip`,`deploy_win.zip`, and `deploy_x86_64.zip` contain dynamic libraries files that have corresponding to platform flags. Some Windows packages are cross-platform and contain PE files for Intel 386 or later processors, x64_64, and ARM64 little endian processors. diff --git a/examples/workspace/README.md b/examples/workspace/README.md index e21fc53..8ad92ce 100644 --- a/examples/workspace/README.md +++ b/examples/workspace/README.md @@ -2,13 +2,13 @@ Explicitly set `--enable_bzlmod=false` to disable bzlmod. -Add rules_ophiuchus to `WORKSPACE` file as +Add `ofiuco` to `WORKSPACE` file as ``` -load("@rules_ophiuchus//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") +load("@ofiuco//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") install_poetry_dependencies("black_mamba", "3.11") -load("@rules_ophiuchus//python:poetry_parse.bzl", "poetry_parse") +load("@ofiuco//python:poetry_parse.bzl", "poetry_parse") poetry_parse( name = "poetry", diff --git a/examples/workspace/WORKSPACE b/examples/workspace/WORKSPACE index 6f8e3cd..841e35b 100644 --- a/examples/workspace/WORKSPACE +++ b/examples/workspace/WORKSPACE @@ -14,15 +14,15 @@ py_repositories() python_register_toolchains("black_mamba", "3.11") local_repository( - name = "rules_ophiuchus", + name = "ofiuco", path = "../..", ) -load("@rules_ophiuchus//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") +load("@ofiuco//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") install_poetry_dependencies("black_mamba", "3.11") -load("@rules_ophiuchus//python:poetry_parse.bzl", "poetry_parse") +load("@ofiuco//python:poetry_parse.bzl", "poetry_parse") poetry_parse( name = "poetry", diff --git a/examples/workspace_multi/README.md b/examples/workspace_multi/README.md index 849034b..2c7b422 100644 --- a/examples/workspace_multi/README.md +++ b/examples/workspace_multi/README.md @@ -2,13 +2,13 @@ Explicitly set `--enable_bzlmod=false` to disable bzlmod. -Add rules_ophiuchus to `WORKSPACE` file as +Add `ofiuco` to `WORKSPACE` file as ``` -load("@rules_ophiuchus//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") +load("@ofiuco//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") install_poetry_dependencies("copperhead_3_11", "3.11") -load("@rules_ophiuchus//python:poetry_parse.bzl", "poetry_parse") +load("@ofiuco//python:poetry_parse.bzl", "poetry_parse") poetry_parse( name = "poetry_repo1", diff --git a/examples/workspace_multi/WORKSPACE b/examples/workspace_multi/WORKSPACE index 623a9c7..a50d96d 100644 --- a/examples/workspace_multi/WORKSPACE +++ b/examples/workspace_multi/WORKSPACE @@ -27,15 +27,15 @@ python_register_multi_toolchains( ) local_repository( - name = "rules_ophiuchus", + name = "ofiuco", path = "../..", ) -load("@rules_ophiuchus//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") +load("@ofiuco//python:repositories.bzl", install_poetry_dependencies = "install_dependencies") install_poetry_dependencies("copperhead_3_11", "3.11") -load("@rules_ophiuchus//python:poetry_parse.bzl", "poetry_parse") +load("@ofiuco//python:poetry_parse.bzl", "poetry_parse") poetry_parse( name = "poetry_repo1", diff --git a/lib/tests/BUILD b/lib/tests/BUILD index 8bd3092..7e012bf 100644 --- a/lib/tests/BUILD +++ b/lib/tests/BUILD @@ -11,7 +11,7 @@ runfiles_test_suite() filegroup( name = "test_filegroup", srcs = [ - "@rules_ophiuchus_pip//:pkg", + "@ofiuco_pip//:pkg", ], data = [ "BUILD", diff --git a/lib/tests/py_zip_test.bzl b/lib/tests/py_zip_test.bzl index 71895d7..25429c7 100644 --- a/lib/tests/py_zip_test.bzl +++ b/lib/tests/py_zip_test.bzl @@ -23,13 +23,13 @@ py_zip_test = analysistest.make(_py_zip_test_impl) def _test_py_zip(): py_zip( name = "test_py_zip_contents_subject", - target = "@rules_ophiuchus_pip//:pkg", + target = "@ofiuco_pip//:pkg", exclude = EXCLUDE, ) py_zip( name = "test_py_zip_transition_subject", - target = "@rules_ophiuchus_pip//:pkg", + target = "@ofiuco_pip//:pkg", platform = ":lambda", exclude = EXCLUDE, ) diff --git a/lib/tests/py_zip_validator.sh b/lib/tests/py_zip_validator.sh index 1cbdb4a..6f4d046 100755 --- a/lib/tests/py_zip_validator.sh +++ b/lib/tests/py_zip_validator.sh @@ -5,7 +5,7 @@ do file=${!i} if [[ $file == *.json ]] ; then grep -qc PYTHONPATH $file || exit 1 - grep -qc rules_ophiuchus_pip $file || exit 1 + grep -qc ofiuco_pip $file || exit 1 fi if [[ $file == *.zip ]] ; then unzip -l $file | grep -qce '.*_main.*.py$' || exit 1 diff --git a/lib/tests/runfiles_test.bzl b/lib/tests/runfiles_test.bzl index 99a8b5b..6cec7b1 100644 --- a/lib/tests/runfiles_test.bzl +++ b/lib/tests/runfiles_test.bzl @@ -80,7 +80,7 @@ def _test_runfiles_provider_external_workspace(): data = [":test_filegroup"], workspace = ["?**"], include = ["*/_main~**"], - exclude = ["**/*.dist-info/*", "**__*__???", "**_vendor**", "**.typed", "**ophiuchus_pip/*"], + exclude = ["**/*.dist-info/*", "**__*__???", "**_vendor**", "**.typed", "**ofiuco_pip/*"], ) runfiles_provider_external_workspace_test( diff --git a/pyproject.toml b/pyproject.toml index 0be10ff..5756ffe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ multi_line_output = 3 no_lines_before = "LOCALFOLDER" py_version = 311 skip = [ - "bazel-rules_ophiuchus", + "bazel-ofiuco", "bazel-bin", "bazel-out", "bazel-testlogs", @@ -33,7 +33,7 @@ version = "0.1.0" description = "" authors = ["Michael Krasnyk "] readme = "README.md" -packages = [{include = "rules_ophiuchus"}] +packages = [{include = "ofiuco"}] [tool.poetry.dependencies] python = "^3.9" diff --git a/python/BUILD b/python/BUILD index 558212a..75674d4 100644 --- a/python/BUILD +++ b/python/BUILD @@ -4,7 +4,7 @@ py_binary( visibility = ["__subpackages__"], deps = [ ":utils", - "@rules_ophiuchus_pip//:pkg", + "@ofiuco_pip//:pkg", ], ) diff --git a/python/extensions.bzl b/python/extensions.bzl index 4cfa61e..a9cbbd0 100644 --- a/python/extensions.bzl +++ b/python/extensions.bzl @@ -1,4 +1,4 @@ -load("@rules_ophiuchus//python:poetry_parse.bzl", "poetry_parse") +load("@ofiuco//python:poetry_parse.bzl", "poetry_parse") def _poetry_impl(module_ctx): for mod in module_ctx.modules: diff --git a/python/internal_deps.bzl b/python/internal_deps.bzl index bf658c8..9256e41 100644 --- a/python/internal_deps.bzl +++ b/python/internal_deps.bzl @@ -1,4 +1,4 @@ -load("@rules_ophiuchus//python:repositories.bzl", "install_dependencies") +load("@ofiuco//python:repositories.bzl", "install_dependencies") def _internal_deps_impl(module_ctx): install_dependencies("python_3_11", "3.11") diff --git a/python/poetry.bzl b/python/poetry.bzl index b654f26..906afe6 100644 --- a/python/poetry.bzl +++ b/python/poetry.bzl @@ -48,7 +48,7 @@ poetry_update = rule( "toml": attr.label(allow_single_file = [".toml"]), "lock": attr.label(allow_single_file = [".lock"]), "update": attr.bool(default = True), - "_poetry_deps": attr.label(default = "@rules_ophiuchus_poetry_deps//:pkg"), + "_poetry_deps": attr.label(default = "@ofiuco_poetry_deps//:pkg"), }, toolchains = [ "@bazel_tools//tools/python:toolchain_type", diff --git a/python/private/poetry_deps.bzl b/python/private/poetry_deps.bzl index f64db5c..4910425 100644 --- a/python/private/poetry_deps.bzl +++ b/python/private/poetry_deps.bzl @@ -1,4 +1,4 @@ -load("@rules_ophiuchus_defs//:defs.bzl", _python_toolchain_prefix = "python_toolchain_prefix", _python_version = "python_version") +load("@ofiuco_defs//:defs.bzl", _python_toolchain_prefix = "python_toolchain_prefix", _python_version = "python_version") load("@rules_python//python:defs.bzl", StarPyInfo = "PyInfo") load("@rules_python//python:versions.bzl", _MINOR_MAPPING = "MINOR_MAPPING") load("//python:markers.bzl", "evaluate", "parse") diff --git a/python/private/poetry_parse.bzl b/python/private/poetry_parse.bzl index 242cfb4..5cd78fd 100644 --- a/python/private/poetry_parse.bzl +++ b/python/private/poetry_parse.bzl @@ -1,4 +1,4 @@ -load("@rules_ophiuchus_defs//:defs.bzl", _python_host = "python_host") +load("@ofiuco_defs//:defs.bzl", _python_host = "python_host") def dfs_cycles(graph): # Detect pip dependency cycles u->...->v...->w->v and remove edges w->v diff --git a/python/repositories.bzl b/python/repositories.bzl index 6230ef2..0ca25c0 100644 --- a/python/repositories.bzl +++ b/python/repositories.bzl @@ -9,7 +9,7 @@ _INTERNAL_DEPS = [ "pip", _PACKAGES_ENDPOINT + "f4/ab/e3c039b5ddba9335bd8f82d599eb310de1d2a2db0411b8d804d507405c74/pip-24.1.1-py3-none-any.whl", "efca15145a95e95c00608afeab66311d40bfb73bb2266a855befd705e6bb15a0", - ["@rules_ophiuchus//python:patches/scripts_executable.patch"], + ["@ofiuco//python:patches/scripts_executable.patch"], ), ] @@ -56,15 +56,12 @@ poetry_deps_repo = repository_rule( ) def _internal_definitions_repo_impl(rctx): - generator = "{} by {}".format(rctx.attr.generator_name, rctx.attr.generator_function) - rctx.file("BUILD", "") - rctx.file("defs.bzl", """# Generated by {generator} + rctx.file("defs.bzl", """ python_host = "{python_host}" python_version = "{python_version}" python_toolchain_prefix = "{python_toolchain_prefix}" """.format( - generator = generator, python_host = rctx.attr.python_host, python_version = rctx.attr.python_version, python_toolchain_prefix = rctx.attr.python_toolchain_prefix, @@ -80,7 +77,7 @@ internal_definitions_repo = repository_rule( ) def install_dependencies(toolchain_prefix, python_version, auth_patterns = {}, netrc = ""): - prefix = "rules_ophiuchus_" + prefix = "ofiuco_" internal_definitions_repo( name = prefix + "defs",