-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
rwgk
wants to merge
49
commits into
pybind:master
Choose a base branch
from
rwgk:annotated_any
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
7780fbc
Try `Annotated[Any, "cpp_namespace::UserType"]` unconditionally.
76b4a34
Add `struct handle_type_name<...>` specializations for `object`, `lis…
794d97e
Revert "Add `struct handle_type_name<...>` specializations for `objec…
2cafdab
Add `cpp_name_needs_typing_annotated()`
f6ae40b
clang-tidy compatibility
ea00323
Merge branch 'master' into annotated_any
272152e
`Annotated[Any, CppTypePybind11("cpp_namespace::UserType")]` based on…
90b3912
Merge branch 'master' into annotated_any
bb8709a
Remove `cpp_name_needs_typing_annotated()`. Preparation for bringing …
199532e
Reapply "Add `struct handle_type_name<...>` specializations for `obje…
7280380
Fix `handle_type_name<anyset>` as suggested by @sizmailov:
70a510c
Adjust test_numpy_dtypes test_signature to new behavior.
ace70b0
Render `anyset` as `set | frozenset` as suggested by @sizmailov:
7c8991a
Use `Union[set, frozenset]` for internal consistency.
63a4881
Add missing `handle_type_name<slice>` specialization (discovered only…
3c20944
Add missing `handle_type_name<>` specializations for `bytearray`, `me…
74817b7
Add missing `handle_type_name<module_>`.
6a3a954
Add missing `handle_type_name<dtype>`.
169b0e5
Add test returning `py::exception<void>` (fails at runtime).
acfd646
Merge branch 'master' into annotated_any
9548fa5
Merge branch 'master' into annotated_any
0b98433
Remove `CppTypePybind11()` wrapping for now.
781304e
Add test_cases_for_stubgen
61ee34e
Pull in `Annotated[list[int], FixedSize(2)]` from test_stl
1104076
Add `Annotated[Any, "..."]` wrapping in `type_info_description()`
e5f210e
Rename `user_type` to `UserType`
d1694d9
Use locally defined bindings to avoid dependency on test_stl.
1b4fa71
Unmodified copy of https://github.com/python/mypy/blob/c6cb3c6282003d…
644d150
Minimal changes to make the basics code build.
1fa0065
pre-commit clang-format, NO manual changes.
69dac46
Add `m.basics` tests in ntest_cases_for_stubgen.py
1a2e8a6
C++11 compatibility.
79f6bdc
Replace `.stl_binders.` with `.cases_for_stubgen.`
2376f6e
Use py::handle instead of py::object to avoid clang-tidy errors.
542438f
Merge branch 'master' into annotated_any
bdbb10d
Add some deeply nested test cases.
429a1f8
Make test_cases_for_stubgen.py much more compact, and the `pytest -v`…
2b2ffeb
Introduce `detail::annotated_any()` helper.
65661fe
Change `detail::annotated_any()` to produce `pybind11.CppType(...)`
6b771d5
Merge branch 'master' into annotated_any
813660c
Change `annotated_any()` to `quote_cpp_type_name()`
66ee131
Test changes to adjust to previous commit (Change `annotated_any()` t…
d14d91e
Remove `handle_type_name` default implementation, add explicit specia…
1e6bea2
Merge branch 'master' into annotated_any
bf6077a
style: pre-commit fixes
pre-commit-ci[bot] b02767d
Merge branch 'master' into annotated_any
67c41cc
Merge branch 'master' into annotated_any
8c5bb07
Merge branch 'master' into annotated_any
d57ed51
Adjustments related to pybind/pybind11#4985
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://docs.python.org/3/c-api/set.html
anyset
is an alias for "set or fronzenset".The contexts where rendering it as
set | frozenset
might lead to trouble are pretty exotic, I think it's ok to render as union type:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: ace70b0
I see
Union[...]
is used in multiple places.Could it be better to use
Union[set, frozenset]
for self-consistency?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's use
Union
for consistencyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: 7c8991a