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

Allow printing out "absolute" type names (with dotted module paths) #1661

Closed
wants to merge 3 commits into from

Conversation

necaris
Copy link

@necaris necaris commented Mar 20, 2021

See #1342 (reply in thread) for more context. This enables me to see diagnostic output like:

error: Expression of type "tornado.concurrent.Future[None]" cannot be assigned to declared type "asyncio.futures.Future[None]"

rather than the less helpful previous output:

error: Expression of type "Future[None]" cannot be assigned to declared type "Future[None]"

Not sure where at this point to add tests or to add the parsing of the flag (as a command-line or pyrightconfig.json option?) but all feedback very much appreciated!

@necaris necaris force-pushed the absolute-type-names branch from 433f3d4 to ddcaa15 Compare March 20, 2021 08:05
necaris added 3 commits March 20, 2021 04:06
This changes the behavior when printing an object's type to show its
"absolute" module path (e.g. `builtins.int` or `asyncio.futures.Future`)
rather than the shortened name.
Define it as defaulting to `false` except for strict diagnostics
@necaris necaris force-pushed the absolute-type-names branch from ddcaa15 to 289abba Compare March 20, 2021 08:06
@erictraut
Copy link
Collaborator

Thanks for the PR, but I don't think this is a good change. Most users do not want verbose type output, and you've enabled this feature by default for all strict-mode types. This also breaks a bunch of tests.

I am not convinced this feature is needed generally. You're welcome to fork the repo and make the change locally if you have a strong need for it.

@erictraut erictraut closed this Mar 20, 2021
@necaris
Copy link
Author

necaris commented Mar 23, 2021

Would it work better if it were gated behind a configuration flag? I doubt I'm alone in wanting more than the elided values, especially when debugging adding types to an existing codebase.

@erictraut
Copy link
Collaborator

We generally don't add new configuration flags until we get some signal that the capability is desired by many users. My intuition is that your needs are pretty unique here, but I remain open minded and will reconsider if other users speak up and request this capability.

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.

2 participants