Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace prettytable-rs with comfy-table #2413

Merged
merged 1 commit into from
Feb 20, 2025
Merged

Conversation

pubmodmatt
Copy link
Contributor

Replace the prettytable-rs dependency with comfy-table.

Motivation

The table output by rover config whoami was misalgined, due to this issue in prettytable-rs:

┌───────────────┬────────────────────────────────────────────┐
│ Key Type    │ Graph                                      │
├───────────────┼────────────────────────────────────────────┤
│ Graph ID    │ SpaceOrbit3                                │
├───────────────┼────────────────────────────────────────────┤
│ Graph Title │ SpaceOrbit                                 │
├───────────────┼────────────────────────────────────────────┤
│ Origin      │ $APOLLO_KEY                                │
├───────────────┼────────────────────────────────────────────┤
│ API Key     │ ****************************************** │
└───────────────┴────────────────────────────────────────────┘

As pointed out in the comparison with other libraries in the comfy-table docs, it appears that prettytable-rs may be abandoned. The fix for the above issue has had an open PR for several months, but it has not been merged and released. comfy-table appears to be actively developed, and had a new version release 12 days ago.

Differences

Dropping in comfy-table is almost seamless. There are a few very slight differences in the output, in addition to fixing the above alignment issue:

  • The bold headers were not working with prettytable-rs, but they do work with comfy-table
  • comfy-table uses a double line between the header row and the next row, more clearly delineating the headers
  • The comfy-table preset uses dashed lines inside the table, and solid lines for the table border, provding a nice visual separation. prettytable-rs used solid lines everywhere.

Comparison

Note that the examples below do not show bold fonts or colors that would appear in the terminal.

rover config whoami

prettytable-rs

┌───────────────┬────────────────────────────────────────────┐
│ Key Type    │ Graph                                      │
├───────────────┼────────────────────────────────────────────┤
│ Graph ID    │ SpaceOrbit3                                │
├───────────────┼────────────────────────────────────────────┤
│ Graph Title │ SpaceOrbit                                 │
├───────────────┼────────────────────────────────────────────┤
│ Origin      │ $APOLLO_KEY                                │
├───────────────┼────────────────────────────────────────────┤
│ API Key     │ ****************************************** │
└───────────────┴────────────────────────────────────────────┘

comfy-table

┌─────────────┬────────────────────────────────────────────┐
│ Key Type    ┆ Graph                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Graph ID    ┆ SpaceOrbit3                                │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Graph Title ┆ SpaceOrbit                                 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Origin      ┆ $APOLLO_KEY                                │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ API Key     ┆ ****************************************** │
└─────────────┴────────────────────────────────────────────┘

rover docs list

prettytable-rs

┌──────────────┬──────────────────────────────────────┐
│     Slug     │             Description              │
├──────────────┼──────────────────────────────────────┤
│ api-keys     │ Understanding Apollo's API Keys      │
├──────────────┼──────────────────────────────────────┤
│ contributing │ Contributing to Rover                │
├──────────────┼──────────────────────────────────────┤
│ docs         │ Rover's Documentation Homepage       │
├──────────────┼──────────────────────────────────────┤
│ migration    │ Migrate from the Apollo CLI to Rover │
├──────────────┼──────────────────────────────────────┤
│ start        │ Getting Started with Rover           │
└──────────────┴──────────────────────────────────────┘

comfy-table

┌──────────────┬──────────────────────────────────────┐
│     Slug     ┆              Description             │
╞══════════════╪══════════════════════════════════════╡
│ api-keys     ┆ Understanding Apollo's API Keys      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ contributing ┆ Contributing to Rover                │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ docs         ┆ Rover's Documentation Homepage       │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ migration    ┆ Migrate from the Apollo CLI to Rover │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ start        ┆ Getting Started with Rover           │
└──────────────┴──────────────────────────────────────┘

rover subgraph list

prettytable-rs

┌───────┬───────────────────────┬────────────────────────────┐
│ Name  │      Routing Url      │        Last Updated        │
├───────┼───────────────────────┼────────────────────────────┤
│ posts │ http://localhost:4000 │ 2025-02-19 12:04:01 -07:00 │
└───────┴───────────────────────┴────────────────────────────┘

comfy-table

┌───────┬───────────────────────┬────────────────────────────┐
│  Name ┆      Routing Url      ┆        Last Updated        │
╞═══════╪═══════════════════════╪════════════════════════════╡
│ posts ┆ http://localhost:4000 ┆ 2025-02-19 12:04:01 -07:00 │
└───────┴───────────────────────┴────────────────────────────┘

@pubmodmatt pubmodmatt self-assigned this Feb 20, 2025
@pubmodmatt pubmodmatt requested a review from a team as a code owner February 20, 2025 14:21
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Feb 20, 2025

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: fb4078d0e5b2347794871e1d

@pubmodmatt pubmodmatt force-pushed the pubmodmatt/table_impl branch from 76ff8f4 to 1443213 Compare February 20, 2025 14:22
Copy link
Contributor

@aaronArinder aaronArinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! though, what was the check_workflow.rs file? just... empty? was it used for anything?

@pubmodmatt pubmodmatt force-pushed the pubmodmatt/table_impl branch from 1443213 to 4b2aee3 Compare February 20, 2025 14:34
@pubmodmatt
Copy link
Contributor Author

what was the check_workflow.rs file? just... empty? was it used for anything?

As far as I could tell, it was an empty module not used anywhere, so just some code cleanup there.

@jonathanrainer jonathanrainer added this to the vNext milestone Feb 20, 2025
@pubmodmatt pubmodmatt merged commit 132ce31 into main Feb 20, 2025
32 checks passed
@pubmodmatt pubmodmatt deleted the pubmodmatt/table_impl branch February 20, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants