<h2 dir="auto"><g-emoji class="g-emoji" alias="rocket" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f680.png">🚀</g-emoji> Enhancement</h2>

<p dir="auto">It seems like we can improve the way user-facing APIs are surfaced in the python inteface for distributed. Specifically, we have user-facing APIs defined in many places, but there is no clear way to make something part of the external API vs internal only. One way to do this would be to define an <strong>all</strong> in <strong>init</strong>.py that exports all of our public-facing APIs.</p>
<p dir="auto">This will also make it easier for users to introspect our module in python and see the different functions/classes that are intended to be used, and our implementation stays hidden.</p>
<h2 dir="auto">Motivation</h2>
<p dir="auto">The discussion and context in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="499666728" data-permission-text="Title is private" data-url="https://github.com/pytorch/pytorch/issues/26997" data-hovercard-type="pull_request" data-hovercard-url="/pytorch/pytorch/pull/26997/hovercard" href="https://github.com/pytorch/pytorch/pull/26997">#26997</a> makes it seem like something that we would want.</p>
<h2 dir="auto">Pitch</h2>
<ol dir="auto">
<li>Figure out our external facing APIs</li>
<li>Instead of importing everything (*) from other modules in <strong>init</strong>.py, import only the ones required</li>
<li>Create an <strong>all</strong> that exports these in <code class="notranslate">__init__.py</code></li>
</ol>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pietern/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pietern">@pietern</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mrshenli/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mrshenli">@mrshenli</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pritamdamania87/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pritamdamania87">@pritamdamania87</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/zhaojuanmao/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/zhaojuanmao">@zhaojuanmao</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/satgera/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/satgera">@satgera</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rohan-varma/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rohan-varma">@rohan-varma</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gqchen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gqchen">@gqchen</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/aazzolini/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/aazzolini">@aazzolini</a></p>
<p dir="auto">This is to summarize maintability requests from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="499098236" data-permission-text="Title is private" data-url="https://github.com/pytorch/pytorch/issues/26919" data-hovercard-type="pull_request" data-hovercard-url="/pytorch/pytorch/pull/26919/hovercard" href="https://github.com/pytorch/pytorch/pull/26919">#26919</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="499666728" data-permission-text="Title is private" data-url="https://github.com/pytorch/pytorch/issues/26997" data-hovercard-type="pull_request" data-hovercard-url="/pytorch/pytorch/pull/26997/hovercard" href="https://github.com/pytorch/pytorch/pull/26997">#26997</a>.</p>
<p dir="auto">I think rpc should create a folder like <code class="notranslate">distributed/autograd</code> does<br>
Maintain the names want to be exposed to users in <code class="notranslate">torch/distributed/rpc/__init__.py</code>.<br>
Do the actual implmentation in <code class="notranslate">torch/distributed/rpc/rpc_api.py</code>.</p>
<p dir="auto">Also, do not use <code class="notranslate">from "something" import *</code>, as descirebd in <a href="https://docs.quantifiedcode.com/python-anti-patterns/maintainability/from_module_import_all_used.html" rel="nofollow">https://docs.quantifiedcode.com/python-anti-patterns/maintainability/from_module_import_all_used.html</a>, it's not clear what has been imported to current module.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pietern/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pietern">@pietern</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mrshenli/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mrshenli">@mrshenli</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pritamdamania87/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pritamdamania87">@pritamdamania87</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/zhaojuanmao/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/zhaojuanmao">@zhaojuanmao</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/satgera/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/satgera">@satgera</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gqchen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gqchen">@gqchen</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/aazzolini/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/aazzolini">@aazzolini</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rohan-varma/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rohan-varma">@rohan-varma</a></p>