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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Solving Sudoku in Python Packaging

305 点作者 Yenrabbit7 个月前

12 条评论

simonw7 个月前
I love this so much. I dug around a bit and figured out how it works - I have an explanation (with an illustrative diagram) here: <a href="https:&#x2F;&#x2F;simonwillison.net&#x2F;2024&#x2F;Oct&#x2F;21&#x2F;sudoku-in-python-packaging&#x2F;" rel="nofollow">https:&#x2F;&#x2F;simonwillison.net&#x2F;2024&#x2F;Oct&#x2F;21&#x2F;sudoku-in-python-packa...</a><p>Figuring out how it works is a great way to learn a bit more about how Python packaging works under the hood. I learned that .whl files contain a METADATA file listing dependency constraints as &quot;Requires-Dist&quot; rules.<p>I ran a speed comparison too. Using the uv pip resolver it took 0.24s - with the older pip-compile tool it took 17s.
评论 #41923655 未加载
评论 #41921952 未加载
评论 #41922459 未加载
评论 #41927637 未加载
评论 #41922023 未加载
visarga7 个月前
That&#x27;s why it feels like installing a ML repo is like sudoku. You install everything and at the last step you realize your neural net uses FlashAttention2 which only works on NVIDIA compute version that is not deployed in your cloud VM and you need to start over from scratch.
评论 #41922591 未加载
评论 #41923178 未加载
评论 #41923163 未加载
评论 #41922634 未加载
评论 #41926356 未加载
chatmasta7 个月前
Here’s the same thing in Poetry (2022): <a href="https:&#x2F;&#x2F;www.splitgraph.com&#x2F;blog&#x2F;poetry-dependency-resolver-sudoku" rel="nofollow">https:&#x2F;&#x2F;www.splitgraph.com&#x2F;blog&#x2F;poetry-dependency-resolver-s...</a>
评论 #41922317 未加载
echoangle7 个月前
&gt; Solving the versions of python package from your requirements is NP-complete, in the worst case it runs exponentially slow. Sudokus are also NP-complete, which means we can solve sudokus with python packaging.<p>Is that actually sufficient? Can every system that’s solving something that’s NP-complete solve every other NP-complete problem?
评论 #41925480 未加载
评论 #41922438 未加载
评论 #41921973 未加载
评论 #41922706 未加载
评论 #41924656 未加载
yochem7 个月前
No way pip actually is a really inefficient SAT solver!
评论 #41923093 未加载
评论 #41924107 未加载
alentred7 个月前
This is BRILLIANT ! I knew of a trend to implement lots of different things at compile-time (in Scala and Haskell communities at least) - definitely fun and quirky, but it never seemed that &quot;special&quot;. This one, it has an air of old-school computer magic around it, probably because it is so elegant and simple.
mi_lk7 个月前
See also this 2008 post using Debian package system to solve Sudoku:<p><a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20160326062818&#x2F;http:&#x2F;&#x2F;algebraicthunk.net&#x2F;~dburrows&#x2F;blog&#x2F;entry&#x2F;package-management-sudoku&#x2F;" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20160326062818&#x2F;http:&#x2F;&#x2F;algebraict...</a>
ziofill7 个月前
but how does it know the constraints?
评论 #41921022 未加载
评论 #41920779 未加载
评论 #41921695 未加载
worewood7 个月前
This is type of cool hacking I like to see. Kudos! (Or better, Sukodus :) )
niyonx7 个月前
How did you even think of that? Nice!
revskill7 个月前
This is a hack.
评论 #41925301 未加载
anthk7 个月前
Now, in MicroLisp, Common Lisp and maybe Emacs&#x27; Elisp too:<p><a href="http:&#x2F;&#x2F;www.ulisp.com&#x2F;show?33J9" rel="nofollow">http:&#x2F;&#x2F;www.ulisp.com&#x2F;show?33J9</a>