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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: What are some unusual but useful Python libraries you've discovered?

38 点作者 alexliu51810 个月前
Hey everyone! I'm always on the lookout for new and interesting Python libraries that might not be well-known but are incredibly useful. Recently, I stumbled upon Rich for beautiful console output and Pydantic for data validation, which have been game-changers for my projects. What are some of the lesser-known libraries you've discovered that you think more people should know about? Share your favorites and how you use them!

12 条评论

networked10 个月前
Last year I posted a similar Ask HN; it got 11 comments: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38505531">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=38505531</a>. I asked, &quot;What lesser-known Python libraries do you wish people knew about?&quot; The suggestions there are worth looking up. Don&#x27;t miss DiskCache (<a href="https:&#x2F;&#x2F;github.com&#x2F;grantjenks&#x2F;python-diskcache">https:&#x2F;&#x2F;github.com&#x2F;grantjenks&#x2F;python-diskcache</a>).<p>I really like xmltodict (<a href="https:&#x2F;&#x2F;github.com&#x2F;martinblech&#x2F;xmltodict">https:&#x2F;&#x2F;github.com&#x2F;martinblech&#x2F;xmltodict</a>). Despite the name, it works in both directions. It is the most ergonomic library I have used for creating XML. It has external type stubs: <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;types-xmltodict&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;types-xmltodict&#x2F;</a>.<p>Since you have recently discovered Rich, you may want rich-argparse (<a href="https:&#x2F;&#x2F;github.com&#x2F;hamdanal&#x2F;rich-argparse">https:&#x2F;&#x2F;github.com&#x2F;hamdanal&#x2F;rich-argparse</a>). It colorizes argparse CLIs with little effort from the user.<p>DeepDiff (<a href="https:&#x2F;&#x2F;github.com&#x2F;seperman&#x2F;deepdiff">https:&#x2F;&#x2F;github.com&#x2F;seperman&#x2F;deepdiff</a>) has helped me with testing. I needed to compare two nested data structures but ignore any differences in floats (timestamps). DeepDiff let me do it:<p><pre><code> diff = DeepDiff( run_session(config), run_session(config, force=True), exclude_types=(float,) ) assert not diff </code></pre> pzp (<a href="https:&#x2F;&#x2F;github.com&#x2F;andreax79&#x2F;pzp">https:&#x2F;&#x2F;github.com&#x2F;andreax79&#x2F;pzp</a>) is like fzf in pure Python to use in your programs. Keep in mind it is currently version 0.0.x. I have found bugs, but I think it is just cool that it exists.
评论 #41147662 未加载
Crier100210 个月前
I use <a href="https:&#x2F;&#x2F;github.com&#x2F;litl&#x2F;backoff">https:&#x2F;&#x2F;github.com&#x2F;litl&#x2F;backoff</a> for configurable backoff + retry<p>context: OpenAI API used to be super flaky back in the early days, i needed to retry my requests quite frequently and i found this
评论 #41119535 未加载
srhtftw9 个月前
Happy user of Andrew Moffat&#x27;s <a href="https:&#x2F;&#x2F;sh.readthedocs.io" rel="nofollow">https:&#x2F;&#x2F;sh.readthedocs.io</a> for over a decade.
jmkr10 个月前
For audio analysis:<p><a href="https:&#x2F;&#x2F;librosa.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;librosa.org&#x2F;</a><p>Audio track seperation:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;adefossez&#x2F;demucs">https:&#x2F;&#x2F;github.com&#x2F;adefossez&#x2F;demucs</a><p>demucs works pretty well.
评论 #41132159 未加载
KolenCh10 个月前
Defopt generates cli from function interface: <a href="https:&#x2F;&#x2F;defopt.readthedocs.io&#x2F;en&#x2F;stable&#x2F;features.html" rel="nofollow">https:&#x2F;&#x2F;defopt.readthedocs.io&#x2F;en&#x2F;stable&#x2F;features.html</a><p>The alternative is either you maintain two interfaces with boilerplate, or write a cli only if that’s the first priority.<p>Similar solutions exist, like fire. But fire’s cli is like an afterthought, in the sense it gives people a way to run things in command line where they already know how to run it from Python.
评论 #41129003 未加载
hcfman10 个月前
Opensoundscape for sound localization<p><a href="https:&#x2F;&#x2F;opensoundscape.org&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;opensoundscape.org&#x2F;en&#x2F;latest&#x2F;</a>
vismit200010 个月前
This has been an absolute game changer: <a href="https:&#x2F;&#x2F;github.com&#x2F;pytries&#x2F;marisa-trie">https:&#x2F;&#x2F;github.com&#x2F;pytries&#x2F;marisa-trie</a> (succinct trie with fast lookup and minimal RAM) Use case and more details in the wonderful book by Ian and Micha: High Performance Python
skykery10 个月前
Exporting datasets - Tablib: <a href="https:&#x2F;&#x2F;tablib.readthedocs.io&#x2F;en&#x2F;stable&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tablib.readthedocs.io&#x2F;en&#x2F;stable&#x2F;</a>
Qem10 个月前
boltons: <a href="https:&#x2F;&#x2F;boltons.readthedocs.io&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;boltons.readthedocs.io&#x2F;en&#x2F;latest&#x2F;</a>
Hasnep10 个月前
pg8000 [1] is a Postgres library implemented in pure Python. I&#x27;ve spent enough time trying to get psycopg installed on MacOS and Docker that I appreciate just being able to pip install it at any time.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;tlocke&#x2F;pg8000">https:&#x2F;&#x2F;github.com&#x2F;tlocke&#x2F;pg8000</a>
enjoyyourlife9 个月前
genson for creating JSON schemaa
pizza9 个月前
- rich<p>- einops<p>- pytrees<p>- torchinfo<p>- joblib<p>- symbex<p>- nbdev