Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added recipes/mojo-asciichart/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions recipes/mojo-asciichart/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
context:
version: 1.1.2
mojo_version: "=0.25.7"

package:
name: mojo-asciichart
version: ${{ version }}

source:
git: https://github.com/DataBooth/mojo-asciichart.git
tag: v1.1.2

build:
number: 0
script:
- mkdir -p $PREFIX/lib/mojo/asciichart
- cp -r src/asciichart/* $PREFIX/lib/mojo/asciichart/

requirements:
build:
- mojo-compiler ${{ mojo_version }}
host:
- mojo-compiler ${{ mojo_version }}
run:
- ${{ pin_compatible('mojo-compiler') }}

tests:
- script:
- test -f $PREFIX/lib/mojo/asciichart/__init__.mojo
- test -f $PREFIX/lib/mojo/asciichart/plot.mojo

about:
homepage: https://github.com/DataBooth/mojo-asciichart
license: Apache-2.0
license_file: LICENSE
summary: Nice-looking lightweight console ASCII line charts for Mojo
description: |
mojo-asciichart is a native Mojo port of the popular asciichartpy Python library.
Generate beautiful ASCII line charts in your terminal with no dependencies.

Features:
- Basic plot() function for single series
- Configurable height and appearance
- Automatic min/max detection and scaling
- NaN value handling (gaps in data)
- UTF-8 box-drawing characters for smooth curves
- ANSI color support (6 predefined themes)
- Python interop tests for compatibility validation
- Pixel-perfect output matching asciichartpy
- Performance: 1.4-4.3x faster than Python
- Comprehensive test suite (29 tests passing)
documentation: https://github.com/DataBooth/mojo-asciichart/blob/main/README.md
repository: https://github.com/DataBooth/mojo-asciichart

extra:
recipe-maintainers:
- mjboothaus
32 changes: 32 additions & 0 deletions recipes/mojo-asciichart/test_package.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Test that mojo-asciichart package is installed and functional."""

from asciichart import plot

fn main() raises:
# Test basic plotting with simple data
var data = List[Float64]()
data.append(1.0)
data.append(2.0)
data.append(4.0)
data.append(3.0)
data.append(5.0)

# Generate chart - should not crash
var chart = plot(data)

# Basic validation: chart should contain box-drawing chars
if len(chart) < 10:
raise Error("Chart output too short")

# Should contain at least one box-drawing character
var has_box_char = False
for i in range(len(chart)):
var ch = chart[i]
if ch == "─" or ch == "│" or ch == "┤" or ch == "├" or ch == "╭" or ch == "╯":
has_box_char = True
break

if not has_box_char:
raise Error("Chart missing box-drawing characters")

print("✓ All tests passed")