Skip to main content

klinepy

Python wrapper for KLineCharts (klinecharts@10) — one chart spec, three outputs: standalone HTML, embeddable fragment, marimo/anywidget widget.

Grayscale theme with a single amber accent (#d97706). The JS side loads the klinecharts ESM build from jsDelivr (needs internet in the browser); the Python side is pure data (polars/pandas frames or dicts — no data deps).

Usage

from klinepy import KLineChart, html, fragment

chart = KLineChart(
    bars,                      # polars/pandas DataFrame or list of dicts
    lines={"SMA 20": sma},     # overlay lines on the price pane, aligned/padded to bar count
    panes={"rel vol": rv},     # own-pane series (one sub-pane per named series)
    overlays=[boxes],          # boxes / klinecharts overlay specs, see below
    title="AAPL",
    indicators=[{"name": "MACD"}}],  # optional built-in klinecharts indicators
    height=460,
)

# 1. marimo / Jupyter widget
mo.ui.anywidget(chart)

# 2. standalone HTML document (CDN ESM, no build step)
open("aapl.html", "w").write(chart.to_html())   # or: html(chart)

# 3. embeddable fragment for web apps (no <html> wrapper)
page += chart.fragment()                        # or: fragment(chart)

Overlays

lines and panes plot the values you pass (amber accent). For boxes — e.g. Darvas:

chart = KLineChart(bars, overlays=[
    {"start": dt.date(2026, 1, 5), "end": dt.date(2026, 1, 25),
     "top": 103.0, "bottom": 97.0},          # rendered as an amber rect
])

Full klinecharts overlay specs (priceLine, segment, simpleTag, …) pass through unchanged:

overlays=[{"name": "priceLine", "points": [{"timestamp": ts_ms, "value": 99.5}]}]

Development

uv sync
uv run pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

klinepy-0.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

klinepy-0.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file klinepy-0.2.0.tar.gz.

File metadata

  • Download URL: klinepy-0.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for klinepy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 836de971a38bff5f6b6743661a9376a98e681d79c0e2de155ffaaa98f20793bc
MD5 353d4898aaf30bfba0c1ba58276ebed4
BLAKE2b-256 8e1e1ca9a41f3ad06ef9f5330629ed6d940454c979cc6d9a5b43cb59b8f93a32

See more details on using hashes here.

File details

Details for the file klinepy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: klinepy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for klinepy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d204a89d4fe410982c3a34598de1f6b048e3b44070f0f78f41a1d3913e45e880
MD5 1f2de6585c10b87872eb3b62ea152d16
BLAKE2b-256 b0a8394670268ee813ca5e0713ced98776665a604d6a8f2631d9742c60cba2a2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

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