Skip to content

Fix issues for Mypy 0.931 and Pydantic 1.9.0#10384

Closed
richardpaulhudson wants to merge 6 commits intoexplosion:masterfrom
richardpaulhudson:feature/mypy-fixes
Closed

Fix issues for Mypy 0.931 and Pydantic 1.9.0#10384
richardpaulhudson wants to merge 6 commits intoexplosion:masterfrom
richardpaulhudson:feature/mypy-fixes

Conversation

@richardpaulhudson
Copy link
Contributor

These changes allow updating to the latest versions of Mypy (0.931) and Pydantic (1.9.0)

Description

This PR depends on explosion/thinc#599, so that the tests will not pass at the time of submitting.

Types of change

Mypy / Pydantic fixes

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

cast(Model[List[Ints2d], Ragged], list2ragged()),
with_array(HashEmbed(nO=width, nV=rows, column=0, seed=5)), # type: ignore
list2ragged(),
# TODO: the typing does not seem to make sense here
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typing did not seem to make sense here.

set_dropout_rate(self.model, drop)
scores, backprop_scores = self.model.begin_update((docs, spans))
loss, d_scores = self.get_loss(examples, (spans, scores))
# TODO: the types do not seem to make sense here
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typing did not seem to make sense here.

textcat = nlp.add_pipe("textcat")
textcat.initialize(lambda: train_examples)
assert isinstance(textcat, TextCategorizer)
# TODO: the typing doesn't seem to make sense here
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typing did not seem to make sense here.

@svlandeg svlandeg added enhancement Feature requests and improvements types Issues related to typing or typing tools labels Feb 26, 2022
@NixBiks
Copy link
Contributor

NixBiks commented Apr 21, 2022

Can I ask what the status is here? I might be able to help out

pydantic 1.9 had some pretty damn good improvements (discriminated unions) that would be great to have available when using spacy as well.

@svlandeg
Copy link
Contributor

Can I ask what the status is here? I might be able to help out

pydantic 1.9 had some pretty damn good improvements (discriminated unions) that would be great to have available when using spacy as well.

You can follow the progress on the related Thinc PR: explosion/thinc#599 which is work-in-progress. We're carefully reviewing quite some type annotations in Thinc and we want to do this thoroughly ;-)

@NixBiks
Copy link
Contributor

NixBiks commented Apr 21, 2022

Fair play! Thanks for the update @svlandeg

@richardpaulhudson richardpaulhudson deleted the feature/mypy-fixes branch May 11, 2022 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature requests and improvements types Issues related to typing or typing tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants