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

Prefix newly added globals in Python with underscores #2109

Merged
merged 3 commits into from
May 15, 2024

Conversation

heinrich5991
Copy link
Contributor

Followup of #1599.

This name is internal to uniffi, it should be explicitly named using
`library.uniffi_set_event_loop`.
@heinrich5991 heinrich5991 requested a review from a team as a code owner May 14, 2024 18:44
@heinrich5991 heinrich5991 requested review from bendk and removed request for a team May 14, 2024 18:44
Copy link
Member

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine except for uniffi_set_event_loop (and maybe I just misunderstood!)

@@ -75,9 +75,6 @@
{%- for c in ci.callback_interface_definitions() %}
"{{ c.name()|class_name }}",
{%- endfor %}
{%- if ci.has_async_fns() %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want this change - this function is documented as being exported by the Python bindings.

Copy link
Contributor Author

@heinrich5991 heinrich5991 May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still exported. __all__ just determines what you get when you do from library import *. You can still get it using import library; library.uniffi_set_event_loop or from library import uniffi_set_event_loop.

EDIT: Docs: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that - but I'm not sure this change will meet the expectations of people reading our docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(to be clear, I'm not saying this change is wrong, I'm just not sure it's correct. @badboy @bendk do either of you have thoughts)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry for the stream of thoughts: this function is only used in such edge-cases that I think I'd also be fine with a note in the docs flagging that the symbol must be used by importing it and "from mod import *" doesn't work)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added such a note.

Copy link
Member

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mhammond mhammond merged commit 11c9a0a into mozilla:main May 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants