Skip to content

Type checks#52

Open
it176131 wants to merge 11 commits intoexplosion:mainfrom
it176131:type-checks
Open

Type checks#52
it176131 wants to merge 11 commits intoexplosion:mainfrom
it176131:type-checks

Conversation

@it176131
Copy link

@it176131 it176131 commented Feb 5, 2026

This PR adds a py.typed file and puts the package in a passing state for mypy v1.19.1 and Python 3.10.11.

This tells type checkers like mypy that the package has type hints.

new file:   spacy_layout/py.typed
This silences mypy error related to pandas usage.

modified:   requirements.txt
This silences a mypy error.

modified:   spacy_layout/layout.py
This silences a mypy error.

modified:   spacy_layout/layout.py
This silences a mypy error.

modified:   spacy_layout/layout.py
The original loop variable was used in two different conditions which
altered the type. Introducing a separate variable for each condition
keeps the type consisten and silences a mypy error.

modified:   spacy_layout/layout.py
This silences a mypy error concerning the appending of two different
types to `inputs`, `TextItem` from the loop variable `text_item`, and
`TableItem` from the loop varaible `table_item`.

modified:   spacy_layout/layout.py
This silences a mypy error regarding local variable `item` not having
the attribute :meth:`export_to_dataframe`.

modified:   spacy_layout/layout.py
new file:   pyproject.toml
Added "warn_unused_ignores" to alert devs when `srsly` is type checked.

modified:   pyproject.toml
modified:   spacy_layout/layout.py
This silences a mypy error related to the usage of `OBJ_TYPES` values in
:func:`decode_obj`.

modified:   spacy_layout/util.py
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.

1 participant

Comments