Skip to content

Add type hints and py.typed marker (PEP 561)#112

Open
lfoppiano wants to merge 1 commit into
masterfrom
feature/issue-71-type-hints
Open

Add type hints and py.typed marker (PEP 561)#112
lfoppiano wants to merge 1 commit into
masterfrom
feature/issue-71-type-hints

Conversation

@lfoppiano

Copy link
Copy Markdown
Member

Annotate the whole codebase (client, main GrobidClient, the TEI2LossyJSON and TEI2Markdown converters, the CLIs and the validator) and ship a py.typed marker so type checkers pick up the inline hints. Each module uses 'from future import annotations' so annotations stay lazy and cannot affect runtime behavior (and remain valid on Python 3.8).

Packaging:

  • add grobid_client/py.typed and expose it via package-data and MANIFEST.in
  • include the grobid_client.format subpackage in the distribution
  • add a [tool.mypy] section (ignore missing third-party stubs; relax the BeautifulSoup-heavy converter modules whose dynamic API yields false positives)

mypy runs clean on the package and the existing test-suite still passes.

Closes #71

@lfoppiano
lfoppiano force-pushed the feature/issue-71-type-hints branch from 93d5f84 to 2b538a3 Compare July 23, 2026 14:36
Annotate the whole codebase (client, main GrobidClient, the TEI2LossyJSON and
TEI2Markdown converters, the CLIs and the validator) and ship a py.typed marker
so type checkers pick up the inline hints. Each module uses
'from __future__ import annotations' so annotations stay lazy and cannot affect
runtime behavior (and remain valid on Python 3.8).

Packaging:
- add grobid_client/py.typed and expose it via package-data and MANIFEST.in
- include the grobid_client.format subpackage in the distribution
- add a [tool.mypy] section (ignore missing third-party stubs; relax the
  BeautifulSoup-heavy converter modules whose dynamic API yields false positives)

CI:
- install mypy and run 'mypy grobid_client' in the build workflow (on 3.11)

mypy runs clean on the package and the existing test-suite still passes.

Closes #71
@lfoppiano
lfoppiano force-pushed the feature/issue-71-type-hints branch from 2b538a3 to 1f16f36 Compare July 23, 2026 15:21
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.

Request: adding type hints

1 participant