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

A basic support for dataclasses #1

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

orsinium
Copy link

Features:

  1. The name mappings is taken on PyPI, rename the project into typed_dict.
  2. Add from_dataclass function to convert a dataclass into a TypedDict at runtime.
  3. Add mypy plugin to make mypy understand from_dataclass.

Chore:

  1. Upgrade all dependencies
  2. Add and use taskfile
  3. Add pytest and pytest-mypy-plugins tests
  4. Update README
  5. Add a few usage examples
  6. Drop nitpick, migrate configs to pyproject.toml wherever possible.

The test coverage isn't 100% and the plugin doesn't support all features of dataclasses yet. The biggest struggle I have with the plugin is that the built-in mypy plugin for dataclasses kicks in earlier than our custom plugin if the dataclass is imported from another module but later if the dataclass is defined in the same module. So, I had to support both, and the latter is quite complicated. The official plugin for dataclass is huge and messy, and I don't think fully duplicating it here is a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant