Skip to content

hiro-o918/pyo3-bazel

Repository files navigation

pyo3-bazel

Requirements

  • bazel or bazelisk

    • bazelisk is recommended
  • poetry: development only

  • protoc: development only

    • [prost_build] of Rust depends on protoc binary, so to use rust-analyzer on development, you need to install protoc
  • Xcode (only macOS): for build LightGBM with cmake

    • Some C++ headers can not be found on binding generation without Xcode
    • After installing Xcode, you can check configurations by the below command.
    sudo xcodebuild -license
    # Check gcc configured with prefix of Xcode not CommandLineTools
    gcc --version
    > Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
    > Apple clang version 13.0.0 (clang-1300.0.29.30)
    > Target: x86_64-apple-darwin20.6.0
    > Thread model: posix
    > InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • lightgbm-rs dependencies

This is an example repository to build python bindings of rust (PyO3) using Bazel.

Production Targets

Run script using FFI of Go and Rust

bazel run //python-cmd

Build wheel a package including archives

bazel build //pythonlib:pythonlib_wheel

Development

Rust

Update BUILD.bazel by Cargo.toml Run this command every time you update Cargo.toml.

CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index

Golang

Update BUILD.bazel of Golang with the following command:

bazel run @go_sdk//:bin/go -- mod tidy
bazel run //:gazelle
bazel run //:gazelle-update-repos

Python

Check the README.md for more information.

Projects

golib

Go Library

TODO: Write more

pythonlib

Python library

Run Test

Run pytest ob pythonlib

bazel test //pythonlib:pytest

Format and Lint

Format

Format packages with the following command:

bazel query "attr(tags, '\\bformat\\b', //...)" | xargs -I{} bazel run {}

Lint

Lint packages with the following command:

bazel test //... --test_tag_filters lint

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published