gitwtfhub

wtf is bedazzle?

jameslamb/bedazzle — explained in plain English

Analysis updated 2026-08-15 · repo last pushed 2020-06-18

PythonAudience · researcherComplexity · 3/5DormantSetup · moderate

TL;DR

An experimental project showing how to write C/C++ code once and call it from both Python and R, using Bazel to build a shared library.

Mindmap

mindmap
  root((repo))
    What it does
      Shared C code
      Python bindings
      R bindings
    Tech stack
      C and C++
      Python
      R
      Bazel build
    Use cases
      Share numeric routines
      Avoid code duplication
      Cross-language analytics
    Audience
      Data scientists
      Quant researchers
      Engineering teams
    Status
      Learning exercise
      Mac-focused setup
      Proof of concept

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Write a fast statistical routine in C and call it from both Python and R without rewriting it.

REASON 2

Share performance-critical numerical code between Python pipelines and R-based analysts on the same team.

REASON 3

Learn how Bazel can build a shared C/C++ library callable from multiple scripting languages.

What's in the stack?

C/C++PythonRBazel

How it stacks up

jameslamb/bedazzle0verflowme/learnings0verflowme/r2ai
LanguagePythonPythonPython
Last pushed2020-06-182022-06-182025-11-19
MaintenanceDormantDormantQuiet
Setup difficultymoderateeasymoderate
Complexity3/51/53/5
Audienceresearcherresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires Bazel installed and a Mac-focused build environment, instructions are not tailored for other platforms.

Wtf does this do

bedazzle is an experimental project that explores how to write a piece of code once in a low-level language (C/C++) and then use it from both Python and R. The practical benefit is straightforward: instead of rewriting the same logic in two different languages, you maintain a single shared library that both environments can tap into. The project uses a build tool called Bazel to compile the shared C/C++ code into a format that other programs can call. Once built, the same underlying function, for example, one that takes a number and adds one to it, can be loaded and run from either a Python script or an R session. The README demonstrates this with simple examples: calling the function in Python returns an incremented integer, and calling it in R does the same. This would appeal to data scientists, quantitative researchers, or engineering teams who work across both Python and R and want to share performance-critical code between them without duplicating effort. For instance, if a team builds a fast statistical or numerical routine in C, this approach lets both their Python pipelines and their R-based analysts use that exact same compiled code. It's worth noting that this is explicitly a learning exercise. The README describes it as an attempt to learn Bazel and then build on top of that knowledge, so it reads more like a personal experiment than a production-ready framework. The setup instructions are Mac-focused, and the project doesn't appear to be maintained for broader distribution. Think of it as a proof-of-concept showing that the write-once-use-anywhere pattern across Python and R is achievable with this toolchain.

Yoink these prompts

Prompt 1
Help me set up Bazel to build a C++ shared library that I can call from both Python and R, like the bedazzle project does. Walk me through the minimal BUILD and WORKSPACE files I need.
Prompt 2
I have a C function that adds one to a number. Show me how to compile it with Bazel and then load and call it from a Python script using ctypes or cffi.
Prompt 3
Using the bedazzle pattern, help me compile a C function with Bazel and call it from an R session. What R packages or functions do I need to load the shared library?
Prompt 4
I want to avoid duplicating a numerical algorithm in both Python and R. Show me how to structure a C/C++ shared library with Bazel so both languages can call the same compiled function.

Frequently asked questions

wtf is bedazzle?

An experimental project showing how to write C/C++ code once and call it from both Python and R, using Bazel to build a shared library.

What language is bedazzle written in?

Mainly Python. The stack also includes C/C++, Python, R.

Is bedazzle actively maintained?

Dormant — no commits in 2+ years (last push 2020-06-18).

How hard is bedazzle to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is bedazzle for?

Mainly researcher.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.