Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimenting: Annotated[Any, pybind11.CppType("cpp_namespace::UserType")] #4888

Draft
wants to merge 49 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7780fbc
Try `Annotated[Any, "cpp_namespace::UserType"]` unconditionally.
Oct 19, 2023
76b4a34
Add `struct handle_type_name<...>` specializations for `object`, `lis…
Oct 19, 2023
794d97e
Revert "Add `struct handle_type_name<...>` specializations for `objec…
Oct 19, 2023
2cafdab
Add `cpp_name_needs_typing_annotated()`
Oct 19, 2023
f6ae40b
clang-tidy compatibility
Oct 20, 2023
ea00323
Merge branch 'master' into annotated_any
Oct 20, 2023
272152e
`Annotated[Any, CppTypePybind11("cpp_namespace::UserType")]` based on…
Oct 21, 2023
90b3912
Merge branch 'master' into annotated_any
Oct 21, 2023
bb8709a
Remove `cpp_name_needs_typing_annotated()`. Preparation for bringing …
Oct 21, 2023
199532e
Reapply "Add `struct handle_type_name<...>` specializations for `obje…
Oct 21, 2023
7280380
Fix `handle_type_name<anyset>` as suggested by @sizmailov:
Oct 21, 2023
70a510c
Adjust test_numpy_dtypes test_signature to new behavior.
Oct 21, 2023
ace70b0
Render `anyset` as `set | frozenset` as suggested by @sizmailov:
Oct 21, 2023
7c8991a
Use `Union[set, frozenset]` for internal consistency.
Oct 21, 2023
63a4881
Add missing `handle_type_name<slice>` specialization (discovered only…
Oct 22, 2023
3c20944
Add missing `handle_type_name<>` specializations for `bytearray`, `me…
Oct 22, 2023
74817b7
Add missing `handle_type_name<module_>`.
Oct 22, 2023
6a3a954
Add missing `handle_type_name<dtype>`.
Oct 22, 2023
169b0e5
Add test returning `py::exception<void>` (fails at runtime).
Oct 22, 2023
acfd646
Merge branch 'master' into annotated_any
Oct 23, 2023
9548fa5
Merge branch 'master' into annotated_any
Nov 11, 2023
0b98433
Remove `CppTypePybind11()` wrapping for now.
Nov 14, 2023
781304e
Add test_cases_for_stubgen
Nov 14, 2023
61ee34e
Pull in `Annotated[list[int], FixedSize(2)]` from test_stl
Nov 14, 2023
1104076
Add `Annotated[Any, "..."]` wrapping in `type_info_description()`
Nov 14, 2023
e5f210e
Rename `user_type` to `UserType`
Nov 14, 2023
d1694d9
Use locally defined bindings to avoid dependency on test_stl.
Nov 15, 2023
1b4fa71
Unmodified copy of https://github.com/python/mypy/blob/c6cb3c6282003d…
Nov 15, 2023
644d150
Minimal changes to make the basics code build.
Nov 15, 2023
1fa0065
pre-commit clang-format, NO manual changes.
Nov 15, 2023
69dac46
Add `m.basics` tests in ntest_cases_for_stubgen.py
Nov 15, 2023
1a2e8a6
C++11 compatibility.
Nov 15, 2023
79f6bdc
Replace `.stl_binders.` with `.cases_for_stubgen.`
Nov 15, 2023
2376f6e
Use py::handle instead of py::object to avoid clang-tidy errors.
Nov 15, 2023
542438f
Merge branch 'master' into annotated_any
Nov 16, 2023
bdbb10d
Add some deeply nested test cases.
Nov 16, 2023
429a1f8
Make test_cases_for_stubgen.py much more compact, and the `pytest -v`…
Nov 16, 2023
2b2ffeb
Introduce `detail::annotated_any()` helper.
Nov 16, 2023
65661fe
Change `detail::annotated_any()` to produce `pybind11.CppType(...)`
Nov 16, 2023
6b771d5
Merge branch 'master' into annotated_any
Dec 17, 2023
813660c
Change `annotated_any()` to `quote_cpp_type_name()`
Dec 17, 2023
66ee131
Test changes to adjust to previous commit (Change `annotated_any()` t…
Dec 17, 2023
d14d91e
Remove `handle_type_name` default implementation, add explicit specia…
Dec 17, 2023
1e6bea2
Merge branch 'master' into annotated_any
Mar 27, 2024
bf6077a
style: pre-commit fixes
pre-commit-ci[bot] Mar 27, 2024
b02767d
Merge branch 'master' into annotated_any
Mar 27, 2024
67c41cc
Merge branch 'master' into annotated_any
Apr 1, 2024
8c5bb07
Merge branch 'master' into annotated_any
Apr 3, 2024
d57ed51
Adjustments related to pybind/pybind11#4985
Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Annotated[Any, CppTypePybind11("cpp_namespace::UserType")] based on…
… a suggestion by @sizmailov

#4888 (comment)
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Oct 21, 2023
commit 272152e68b062749e892dbb362ced079064fd666
2 changes: 1 addition & 1 deletion include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class cpp_function : public function {
std::string tname(t->name());
detail::clean_type_id(tname);
if (detail::cpp_name_needs_typing_annotated(tname.c_str())) {
signature += "Annotated[Any, \"" + tname + "\"]";
signature += "Annotated[Any, CppTypePybind11(\"" + tname + "\")]";
} else {
signature += tname;
}
Expand Down