Skip to main content

Python library to make xbar development easy in python

Include this in your file after the regular imports

def install(pkg: str, spec: str = "", cache_dir: Path | str = "~/.cache"):
    import os, sys, pip, importlib, importlib.metadata  # isort: skip # noqa: E401
    from pip._vendor.packaging.requirements import Requirement
    name, cache = Path(__file__), Path(os.environ.get("XDG_CACHE_HOME", cache_dir))
    sitep = (cache / f"pyxbar/{name.name}/site-packages").expanduser().as_posix()
    sys.path += [] if sitep in sys.path else [sitep]
    try:
        requirement = Requirement(spec or pkg)
        assert importlib.metadata.version(requirement.name) in requirement.specifier
    except Exception as e:
        pip.main(["install", "--upgrade", f"--target={sitep}", *(spec or pkg).split()])
        importlib.invalidate_caches()


# install the PyXbar library from pypi
install("pyxbar")

# use it!
from pyxbar import (
    Config,
    Divider,
    Menu,
    MenuItem,
    Renderable,
    ShellItem,
)


class MyConfig(Config):
    MYVARIABLE: bool = True
    ...

CONFIG = get_config(MyConfig)  # type: ignore




if __name__ == "__main__":
    Menu("some title").with_items(
        Divider(),  # shortcut for ---, also handles submenu depth
        MenuItem(
            "👁️ overview",
        ).with_submenu(
            MenuItem("hi, i'm a submenu!").
            MenuItem("hi, i'm monospace!", monospaced=True)
        ),
    ).print()

Metadata

Release files for pyxbar 0.3.30

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

Source distribution (sdist)

Source distribution for pyxbar 0.3.30
File Size Uploaded Provenance
pyxbar-0.3.30.tar.gz 10.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyxbar 0.3.30
File Interpreter ABI Platform
pyxbar-0.3.30-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / pyxbar-0.3.30.tar.gz

Download URL pyxbar-0.3.30.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aee57197b6a3de847d70bb4f1775803b29d5c1118f306d3e3f41038a1035bec6
BLAKE2b-256 checksum
How to use checksums
a1de65ad794afde339f9b78ca4f611b24f7dc1df38e36a4bccaab8cc54d555f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.6

Release files / pyxbar-0.3.30-py3-none-any.whl

Download URL pyxbar-0.3.30-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f868013143719776f3653a23dc620692e6eb4cfba5e3904e2277e76622023612
BLAKE2b-256 checksum
How to use checksums
f806ccaaee9a1bbb36d691ac7ab0e6166b12bf3f55e4b5c5882ae1859d5d212a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.6

Security for pyxbar 0.3.30

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.

Release history Release notifications | RSS feed

This release

0.3.30 This release

2 release files No provenance

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