Skip to content

Replace custom TableFormatting.jl with Term.jl #2

@gescholt

Description

@gescholt

Summary

Replace the 470-line custom TableFormatting.jl with the industry-standard Term.jl package for richer, more maintainable table formatting.

Motivation

Current situation:

  • src/TableFormatting.jl is 470 lines of custom table formatting code
  • Reinvents functionality that Term.jl provides out-of-the-box
  • Maintenance burden for custom width calculation, formatting, etc.

Benefits of Term.jl:

  • ✅ Eliminate custom code maintenance burden
  • ✅ Richer formatting (colors, panels, boxes, styling)
  • ✅ Better layout control with composition operators (*, /)
  • ✅ Actively maintained package with growing community
  • ✅ Still pure text output (no plotting dependencies)

Research

Term.jl is used by mature Julia packages and provides:

  • Table() with rich formatting options
  • Panel() for grouped content
  • Layout operators for composition
  • Compatible with Tables.jl interface

Tasks

  • Add Term.jl to Project.toml dependencies
  • Create format_metrics_table_term() prototype
  • Benchmark Term.jl vs current PrettyTables implementation
  • Migrate table formatting functions to Term.jl
  • Keep PrettyTables for backward compatibility (deprecation path)
  • Update all examples to demonstrate Term.jl formatting
  • Update documentation

Implementation Notes

using Term

function format_metrics_table_modern(agg_stats::Dict; style=:grouped)
    # Use Term.jl Panel and Table
    metrics_table = Table(df; 
        header_style="bold cyan",
        columns_style=["green", "yellow", "red"])
    
    panel = Panel(metrics_table,
        title="📊 Campaign Metrics",
        style="bold blue")
    
    return panel
end

Priority

HIGH - Reduces technical debt, improves user experience

Estimated Effort

1-2 weeks (prototyping, testing, migration, documentation)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions