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

Move functionality of Cardano.Ledger.Pretty to Test.Cardano.Ledger.Generic.PrettyCore #3973

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

TimSheard
Copy link
Contributor

@TimSheard TimSheard commented Jan 5, 2024

First step in the process of removing cardano-ledger-pretty

  1. removed all reference to Cardano.Ledger.Pretty in Test.Cardano.Ledger
  2. did this by moving functionality of Cardano.Ledger.Pretty to Test.Cardano.Ledger.Generic.PrettyCore
  3. Added new pretty printers for Predicate failures

Fixes #3974
Fixes #3926

Description

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@TimSheard TimSheard requested a review from lehins January 5, 2024 01:12
@TimSheard TimSheard force-pushed the ts-remove-cardano-ledger-pretty branch 4 times, most recently from f35319d to 5f0104a Compare January 8, 2024 21:51
removed all reference to Cardano.Ledger.Pretty in Test.Cardano.Ledger
@TimSheard TimSheard force-pushed the ts-remove-cardano-ledger-pretty branch from 5f0104a to 21f869e Compare January 9, 2024 00:31
Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

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

Nice. Next step is to remove cardano-ledger-pretty

@lehins lehins changed the title WIP Move functionality of Cardano.Ledger.Pretty to Test.Cardano.Ledger.Generic.PrettyCore Move functionality of Cardano.Ledger.Pretty to Test.Cardano.Ledger.Generic.PrettyCore Jan 9, 2024
@lehins lehins merged commit 1e59b73 into master Jan 9, 2024
10 of 21 checks passed
@TimSheard TimSheard mentioned this pull request Jan 11, 2024
9 tasks
@neilmayhew neilmayhew deleted the ts-remove-cardano-ledger-pretty branch March 8, 2024 21:07

Choose a reason for hiding this comment

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

I think you forgot to bump the version of cardano-ledger-test here. This is probably why the latest version on CHaP is dated back to the summer 2023?

Choose a reason for hiding this comment

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

I see, it's set to 9.9.9.9 and "not supposed to be released". Why is that the case @lehins? Though it's a testing library, prettyprinting stuff is something others may want to use.

Copy link
Contributor

Choose a reason for hiding this comment

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

We do not want to provide custom pretty printing functionality for public use, because it comes with a lot of overhead for the ledger teqm. Also, "others may want to use" is not good enough reason for us to provide this functionality in a public library. Quick search through github revealed that noone uses that functionality, so we decided to move it into the test suite.

Choose a reason for hiding this comment

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

Thank you for the reply. We are using it in the new version of the Cardano test emulator we are working on. It sounds like you recommend not using it all, but I don't see why we might want to roll out our own version from scratch. BTW the older versions of that cardano-ledger-test are in CHaP, which might be misleading. Technically it's public either way, it's just a matter of convenience. Not only prettyprinting stuff from the test library is useful for our project. And it's not a big deal to use it directly, though I would prefer having it in CHaP with proper version bumps when they happen. Anyway, thanks for your hard work on the ledger.

Copy link
Contributor

@lehins lehins Apr 2, 2024

Choose a reason for hiding this comment

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

BTW the older versions of that cardano-ledger-test are in CHaP, which might be misleading.

I know. CHaP is immutable, so we can't remove it. Initial version of cardano-ledger-test was released early on by mistake.

Technically it's public either way, it's just a matter of convenience.

Not exactly. Providing official support for any functionality puts extra overhead on the ledger team, including testing, releasing, etc of that functionality. For example bunch of current pretty printers that are used for testing are very much incomplete, which is not a problem for us, but it would be a big problem for us if we maintained a library that provided this incomplete functionality. Like we did in the past.

And it's not a big deal to use it directly

I would advise against it, since we do not guarantee its correctness, use it at your own risk.

I'd suggest downstream users of ledger roll out their own pretty printers. If you are willing to maintain a library with pretty printers, which would become popular in the community, then we'd be happy to add such a library to CHaPs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Pretty instance for TxBody Get rid of cardano-ledger-pretty
3 participants