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

[help] How can I apply depth control in rich.pretty? #1585

Closed
avatar-lavventura opened this issue Oct 14, 2021 · 5 comments
Closed

[help] How can I apply depth control in rich.pretty? #1585

avatar-lavventura opened this issue Oct 14, 2021 · 5 comments
Assignees
Labels
accepted Task was accepted enhancement New feature or request

Comments

@avatar-lavventura
Copy link

pprint has a depth argument in order to control nesting level.

depth controls the number of nesting levels which may be printed; if the data structure being printed is too deep, the next contained level is replaced by .... By default, there is no constraint on the depth of the objects being formatted.

Would it be possible to apply similiar apprach on rich.pretty in order to save its results into a file?

@willmcgugan
Copy link
Collaborator

There isn't a depth parameter ATM. Although it will detect a recursive data structure.

Open to adding one. I will take a look at some point, but would also accept a PR.

@willmcgugan willmcgugan added accepted Task was accepted enhancement New feature or request and removed Needs triage labels Oct 16, 2021
@avatar-lavventura
Copy link
Author

@willmcgugan Thank you sir. If I can accomplish as PR will let you know.

@v0lp3
Copy link
Contributor

v0lp3 commented Oct 16, 2021

This is not implemented by attribute max_length in Pretty object?
@avatar-lavventura @willmcgugan

@willmcgugan
Copy link
Collaborator

v11.0.0 has a max_depth argument for pretty printing

@github-actions
Copy link

github-actions bot commented Jan 9, 2022

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 11, 2022
11.0.0

Added

Added max_depth arg to pretty printing Textualize/rich#1585
Added vertical_align to Table.add_row Textualize/rich#1590

Fixed

Fixed issue with pretty repr in jupyter notebook Textualize/rich#1717
Fix Traceback theme defaults override user supplied styles Textualize/rich#1786

Changed

breaking Deprecated rich.console.RenderGroup, now named rich.console.Group
breaking Syntax.__init__ parameter lexer_name renamed to lexer
Syntax constructor accepts both str and now a pygments lexer Textualize/rich#1748
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Task was accepted enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants