Open
Description
typeshed currently hosts stubs for ujson: https://github.com/python/typeshed/tree/main/stubs/ujson
I asked ujson if they'd be happy to inline the stubs, and it looks like they would! ultrajson/ultrajson#671
I've given this a go here: https://github.com/MarcoGorelli/ultrajson/tree/inline-stubs
Could I please ask that someone help me out with where to place the py.typed
file? I'm aware of where to place it in a Python project, but in ujson it's all C extensions
I've tried to just put it in the root, but then, in a separate virtual environment, if I do
$ uv pip uninstall ujson
Uninstalled 1 package in 12ms
- ujson==5.10.0
$ uv pip install git+https://github.com/MarcoGorelli/ultrajson.git --no-cache
Updated https://github.com/MarcoGorelli/ultrajson.git (2ea54f6a1d1b8e2bc3a27c491a63238cf244f087)
Resolved 1 package in 5.34s
Built ujson @ git+https://github.com/MarcoGorelli/ultrajson.git@2ea54f6a1d1b8e2bc3a27c491a63238cf244f087
Prepared 1 package in 7.42s
Installed 1 package in 3ms
+ ujson==0.1.dev969 (from git+https://github.com/MarcoGorelli/ultrajson.git@2ea54f6a1d1b8e2bc3a27c491a63238cf244f087)
and then make a file t.py
with
import ujson
ujson.dumps([{"key": "value"}, 81, True], ensure_ascii = 42)
ujson.loads("""[{"key": "value"}, 81, true]""")
and run mypy t.py
, then I see
$ mypy t.py
t.py:1: error: Library stubs not installed for "ujson" [import-untyped]
t.py:1: note: Hint: "python3 -m pip install types-ujson"
t.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
t.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)
Any help towards this would be appreciated 🙏 Ultimately, the benefit to typeshed would be fewer stubs to maintain here
Metadata
Metadata
Assignees
Labels
No labels