TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Python Entry Points Explained

167 点作者 Nurdok将近 8 年前

4 条评论

rajathagasthya将近 8 年前
I highly recommend reading Stevedore package&#x27;s excellent documentation [1] to see practical examples of how entry points can be used as a plugin manager in applications.<p>[1] - <a href="https:&#x2F;&#x2F;docs.openstack.org&#x2F;stevedore&#x2F;latest&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;docs.openstack.org&#x2F;stevedore&#x2F;latest&#x2F;index.html</a>
jwilk将近 8 年前
Entry points are excellent at making your scripts start slooooooooow.<p>Compare<p><pre><code> $ time python -m pyflakes &#x2F;dev&#x2F;null real 0m0.225s user 0m0.103s sys 0m0.008s </code></pre> with<p><pre><code> $ time pyflakes &#x2F;dev&#x2F;null real 0m2.468s user 0m1.738s sys 0m0.055s</code></pre>
评论 #14875750 未加载
评论 #14874909 未加载
pmoriarty将近 8 年前
Way too much ink wasted on cuteness and too little on explanation.<p>I got stumped at:<p><i>&quot;In particular, the magic happens in get_sneks. The call to pkg_resources.iter_entry_points(&#x27;snek_types&#x27;) iterates over all the entry points that were registered under the name &quot;snek_types&quot;. So, external packages can define an entry point called &quot;snek_types&quot; in their setup.py, and snek will dynamically load it at runtime.&quot;</i><p>Wait. What entry points were registered under the name &quot;snek_types&quot;? Where were they regeistered as such? I think I must be missing something, or maybe that registration was hidden somewhere among all the fancy snakes. Can someone help explain this in a clearer way?
评论 #14874446 未加载
评论 #14874384 未加载
评论 #14874438 未加载
评论 #14874392 未加载
sjburt将近 8 年前
What is the actual value of entry points over just marking a script +x and putting somewhere on the path? All I see is a bunch of added complexity.
评论 #14878075 未加载