diff --git a/.clang-format b/.clang-format index f978d57533af..b042635392c5 100644 --- a/.clang-format +++ b/.clang-format @@ -2,6 +2,7 @@ BasedOnStyle: Google # Make it slightly more similar to Rust. # Based loosly on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4 +AccessModifierOffset: -2 AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty diff --git a/.github/workflows/reusable_pr_summary.yml b/.github/workflows/reusable_pr_summary.yml index 9db29d066f91..e6291fa5f13c 100644 --- a/.github/workflows/reusable_pr_summary.yml +++ b/.github/workflows/reusable_pr_summary.yml @@ -46,7 +46,7 @@ jobs: version: '>= 363.0.0' - name: Install deps - run: pip install google-cloud-storage Jinja2 PyGithub # NOLINT + run: pip install google-cloud-storage Jinja2 PyGithub - name: Render HTML template run: | diff --git a/_typos.toml b/_typos.toml index adb9d5b658d4..4fb279cb56d1 100644 --- a/_typos.toml +++ b/_typos.toml @@ -12,9 +12,9 @@ extend-exclude = [ [default.extend-words] lod = "lod" # level-of-detail -teh = "teh" # part of @teh-cmc ND = "ND" # np.NDArray somes = "somes" # many `Some` +teh = "teh" # part of @teh-cmc # American English: grey = "gray" diff --git a/ci_docker/Dockerfile b/ci_docker/Dockerfile index 4e4f19f3f1a5..e2d2818dcd5b 100644 --- a/ci_docker/Dockerfile +++ b/ci_docker/Dockerfile @@ -6,9 +6,12 @@ LABEL version="0.7" LABEL description="Docker image used for the CI of https://github.com/rerun-io/rerun" # Install the ubuntu package dependencies +# This mirrors scripts/setup.sh ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ + apache-arrow \ build-essential \ + cmake \ curl \ git \ libatk-bridge2.0 \ diff --git a/crates/rerun_c/example_c/.gitignore b/crates/rerun_c/example/.gitignore similarity index 100% rename from crates/rerun_c/example_c/.gitignore rename to crates/rerun_c/example/.gitignore diff --git a/crates/rerun_c/example_c/Makefile b/crates/rerun_c/example/Makefile similarity index 100% rename from crates/rerun_c/example_c/Makefile rename to crates/rerun_c/example/Makefile diff --git a/crates/rerun_c/example_c/README.md b/crates/rerun_c/example/README.md similarity index 100% rename from crates/rerun_c/example_c/README.md rename to crates/rerun_c/example/README.md diff --git a/crates/rerun_c/example_c/main.c b/crates/rerun_c/example/main.c similarity index 93% rename from crates/rerun_c/example_c/main.c rename to crates/rerun_c/example/main.c index c04b9b5627ae..96eb424be291 100644 --- a/crates/rerun_c/example_c/main.c +++ b/crates/rerun_c/example/main.c @@ -8,7 +8,7 @@ int main(void) { .application_id = "c-example-app", .store_kind = RERUN_STORE_KIND_RECORDING, }; - rr_recording_stream rec_stream = rr_recording_stream_new(&store_info, "0.0.0.0:9876"); + rr_recording_stream rec_stream = rr_recording_stream_new(&store_info, "127.0.0.1:9876"); printf("rec_stream: %d\n", rec_stream); diff --git a/crates/rerun_c/example_cpp/.gitignore b/crates/rerun_c/example_cpp/.gitignore deleted file mode 100644 index 56b46229372f..000000000000 --- a/crates/rerun_c/example_cpp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.bin -*.o -build/ diff --git a/crates/rerun_c/example_cpp/CMakeLists.txt b/crates/rerun_c/example_cpp/CMakeLists.txt deleted file mode 100644 index f72639dcd412..000000000000 --- a/crates/rerun_c/example_cpp/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -cmake_minimum_required(VERSION 3.16) - -project(RerunExample) - -option(ARROW_LINK_SHARED "Link to the Arrow shared library" ON) - -find_package(Arrow REQUIRED) - -set(CMAKE_DL_LIBS "dl") # Required by Loguru for backtraces - -# ------------------------------------------------------------------------------ -# Loguru, see https://github.com/emilk/loguru/blob/master/loguru_cmake_example/CMakeLists.txt -include(FetchContent) -FetchContent_Declare(LoguruGitRepo - GIT_REPOSITORY "https://github.com/emilk/loguru" # can be a filesystem path - GIT_TAG "master" -) - -# set any loguru compile-time flags before calling MakeAvailable() -set(LOGURU_STACKTRACES 1) -FetchContent_MakeAvailable(LoguruGitRepo) # defines target 'loguru::loguru' - -# ------------------------------------------------------------------------------ -if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) -endif() - -# Arrow requires a C++17 compliant compiler -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -message(STATUS "Arrow version: ${ARROW_VERSION}") -message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") - -add_executable(rerun_example main.cpp) - -if(MSVC) - target_compile_options(rerun_example PRIVATE /W4 /WX) -else() - target_compile_options(rerun_example PRIVATE -Wall -Wextra -Wpedantic -Wcast-align -Wcast-qual -Wformat=2 -Wmissing-include-dirs -Wnull-dereference -Woverloaded-virtual -Wpointer-arith -Wshadow -Wswitch-enum -Wvla -Wno-sign-compare -Wconversion -Wunused -Wold-style-cast -Wno-missing-braces) -endif() - -if(APPLE) - target_link_libraries(rerun_example PRIVATE ${CMAKE_SOURCE_DIR}/../../../target/debug/librerun_c.a) - target_link_libraries(rerun_example PRIVATE "-framework CoreFoundation" "-framework IOKit") -endif() - -if(LINUX) - target_link_libraries(rerun_example PRIVATE ${CMAKE_SOURCE_DIR}/../../../target/debug/librerun_c.a) - target_link_libraries(rerun_example PRIVATE "-lm") -endif() - -if(ARROW_LINK_SHARED) - target_link_libraries(rerun_example PRIVATE Arrow::arrow_shared) -else() - target_link_libraries(rerun_example PRIVATE Arrow::arrow_static) -endif() - -include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/../src) # for rerun.hpp - -target_link_libraries(rerun_example PRIVATE loguru::loguru) diff --git a/crates/rerun_c/example_cpp/build_and_run.sh b/crates/rerun_c/example_cpp/build_and_run.sh deleted file mode 100755 index 1f2c2b8dee5c..000000000000 --- a/crates/rerun_c/example_cpp/build_and_run.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -eu -script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cd "$script_path" -set -x - -mkdir -p build -cd build - -cargo build -p rerun_c # TODO(emilk): add this to CMakelists.txt instead? -cmake -DCMAKE_BUILD_TYPE=Debug .. -make -./rerun_example diff --git a/crates/rerun_c/example_cpp/main.cpp b/crates/rerun_c/example_cpp/main.cpp deleted file mode 100644 index 72edea4d1d9c..000000000000 --- a/crates/rerun_c/example_cpp/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -#define RERUN_WITH_ARROW 1 - -#include - -int main(int argc, char** argv) { - loguru::g_preamble_uptime = false; - loguru::g_preamble_thread = false; - loguru::init(argc, argv); // installs signal handlers - - LOG_F(INFO, "Rerun C++ SDK version: %s", rerun::version_string()); - - const rr_store_info store_info = { - .application_id = "c-example-app", - .store_kind = RERUN_STORE_KIND_RECORDING, - }; - rr_recording_stream rec_stream = rr_recording_stream_new(&store_info, "0.0.0.0:9876"); - - float xyz[9] = {0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 5.0, 5.0, 5.0}; - auto points = rerun::points3(3, xyz).ValueOrDie(); - auto buffer = rerun::ipc_from_table(*points).ValueOrDie(); - - const rr_data_cell data_cells[1] = {rr_data_cell{ - .component_name = "rerun.point3d", - .num_bytes = static_cast(buffer->size()), - .bytes = buffer->data(), - }}; - - const rr_data_row data_row = { - .entity_path = "points", .num_instances = 3, .num_data_cells = 1, .data_cells = data_cells}; - rr_log(rec_stream, &data_row); - - rr_recording_stream_free(rec_stream); -} diff --git a/crates/rerun_c/run_examples.sh b/crates/rerun_c/run_examples.sh index 56f9eb5835e0..e4a3770cf04c 100755 --- a/crates/rerun_c/run_examples.sh +++ b/crates/rerun_c/run_examples.sh @@ -4,5 +4,4 @@ set -eu script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) set -x -(cd "$script_path/example_c" && make run) -"$script_path/example_cpp/build_and_run.sh" +(cd "$script_path/example" && make run) diff --git a/rerun_cpp/.gitignore b/rerun_cpp/.gitignore new file mode 100644 index 000000000000..567609b1234a --- /dev/null +++ b/rerun_cpp/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/rerun_cpp/CMakeLists.txt b/rerun_cpp/CMakeLists.txt new file mode 100644 index 000000000000..13f41954602f --- /dev/null +++ b/rerun_cpp/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.16) + +project(rerun_cpp_proj LANGUAGES CXX) + +add_subdirectory(src) # The Rerun C++ SDK library +add_subdirectory(example) diff --git a/rerun_cpp/README.md b/rerun_cpp/README.md new file mode 100644 index 000000000000..e27e375d5287 --- /dev/null +++ b/rerun_cpp/README.md @@ -0,0 +1,17 @@ +# Rerun C++ SDK + +This is not yet ready to be used. + +## Requirements +Run `scripts/setup.sh`. + +## Test it +rerun_cpp/example/build_and_run.sh + +# To do: +* CI +* Code-gen +* Documentation +* Packaging +* Publishing +* … diff --git a/rerun_cpp/build_and_run.sh b/rerun_cpp/build_and_run.sh new file mode 100755 index 000000000000..58ef0b2e04bf --- /dev/null +++ b/rerun_cpp/build_and_run.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path" +set -x + +mkdir -p build +pushd build + cargo build -p rerun_c # TODO(emilk): add this to CMakelists.txt instead? + cmake -DCMAKE_BUILD_TYPE=Debug .. + make # VERBOSE=1 +popd + +./build/example/rerun_example + diff --git a/rerun_cpp/example/CMakeLists.txt b/rerun_cpp/example/CMakeLists.txt new file mode 100644 index 000000000000..af764b822b9c --- /dev/null +++ b/rerun_cpp/example/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.16) + +# project(RerunExample) + +# ------------------------------------------------------------------------------ + +# Arrow requires a C++17 compliant compiler +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() + +if(NOT DEFINED CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +add_executable(rerun_example main.cpp) + +if(MSVC) + target_compile_options(rerun_example PRIVATE /W4 /WX) +else() + target_compile_options(rerun_example PRIVATE -Wall -Wextra -Wpedantic -Wcast-align -Wcast-qual -Wformat=2 -Wmissing-include-dirs -Wnull-dereference -Woverloaded-virtual -Wpointer-arith -Wshadow -Wswitch-enum -Wvla -Wno-sign-compare -Wconversion -Wunused -Wold-style-cast -Wno-missing-braces) +endif() + +include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/../src) # For rerun.hpp (Rerun C++ SDK) + +target_link_libraries(rerun_example PRIVATE loguru::loguru rerun_sdk) diff --git a/crates/rerun_c/example_cpp/README.md b/rerun_cpp/example/README.md similarity index 100% rename from crates/rerun_c/example_cpp/README.md rename to rerun_cpp/example/README.md diff --git a/rerun_cpp/example/main.cpp b/rerun_cpp/example/main.cpp new file mode 100644 index 000000000000..2570abbb4fed --- /dev/null +++ b/rerun_cpp/example/main.cpp @@ -0,0 +1,29 @@ +#include + +#define RERUN_WITH_ARROW 1 + +#include +#include + +int main(int argc, char** argv) { + loguru::g_preamble_uptime = false; + loguru::g_preamble_thread = false; + loguru::init(argc, argv); // installs signal handlers + + LOG_F(INFO, "Rerun C++ SDK version: %s", rr::version_string()); + + auto rr_stream = rr::RecordingStream{"c-example-app", "127.0.0.1:9876"}; + + float xyz[9] = {0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 5.0, 5.0, 5.0}; + auto points = rr::points3(3, xyz).ValueOrDie(); + auto buffer = rr::ipc_from_table(*points).ValueOrDie(); + + const rr::DataCell data_cells[1] = {rr::DataCell{ + .component_name = "rerun.point3d", + .num_bytes = static_cast(buffer->size()), + .bytes = buffer->data(), + }}; + + uint32_t num_instances = 3; + rr_stream.log_data_row("points", num_instances, 1, data_cells); +} diff --git a/rerun_cpp/src/CMakeLists.txt b/rerun_cpp/src/CMakeLists.txt new file mode 100644 index 000000000000..2687315aa452 --- /dev/null +++ b/rerun_cpp/src/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required(VERSION 3.16) + +# NOTE: CMake docs strongly discourages using GLOB, and instead suggests +# manually listing all the files, like it's 1972. +# However, that won't work for use since we auto-generate the source tree. +# See https://cmake.org/cmake/help/latest/command/file.html#glob +file(GLOB rerun_sdk_SRC CONFIGURE_DEPENDS + "*.hpp" + "*.cpp" +) + +add_library(rerun_sdk ${rerun_sdk_SRC}) + +# ------------------------------------------------------------------------------ + +# For rerun.h (Rerun C SDK): +include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/../../crates/rerun_c/src) + +# Make sure the compiler can find include files for rerun +# when other libraries or executables link to rerun: +target_include_directories(rerun_sdk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +# ------------------------------------------------------------------------------ +# Loguru logging library (https://github.com/emilk/loguru): +set(CMAKE_DL_LIBS "dl") # Required by Loguru for backtraces + +# Loguru, see https://github.com/emilk/loguru/blob/master/loguru_cmake_example/CMakeLists.txt +include(FetchContent) +FetchContent_Declare(LoguruGitRepo + GIT_REPOSITORY "https://github.com/emilk/loguru" # can be a filesystem path + GIT_TAG "master" +) + +# set any loguru compile-time flags before calling MakeAvailable() +set(LOGURU_STACKTRACES 1) +FetchContent_MakeAvailable(LoguruGitRepo) # defines target 'loguru::loguru' + +target_link_libraries(rerun_sdk PRIVATE loguru::loguru) + +# ------------------------------------------------------------------------------ +if(APPLE) + target_link_libraries(rerun_sdk PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/librerun_c.a) + target_link_libraries(rerun_sdk PRIVATE "-framework CoreFoundation" "-framework IOKit") +endif() + +if(LINUX) + target_link_libraries(rerun_sdk PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/debug/librerun_c.a) + target_link_libraries(rerun_sdk PRIVATE "-lm") +endif() + +# ----------------------------------------------------------------------------- +# Arrow: +option(ARROW_LINK_SHARED "Link to the Arrow shared library" ON) + +find_package(Arrow REQUIRED) + +# Arrow requires a C++17 compliant compiler +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +message(STATUS "Arrow version: ${ARROW_VERSION}") +message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") + +if(ARROW_LINK_SHARED) + target_link_libraries(rerun_sdk PRIVATE Arrow::arrow_shared) +else() + target_link_libraries(rerun_sdk PRIVATE Arrow::arrow_static) +endif() diff --git a/rerun_cpp/src/recording_stream.cpp b/rerun_cpp/src/recording_stream.cpp new file mode 100644 index 000000000000..b5a2ebfcccc5 --- /dev/null +++ b/rerun_cpp/src/recording_stream.cpp @@ -0,0 +1,65 @@ +#include "recording_stream.hpp" + +#include + +#include +#include + +namespace rr { + RecordingStream RecordingStream::s_global; + + RecordingStream::RecordingStream(const char* app_id, const char* addr, StoreKind store_kind) { + ERROR_CONTEXT("RecordingStream", ""); + + int32_t c_store_kind; + switch (store_kind) { + case StoreKind::Recording: + c_store_kind = RERUN_STORE_KIND_RECORDING; + break; + case StoreKind::Blueprint: + c_store_kind = RERUN_STORE_KIND_BLUEPRINT; + break; + } + + rr_store_info store_info = { + .application_id = app_id, + .store_kind = c_store_kind, + }; + this->_id = rr_recording_stream_new(&store_info, addr); + } + + RecordingStream::~RecordingStream() { + rr_recording_stream_free(this->_id); + } + + void RecordingStream::init_global(const char* app_id, const char* addr) { + s_global = RecordingStream{app_id, addr}; + } + + RecordingStream RecordingStream::global() { + return s_global; + } + + void RecordingStream::log_data_row(const char* entity_path, uint32_t num_instances, + size_t num_data_cells, const DataCell* data_cells) { + // Map to C API: + std::vector c_data_cells; + c_data_cells.reserve(num_data_cells); + for (size_t i = 0; i < num_data_cells; ++i) { + c_data_cells.push_back({ + .component_name = data_cells[i].component_name, + .num_bytes = data_cells[i].num_bytes, + .bytes = data_cells[i].bytes, + }); + } + + const rr_data_row c_data_row = { + .entity_path = entity_path, + .num_instances = num_instances, + .num_data_cells = static_cast(num_data_cells), + .data_cells = c_data_cells.data(), + }; + + rr_log(this->_id, &c_data_row); + } +} // namespace rr diff --git a/rerun_cpp/src/recording_stream.hpp b/rerun_cpp/src/recording_stream.hpp new file mode 100644 index 000000000000..eb0883d01dff --- /dev/null +++ b/rerun_cpp/src/recording_stream.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include // size_t +#include // uint32_t etc + +namespace rr { + enum StoreKind { + Recording, + Blueprint, + }; + + struct DataCell { + const char* component_name; + size_t num_bytes; + const uint8_t* bytes; + }; + + class RecordingStream { + public: + RecordingStream(const char* app_id, const char* addr, + StoreKind store_kind = StoreKind::Recording); + ~RecordingStream(); + + /// Must be called first, if at all. + static void init_global(const char* app_id, const char* addr); + + /// Access the global recording stream. + /// Aborts if `init_global` has not yet been called. + static RecordingStream global(); + + void log_data_row(const char* entity_path, uint32_t num_instances, size_t num_data_cells, + const DataCell* data_cells); + + private: + RecordingStream() : _id{0} {} + RecordingStream(uint32_t id) : _id{id} {} + + uint32_t _id; + + static RecordingStream s_global; + }; +} // namespace rr diff --git a/crates/rerun_c/src/rerun.hpp b/rerun_cpp/src/rerun.cpp similarity index 83% rename from crates/rerun_c/src/rerun.hpp rename to rerun_cpp/src/rerun.cpp index 1f84350e4b5e..bf02a7bd9108 100644 --- a/crates/rerun_c/src/rerun.hpp +++ b/rerun_cpp/src/rerun.cpp @@ -1,28 +1,19 @@ -// The Rerun C++ SDK. - -#ifndef RERUN_HPP -#define RERUN_HPP - -#include - -namespace rerun { - inline const char* version_string() { - return rr_version_string(); - } -} // namespace rerun - -// ---------------------------------------------------------------------------- -// Arrow integration - -#if RERUN_WITH_ARROW +#include "rerun.hpp" #include #include #include +#include #include -namespace rerun { +namespace rr { + const char* version_string() { + return rr_version_string(); + } + + // ------------------------------------------------------------------------ + arrow::Result> points3(size_t num_points, const float* xyz) { arrow::MemoryPool* pool = arrow::default_memory_pool(); @@ -62,10 +53,4 @@ namespace rerun { ARROW_RETURN_NOT_OK(writer->Close()); return output->Finish(); } -} // namespace rerun - -#endif // RERUN_WITH_ARROW - -// ---------------------------------------------------------------------------- - -#endif // RERUN_HPP +} // namespace rr diff --git a/rerun_cpp/src/rerun.hpp b/rerun_cpp/src/rerun.hpp new file mode 100644 index 000000000000..adb28a7d1ef4 --- /dev/null +++ b/rerun_cpp/src/rerun.hpp @@ -0,0 +1,26 @@ +// The Rerun C++ SDK. +#pragma once + +#include "recording_stream.hpp" + +namespace rr { + /// The Rerun C++ SDK version as a human-readable string. + const char* version_string(); +} // namespace rr + +// ---------------------------------------------------------------------------- +// Arrow integration + +#include + +namespace rr { + arrow::Result> points3(size_t num_points, const float* xyz); + + /// Encode the given arrow table in the Arrow IPC encapsulated message format. + /// + /// * + /// * + arrow::Result> ipc_from_table(const arrow::Table& table); +} // namespace rr + +// ---------------------------------------------------------------------------- diff --git a/scripts/ci/check_pr_checkboxes.py b/scripts/ci/check_pr_checkboxes.py index c1d33a9cd08f..06fa75fc6683 100755 --- a/scripts/ci/check_pr_checkboxes.py +++ b/scripts/ci/check_pr_checkboxes.py @@ -4,7 +4,7 @@ import argparse -from github import Github # NOLINT +from github import Github def main() -> None: @@ -14,7 +14,7 @@ def main() -> None: parser.add_argument("--pr-number", required=True, type=int, help="PR number") args = parser.parse_args() - gh = Github(args.github_token) # NOLINT + gh = Github(args.github_token) repo = gh.get_repo(args.github_repository) pr = repo.get_pull(args.pr_number) diff --git a/scripts/ci/generate_pr_summary.py b/scripts/ci/generate_pr_summary.py index 1c31cadf31eb..17d5b69a9865 100644 --- a/scripts/ci/generate_pr_summary.py +++ b/scripts/ci/generate_pr_summary.py @@ -7,7 +7,7 @@ This is expected to be run by the `reusable_pr_summary.yml` GitHub workflow. Requires the following packages: - pip install google-cloud-storage Jinja2 PyGithub # NOLINT + pip install google-cloud-storage Jinja2 PyGithub """ from __future__ import annotations @@ -16,14 +16,14 @@ import os from typing import Any -from github import Github # NOLINT +from github import Github from google.cloud import storage from jinja2 import Template def generate_pr_summary(github_token: str, github_repository: str, pr_number: int, upload: bool) -> None: # Initialize the GitHub and GCS clients - gh = Github(github_token) # NOLINT + gh = Github(github_token) gcs_client = storage.Client() # Get the list of commits associated with the PR diff --git a/scripts/ci/generate_prerelease_pip_index.py b/scripts/ci/generate_prerelease_pip_index.py index 0755b92b5c5d..e25ebc7e6408 100644 --- a/scripts/ci/generate_prerelease_pip_index.py +++ b/scripts/ci/generate_prerelease_pip_index.py @@ -7,7 +7,7 @@ This is expected to be run by the `reusable_pip_index.yml` GitHub workflow. Requires the following packages: - pip install google-cloud-storage Jinja2 PyGithub # NOLINT + pip install google-cloud-storage Jinja2 PyGithub """ from __future__ import annotations diff --git a/scripts/ci/update_pr_body.py b/scripts/ci/update_pr_body.py index b145cbeea1ec..d6bb347a8c68 100755 --- a/scripts/ci/update_pr_body.py +++ b/scripts/ci/update_pr_body.py @@ -6,7 +6,7 @@ This is expected to be run by the `reusable_update_pr_body.yml` GitHub workflow. Requires the following packages: - pip install Jinja2 PyGithub # NOLINT + pip install Jinja2 PyGithub """ from __future__ import annotations @@ -14,7 +14,7 @@ import logging import urllib.parse -from github import Github # NOLINT +from github import Github from jinja2 import DebugUndefined, select_autoescape from jinja2.sandbox import SandboxedEnvironment @@ -31,7 +31,7 @@ def main() -> None: parser.add_argument("--pr-number", required=True, type=int, help="PR number") args = parser.parse_args() - gh = Github(args.github_token) # NOLINT + gh = Github(args.github_token) repo = gh.get_repo(args.github_repository) pr = repo.get_pull(args.pr_number) diff --git a/scripts/lint.py b/scripts/lint.py index c0f00083a66b..a29fd00109c7 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -25,15 +25,16 @@ explicit_quotes = re.compile(r'[^(]\\"\{\w*\}\\"') # looks for: \"{foo}\" -def lint_line(line: str) -> str | None: +def lint_line(line: str, file_extension: str = "rs") -> str | None: if "NOLINT" in line: return None # NOLINT ignores the linter - if "Github" in line: - return "It's 'GitHub', not 'Github'" + if file_extension == "md": + if "Github" in line: + return "It's 'GitHub', not 'Github'" - if " github " in line: - return "It's 'GitHub', not 'github'" + if " github " in line: + return "It's 'GitHub', not 'github'" if "FIXME" in line: return "we prefer TODO over FIXME" @@ -370,13 +371,15 @@ def test_lint_workspace_deps() -> None: def lint_file(filepath: str, args: Any) -> int: + file_extension = filepath.split(".")[-1] + with open(filepath) as f: lines_in = f.readlines() num_errors = 0 for line_nr, line in enumerate(lines_in): - error = lint_line(line) + error = lint_line(line, file_extension) if error is not None: num_errors += 1 print(f"{filepath}:{line_nr+1}: {error}") @@ -438,7 +441,7 @@ def main() -> None: root_dirpath = os.path.abspath(f"{script_dirpath}/..") os.chdir(root_dirpath) - extensions = ["c", "cpp", "fbs", "h", "hpp" "html", "js", "md", "py", "rs", "sh", "toml", "wgsl", "yml"] + extensions = ["c", "cpp", "fbs", "h", "hpp" "html", "js", "md", "py", "rs", "sh", "toml", "txt", "wgsl", "yml"] exclude_dirs = {"env", "renv", "venv", "venv3.10", "target", "target_ra", "target_wasm", ".nox"} diff --git a/scripts/setup.sh b/scripts/setup.sh index 8897f4c0ceb3..1dc7a4d618ee 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -# Setup required to build rerun +# Setup required to build rerun. +# This file is mirrored in ci_docker/Dockerfile. set -eu script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) @@ -31,7 +32,8 @@ elif [ -x "$(command -v dnf)" ]; then pkg-config fi -packagesNeeded='flatbuffers' +# C++ SDK requires `apache-arrow` and `cmake` +packagesNeeded='apache-arrow cmake flatbuffers' if [ -x "$(command -v brew)" ]; then brew install $packagesNeeded elif [ -x "$(command -v port)" ]; then sudo port install $packagesNeeded elif [ -x "$(command -v apt-get)" ]; then sudo apt-get -y install $packagesNeeded diff --git a/scripts/upload_image.py b/scripts/upload_image.py index 23afe61484e9..aaccf107c89e 100755 --- a/scripts/upload_image.py +++ b/scripts/upload_image.py @@ -7,7 +7,7 @@ ------------ Requires the following packages: - pip install google-cloud-storage # NOLINT + pip install google-cloud-storage Before running, you have to authenticate via the Google Cloud CLI: - Install it (https://cloud.google.com/storage/docs/gsutil_install)