Skip to main content
logo

nib

Build native macOS menu bar apps in Python

Install version

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, 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 edo.codeberg.page/nib.

Architecture

License

MIT

Metadata

Release files for pynib 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pynib 0.3.0
File Interpreter ABI Platform Actions
pynib-0.3.0-py3-none-macosx_14_0_universal2.whl Python 3 none macOS 14.0+ universal2 (ARM64, x86-64) Details for pynib-0.3.0-py3-none-macosx_14_0_universal2.whl

Release files / pynib-0.3.0-py3-none-macosx_14_0_universal2.whl

Download URL pynib-0.3.0-py3-none-macosx_14_0_universal2.whl
Size 4.5 MB
Tags Python 3 macOS 14.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
7b23733864de1a3c165ebdafda414e3e8d6d42d2a3eba79ca4bceaeacf8ecd90
BLAKE2b-256 checksum
How to use checksums
d4d9d2451937a6c73729eacd596756f14d0fa9a41ea2f0b3a77db7afabc49a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Security for pynib 0.3.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page