Python-SwiftUI Bridge for macOS Status Bar Apps
Project description
nib
Build native macOS menu bar apps in Python.
Install 
Requires macOS 14+ and Python 3.10+.
pip install pynib
Create a project
nib create myapp
cd myapp
This scaffolds a project with a pyproject.toml and a src/main.py entry point.
Write your app
import nib
def main(app: nib.App):
app.icon = nib.SFSymbol(
"apple.meditate", rendering_mode=nib.SymbolRenderingMode.HIERARCHICAL
)
app.title = "Your Nib app"
app.menu = [
nib.MenuItem(
content=nib.VStack(
controls=[
nib.Text("Custom Item"),
nib.Text(
"You can place any control you want!",
font=nib.Font.CAPTION,
foreground_color=nib.Color.WHITE.with_opacity(0.5),
),
],
alignment=nib.Alignment.LEADING,
),
height=35,
),
nib.MenuDivider(),
nib.MenuItem("Quit", shortcut="cmd+q", action=app.quit),
]
count = nib.Text("0", font=nib.Font.TITLE2)
def increment():
count.content = str(int(count.content) + 1)
def decrement():
count.content = str(int(count.content) - 1)
app.build(
nib.HStack(
controls=[
nib.Button(
content=nib.SFSymbol("minus"),
action=decrement
),
count,
nib.Button(
content=nib.SFSymbol("plus"),
action=increment
),
]
)
)
nib.run(main)
Run it
nib run main.py
This starts your app in dev mode with hot reload. Edit your code, save, and the app updates.
Build it
When you're ready to distribute:
nib build main.py
This produces a self-contained .app in dist/ that bundles a portable Python runtime, your code, and all dependencies. No Python installation needed on the target machine.
| Flag | Effect |
|---|---|
--native |
Compile to native .so via Cython |
--obfuscate |
Strip debug info from .pyc |
--no-compile |
Keep .py source files |
--icon icon.png |
Custom app icon |
--name "My App" |
Override display name |
--arch arm64 |
Target architecture |
Build options can also go in pyproject.toml:
[tool.nib]
entry = "src/main.py"
[tool.nib.build]
name = "My App"
icon = "assets/icon.png"
identifier = "com.example.myapp"
native = true
Features
Nib includes views like Text, Button, TextField, Toggle, Slider, Picker, DatePicker, ColorPicker, Image, Video, Label, Link, ProgressView, Gauge, Markdown, Table, SecureField, TextEditor, Map, WebView, and ShareLink. Layouts include VStack, HStack, ZStack, ScrollView, List, Form, Section, NavigationStack, DisclosureGroup, Grid, and lazy grids. There's also charting with LineMark, BarMark, AreaMark, PointMark, RuleMark, RectMark, and SectorMark.
On the system side: notifications, global hotkeys, clipboard, file dialogs, drag and drop, camera, battery, connectivity, screen info, keychain, and launch at login. Settings get their own window with tabs and auto-persist to UserDefaults. The status bar icon supports a right-click context menu with nested items, shortcuts, and badges.
See the full documentation at bbalduzz.github.io/nib.
Architecture
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynib-0.1.14-py3-none-macosx_11_0_universal2.whl.
File metadata
- Download URL: pynib-0.1.14-py3-none-macosx_11_0_universal2.whl
- Upload date:
- Size: 7.2 MB
- Tags: Python 3, macOS 11.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
906a4c96fd0e83fad4ca0428303f766f7f52c274f41756bc78618aa8165dc638
|
|
| MD5 |
eba5432ee0de5fe568584537b9afe2dc
|
|
| BLAKE2b-256 |
c8364af34784b7ba22eecff3b8b3607c4a113d07fe11861355d84f292e0e5ed8
|