Skip to content

Expose type annotations#424

Merged
btschwertfeger merged 2 commits into
btschwertfeger:masterfrom
Dreamsorcerer:patch-1
Apr 18, 2026
Merged

Expose type annotations#424
btschwertfeger merged 2 commits into
btschwertfeger:masterfrom
Dreamsorcerer:patch-1

Conversation

@Dreamsorcerer
Copy link
Copy Markdown
Contributor

This file is needed to tell tools that the library is typed and can be used for type checking. e.g. Mypy currently produces an error: Skipping analyzing "kraken.spot": module is installed, but missing library stubs or py.typed marker.

Comment thread src/kraken/py.typed Outdated
@btschwertfeger
Copy link
Copy Markdown
Owner

Hey @Dreamsorcerer thanks for bringing my attention to this file. Unfortunately, I can't reproduce the error your change tries to fix.

What I've done:

# from within the SDK's repository
uv venv venv 
source venv/bin/activate
uv build .
uv pip install dist/python_kraken_sdk-3.2.8.dev10-py3-none-any.whl
mkdir foo; cd foo
echo "from kraken.spot import SpotClient" > test_types.py
uv pip install mypy
mypy test_types.py
# output: 
Success: no issues found in 1 source file

So there seems to be no error here but I found that PEP 561 supports your argument.

Could you please provide a minimal reproducible example so that I can verify your changes?

@Dreamsorcerer
Copy link
Copy Markdown
Contributor Author

Try mypy --strict? This is very well documented and well understood though. Mypy docs itself: https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker

@Dreamsorcerer
Copy link
Copy Markdown
Contributor Author

Dreamsorcerer commented Apr 17, 2026

Actually I can reproduce trivially without. I can only assume you've somehow managed to get the kraken module on to MYPYPATH, which would end up type checking it without a marker.

> echo 'import kraken' > foo.py
> mypy foo.py
foo.py:1: error: Cannot find implementation or library stub for module named "kraken"  [import-not-found]
foo.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
> pip install python-kraken-sdk
[...]
> mypy foo.py
foo.py:1: error: Skipping analyzing "kraken": module is installed, but missing library stubs or py.typed marker  [import-untyped]
foo.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

@btschwertfeger
Copy link
Copy Markdown
Owner

Actually I can reproduce trivially without. I can only assume you've somehow managed to get the kraken module on to MYPYPATH, which would end up type checking it without a marker.

Yeah, this way it works. I could confirm that adding this file resolves the issue. Thanks!

@btschwertfeger btschwertfeger merged commit 929758c into btschwertfeger:master Apr 18, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants