Conversation
68a3c80 to
0e14286
Compare
| @@ -0,0 +1,187 @@ | |||
| __all__ = [ | |||
There was a problem hiding this comment.
Should this file be in wurlitzer/init.pyi ? Otherwise it won't get installed and won't be usable by other projects, right?
And what do you think about inline type annotations vs these stub files?
There was a problem hiding this comment.
Thanks for your review!
py.typed shouldn't be necessary if there's wurlitzer-stubs:
If the package is stub-only (not imported at runtime), the package should have a prefix of the runtime package name and a suffix of -stubs. A py.typed file is not needed for stub-only packages
https://mypy.readthedocs.io/en/stable/installed_packages.html
I've tried installing this from my branch in a virtual environment, and it finds the stubs fine:
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ uv pip uninstall wurlitzer
warning: Skipping wurlitzer as it is not installed
warning: No packages to uninstall
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ uv pip install git+https://github.com/MarcoGorelli/wurlitzer.git@inline-stubs --no-cache
Updated https://github.com/MarcoGorelli/wurlitzer.git (cbe50b7f3b46aa6c2ce1d45e199f60da497b
Resolved 1 package in 2.74s
Built wurlitzer @ git+https://github.com/MarcoGorelli/wurlitzer.git@cbe50b7f3b46aa6c2ce1d
Prepared 1 package in 1.03s
Installed 1 package in 2ms
+ wurlitzer==3.2.0.dev0 (from git+https://github.com/MarcoGorelli/wurlitzer.git@cbe50b7f3b46aa6c2ce1d45e199f60da497b5285)
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ cat t.py
from io import StringIO
import wurlitzer
from wurlitzer import Wurlitzer
reveal_type(Wurlitzer.flush_interval)
(scratch) marcogorelli@DESKTOP-U8OKFP3:~/scratch$ mypy t.py
t.py:5: note: Revealed type is "builtins.float"
Success: no issues found in 1 source fileThere was a problem hiding this comment.
And what do you think about inline type annotations vs these stub files?
No preference to be honest
Happy to move the types into the Python file and have the py.typed if you prefer 👍
cca4418 to
0203fd4
Compare
4eb2afb to
cbe50b7
Compare
cbe50b7 to
de469a6
Compare
closes #95