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

Rename _dispatch to _dispatchable #7193

Merged
merged 3 commits into from Jan 12, 2024

Conversation

eriknw
Copy link
Contributor

@eriknw eriknw commented Dec 28, 2023

How do people like the name _dispatchable? Once there is better documentation for it (for users, backend developers, and networkx developers), then I think we should consider changing the name one last time to dispatchable.

@eriknw
Copy link
Contributor Author

eriknw commented Dec 28, 2023

This addresses one of the issues @JDLH raised in #7189 and goes with the suggestion by @rlratzel from #7189 (comment)

@JDLH
Copy link

JDLH commented Dec 28, 2023

Should the name remain prefixed with an underscore forever? I know very little about backend dispatching in NetworkX, but I think I remember reading that they underscore prefix was to signal that this decorator being preliminary and in flux. If this change is "one last time", then maybe the name is no longer preliminary or in flux?

@rossbar
Copy link
Contributor

rossbar commented Jan 3, 2024

Should the name remain prefixed with an underscore forever?

Definitely not - we should have a discussion on the dispatching roadmap, which I won't dump so as not to distract from the PR.

If this change is "one last time", then maybe the name is no longer preliminary or in flux?

I will say however that this is likely not the last change that would motivate removing the underscore!

@eriknw
Copy link
Contributor Author

eriknw commented Jan 3, 2024

To clarify, when I said "consider changing the name one last time to dispatchable", I meant to do this after renaming to _dispatchable, and only once it's ready. So, yeah, what @rossbar said :)

Copy link
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

Personally, I like the proposed name change. I feel that it better captures that the "dispatchability" is a property of the decorated function, rather than some internal indirection that impacts the actual networkx implementation. This should hopefully help alleviate some of the concerns for readers of the source code highlighted in #7189 .

@JDLH what do you think - is the proposed name change more clear IYO?

@JDLH
Copy link

JDLH commented Jan 11, 2024

@rossbar I think "dispatchable" is an improvement on the previous name "dispatch". It has the advantage that, as you say, it reads like a property of the decorated function. It has the disadvantage of being opaque to most readers about what that property actually means. The word "dispatchable" does not by itself quite tell most readers what they need to know.

Thus I think the new name needs to be paired with an explanation of the decorator, under the name "dispatchable", in the function reference documentation. When I was looking for an explanation of this decorator, the function reference is where I searched for the name "_dispatch". There was no text under that heading. I suggest that the explanation include a message to readers who don't care about backends, and are not using networkx as a front end to other libraries, that this decorator is of no concern to them. Then it should have a reference to the place in the documentation where dispatching and backends are explained.

Maybe after that it has the normal reference documentation about the decorator, its parameters, its effects, etc. A lot of this reference documentation is presently located in the module utils/backends.py.

@rossbar
Copy link
Contributor

rossbar commented Jan 11, 2024

Thus I think the new name needs to be paired with an explanation of the decorator, under the name "dispatchable", in the function reference documentation.

Agreed - the renaming here is certainly not sufficient to address #7189 on its own. There should definitely be a very visible and easily discoverable reference with the explanation you describe. In addition to reference docs, it might also be worth adding a term to the glossary and using the :term: role liberally throughout the documentation to link to the high-level overview page of the _dispatchable decorator.

Copy link
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

Everyone who's weighed in on the topic (either here or in community meetings) has general agreed the new name is an improvement, so I approve!

@eriknw
Copy link
Contributor Author

eriknw commented Jan 11, 2024

Great 🚀 !

Yeah, docs should be updated too, but they should be updated in a separate PR. A substantial change (updating docs) shouldn't be buried with the large but simple change in this PR.

And online docs for _dispatch shows up now:
https://networkx.org/documentation/latest/reference/generated/networkx.utils.backends._dispatch.html

And also _dispatchable in this PR:
https://output.circle-artifacts.com/output/job/966e4ee2-c0bc-455d-ac98-f7ab2343201e/artifacts/0/doc/build/html/reference/generated/networkx.utils.backends._dispatchable.html

@dschult dschult merged commit 83030a6 into networkx:main Jan 12, 2024
39 checks passed
@jarrodmillman jarrodmillman added this to the 3.3 milestone Jan 12, 2024
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
Co-authored-by: Dan Schult <dschult@colgate.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

5 participants