diff --git a/recipes/mojo-asciichart/image.png b/recipes/mojo-asciichart/image.png new file mode 100644 index 00000000..8c6d48e3 Binary files /dev/null and b/recipes/mojo-asciichart/image.png differ diff --git a/recipes/mojo-asciichart/recipe.yaml b/recipes/mojo-asciichart/recipe.yaml new file mode 100644 index 00000000..fa94c4ea --- /dev/null +++ b/recipes/mojo-asciichart/recipe.yaml @@ -0,0 +1,57 @@ +context: + version: 1.1.2 + mojo_version: "=0.26.1" + +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 diff --git a/recipes/mojo-asciichart/test_package.mojo b/recipes/mojo-asciichart/test_package.mojo new file mode 100644 index 00000000..45026971 --- /dev/null +++ b/recipes/mojo-asciichart/test_package.mojo @@ -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")