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

Challenge should include Python target version #2

Closed
yanyongyu opened this issue Nov 1, 2023 · 5 comments · Fixed by #14
Closed

Challenge should include Python target version #2

yanyongyu opened this issue Nov 1, 2023 · 5 comments · Fixed by #14

Comments

@yanyongyu
Copy link
Contributor

Python version will affect the challenge test, such as:

Challenge - dict

type custom = dict[str, str]

def foo(x: custom):
    pass

it's ok in python 3.12, but could not pass the test.

image

@laike9m
Copy link
Owner

laike9m commented Nov 1, 2023

Thanks for the feedback. Will add some information

Though this is because mypy doesn't support it yet
python/mypy#15238

@yanyongyu
Copy link
Contributor Author

yanyongyu commented Nov 1, 2023

Pyright, which developed by the author of the issue you mentioned, has already supported this feature. It's also a modern static type checker supported by microsoft and used in vscode officially (core of the Pylance LS). It could also set the python version and even platform type. Here's an playground example.

image

@laike9m
Copy link
Owner

laike9m commented Nov 2, 2023

You're right, I'm considering supporting more type checkers (pyright in particular) as a long term solution, since pyright implements the typing PEPs more timely. (more context: pyright does not have a Python API, so it's not as easy to integrate as mypy, it requires installing node.js and calling a subprocess, which is doable but needs some more consideration)

In the short-term, I plan to add some message to indicate the things that are not yet supported (like the type keyword)

@yanyongyu
Copy link
Contributor Author

For some complex type derivation challenges, we have encountered many situations that mypy cannot infer, and Pyright is able to do so. That's good if pyright will be supported.

@laike9m
Copy link
Owner

laike9m commented Nov 2, 2023

ture. Unfortunately mypy is not well funded as pyright does, as you can imagine

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 a pull request may close this issue.

2 participants