Baba
A lightweight, cross-platform C GUI framework using Vulkan for rendering.
Features
- Minimal Dependencies: Only requires Vulkan SDK
- Cross-Platform: macOS, Linux (X11/Wayland), Windows
- Native Window: Uses platform-native APIs
- Vulkan Rendering: Modern GPU-accelerated rendering
- Complete Widgets: Buttons, Labels, TextBoxes, etc.
- Flexible Layout: Flexbox-like and Grid layouts
- Python Bindings:
pip install baba-gui
Documentation
- Windows Build Guide - MSYS2/Scoop/Zig lightweight options
- Linux Build Guide - Ubuntu/Arch/Fedora instructions
- macOS Build Guide - Homebrew/Vulkan SDK installation
- Architecture - Project architecture and design
- Tutorial - Quick start guide
- C Development Guide - Using Baba for C GUI development
Installation
Python (Recommended)
pip install baba-gui
From Source
Prerequisites:
- CMake 3.20+
- C11 compiler
- Vulkan SDK
Build Steps:
mkdir build && cd build
cmake ..
make
Platform-Specific:
macOS:
brew install vulkan-loader vulkan-headers molten-vk
cmake -DCMAKE_PREFIX_PATH=$(brew --prefix) ..
make
Linux:
# Ubuntu/Debian
sudo apt install libvulkan-dev xorg-dev wayland-protocols
# Arch
sudo pacman -S vulkan-headers vulkan-tools libx11 libwayland
cmake ..
make
Windows:
Recommended: MinGW-w64 via MSYS2:
# Install dependencies via winget
winget install MSYS2.MSYS2
winget install KhronosGroup.VulkanSDK
# Open MSYS2 MINGW64 terminal:
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
# Build
cmake -B build -G Ninja
cmake --build build
If you must use Visual Studio:
cmake -B build -G "Visual Studio 17 2022"
cmake --build build --config Release
Quick Start
Python
import baba
def on_click(button):
print("Button clicked!")
with baba.create_app() as app:
window = app.create_window("Baba Demo", 800, 600)
button = baba.Button("Click Me")
button.on_click(on_click)
window.root.add_child(button)
label = baba.Label("Hello, Baba GUI!")
label.font_size = 24.0
label.color = baba.Color.from_hex("#333333")
window.root.add_child(label)
window.show()
app.run()
C
#include <baba.h>
#include <widgets/button.h>
#include <widgets/label.h>
void on_click(BabaWidget* button, void* data) {
printf("Button clicked!\n");
}
int main() {
BabaApp* app = baba_app_create();
BabaWindow* win = baba_window_create(app, "Baba Demo", 800, 600);
BabaWidget* root = baba_window_get_root(win);
BabaWidget* button = baba_button_create("Click Me");
baba_button_set_on_click(button, on_click, NULL);
baba_widget_add_child(root, button);
baba_window_show(win);
baba_app_run(app);
baba_window_destroy(win);
baba_app_destroy(app);
return 0;
}
Architecture
Baba/
├── src/
│ ├── baba.h # Main public API
│ ├── core/ # Core utilities
│ ├── platform/ # Platform abstraction (macOS/Linux/Windows)
│ ├── render/ # Vulkan renderer + Painter API
│ ├── widgets/ # UI widgets (Button, Label, TextBox)
│ ├── layout/ # Flex/Grid layouts
│ └── theme/ # Theming system
├── python/ # Python bindings (cffi)
├── examples/ # Example applications
└── docs/ # Documentation
API Overview
Application
// C
BabaApp* app = baba_app_create();
int result = baba_app_run(app);
void baba_app_quit(BabaApp* app);
# Python
app = baba.App()
result = app.run()
app.quit()
Window
BabaWindow* win = baba_window_create(app, "Title", 800, 600);
baba_window_set_title(win, "New Title");
baba_window_show(win);
window = app.create_window("Title", 800, 600)
window.title = "New Title"
window.show()
Widgets
// Button
BabaWidget* btn = baba_button_create("Button");
baba_button_set_on_click(btn, callback, NULL);
// Label
BabaWidget* label = baba_label_create("Text");
baba_label_set_font_size(label, 16.0f);
// TextBox
BabaWidget* input = baba_textbox_create("Placeholder");
const char* text = baba_textbox_get_text(input);
# Button
btn = baba.Button("Button")
btn.on_click(lambda b: print("clicked"))
# Label
label = baba.Label("Text")
label.font_size = 16.0
# TextBox
input = baba.TextBox("Placeholder")
text = input.text
Layout
// Flex layout
BabaWidget* flex = baba_flex_layout_create(BABA_LAYOUT_DIRECTION_ROW);
baba_flex_layout_set_gap(flex, 10.0f);
// Grid layout
BabaWidget* grid = baba_grid_layout_create(3, 2);
Publishing to PyPI
Build Wheels
# Install build tools
pip install build cibuildwheel
# Build source distribution
python -m build --sdist
# Build wheels for all platforms
cibuildwheel --platform macos
cibuildwheel --platform linux
cibuildwheel --platform windows
Upload to PyPI
pip install twine
twine upload dist/*
GitHub Actions (CI/CD)
The project includes cibuildwheel configuration in pyproject.toml for automated wheel building:
# .github/workflows/publish.yml
name: Publish to PyPI
on:
release:
types: [published]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install cibuildwheel
- run: cibuildwheel --output-dir dist
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- run: pip install twine
- run: twine upload wheels-*/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
Dependencies
| Platform | Dependencies |
|---|---|
| Rendering | Vulkan SDK |
| macOS | Cocoa, Metal, QuartzCore |
| Linux | X11 or Wayland |
| Windows | Win32 API (user32, gdi32) |
| Python | cffi >= 1.16.0 |
Platform Support
| Platform | Window System | Status |
|---|---|---|
| macOS | Cocoa + Metal | ✅ Full Support |
| Linux | X11 | ✅ Full Support |
| Linux | Wayland | ✅ Full Support |
| Windows | Win32 | ✅ Full Support |
C Development
After pip install baba-gui, you can use Baba for C GUI development:
# Get development paths
python -c "import baba; print(baba.get_include_dir())" # Headers
python -c "import baba; print(baba.get_lib_path())" # Library
# Compile your C app (macOS example)
INCLUDE=$(python -c "import baba; print(baba.get_include_dir())")
LIB=$(python -c "import baba; import os; print(os.path.dirname(baba.get_lib_path()))")
clang main.c -I"$INCLUDE" -L"$LIB" -lbaba \
-framework Cocoa -framework Metal -lvulkan -o myapp
See C Development Guide for details.
Building & Publishing
Build Native Library (Current Platform)
# Unix (macOS/Linux)
./build_all.sh
# Windows (MSYS2 MinGW)
./build_all.sh
This builds the library for the current platform only.
Cross-Platform Builds
For production releases, use GitHub Actions to build on all platforms:
- Push to
mainbranch or create a release - GitHub Actions builds macOS, Linux, and Windows versions
- Artifacts are combined and published to PyPI
To trigger a PyPI release:
- Go to GitHub → Releases → Draft a new release
- Tag the release (e.g.,
v0.1.2) - Publish - GitHub Actions will build and upload to PyPI
Manual Multi-Platform Build
If you need to build all platforms locally:
- macOS: Run on macOS machine
- Linux: Run on Linux machine or use Docker
- Windows: Run on Windows with MSYS2 MinGW
Then manually copy libraries to python/baba/lib/:
python/baba/lib/
├── libbaba_macos.a
├── libbaba_linux.a
└── libbaba_windows.a
Build & Upload to PyPI (Manual)
# Build native library
./build_all.sh
# Build Python package
pip install build twine
python -m build
# Upload to PyPI
twine upload dist/*
GitHub Actions (Recommended for Multi-Platform)
For production releases, use GitHub Actions to build on native platforms:
# .github/workflows/build.yml
jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: ./build_all.sh
- uses: actions/upload-artifact@v4
with:
name: lib-macos
path: dist/lib/macos/*.a
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./build_all.sh
- uses: actions/upload-artifact@v4
with:
name: lib-linux
path: dist/lib/linux-x64/*.a
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- run: build_all.bat
- uses: actions/upload-artifact@v4
with:
name: lib-windows
path: dist/lib/windows-x64/*.a
License
MIT License - see LICENSE file
Metadata
Release files for baba-gui 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| baba_gui-0.1.3.tar.gz | 163.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baba_gui-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 302.4 kB
Release files / baba_gui-0.1.3.tar.gz
| Download URL | baba_gui-0.1.3.tar.gz |
|---|---|
| Size | 163.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b51d3f0b74d4915b4b4ada6ba690a2e1a9873e333daf74a8d53d20e94933e5f
|
|
BLAKE2b-256 checksum How to use checksums |
dc464d7a64ed95750d4c3ada0da955acfb728ec6ffe74ba7c44956fb7f201b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / baba_gui-0.1.3-py3-none-any.whl
| Download URL | baba_gui-0.1.3-py3-none-any.whl |
|---|---|
| Size | 138.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
333ff358ff924415414473a1137d4b6fd8ffafe9b5e651d613f9ff483f155651
|
|
BLAKE2b-256 checksum How to use checksums |
123b0c9f1ef64cea3648431ec91f0f9b867034988e825fab9cdf1278a9aefaef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for baba-gui 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.