question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] No `Optional` typing in args that accept `None` in `Console`.

See original GitHub issue

Some arguments to rich.console.Console—like width—accept None as an argument and are documented as Optional but are typed as only int, raising some type checking errors if width=None is passed.

https://github.com/willmcgugan/rich/blob/a05a5a1c2f95f25db70ac3657e99f0bab652e2cd/rich/console.py#L577

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Apr 23, 2021

It’s somewhat irritating to have a convenient feature added only to have it taken away. However since it looks like you’ve done the work, I have no issue with changing it.

1reaction
paw-lucommented, Apr 23, 2021

If you’re interested, #1182 attempts to impliment the Optional typing throughout Rich.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] No `Optional` typing in args that accept `None` in `Console ...
Some arguments to rich.console.Console—like width—accept None as an argument and are documented as Optional but are typed as only int, raising some type...
Read more >
Python 3.10+: Optional[Type] or Type | None - Stack Overflow
, which declares that this is a required argument where None is one of the valid argument value.
Read more >
argparse — Parser for command-line options, arguments and ...
For a more gentle introduction to Python command-line parsing, have a look at the argparse tutorial. The argparse module makes it easy to...
Read more >
Python Type Checking (Guide) - Real Python
In this guide, you'll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit...
Read more >
Kinds of types - mypy 0.991 documentation
def show_heading(s) -> None: print('=== ' + s + ' ===') # No static type ... The type of a function that accepts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found