Open NixBiks opened 3 years ago
I think it would be great to add something like the following type
import typing as t
from typing_extensions import TypedDict # only available in typing from py3.8+
class Config(TypedDict):
id: t.Optional[str]
entry: ...
exit: ...
states: ...
on: ...
type: ...
data: ...
onDone: ...
initial: ...
Then you get auto complete suggestions when using the config object and IDE's should warn you if you try to make a config that isn't valid.
What python versions do we wish to support? No need for typing_extensions
if we look at python 3.8+
What python versions do we wish to support? No need for
typing_extensions
if we look at python 3.8+
We probably want to support 3.x versions of Python (whatever this cut-off is), since I imagine the majority of Python devs are still on an older version.
To get improved auto suggestions when creating config
in VS Code (when above is implemented) we'd need this issue to be resolved in Pylance: https://github.com/microsoft/pylance-release/issues/654
They prioritise by upvotes so if you want better autocomplete for XState in python then please give it a vote.
Pyright released a new version that enables autocomplete for TypedDict
in VS Code if people use Pylance (which I assume anyone writing python in vs code pretty much do).
See this for details; https://github.com/microsoft/pylance-release/issues/654 and this: https://github.com/microsoft/pylance-release/releases/tag/2021.9.4
This is a task originally made for PR #34 but I decided to make it into its own issue instead, since it will take some effort to do proper typing in the package.
poetry run mypy -p xstate
runs without errors.github/workflows/pull_request.yaml
in the code quality section