{"id":2132,"date":"2026-11-19T23:08:20","date_gmt":"2026-11-19T15:08:20","guid":{"rendered":"https:\/\/www.zhukaifu.cn\/?p=2132"},"modified":"2026-11-19T23:08:20","modified_gmt":"2026-11-19T15:08:20","slug":"astral-sh-uv-%c2%b7-%e4%b8%ad%e6%96%87%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.zhukaifu.cn\/?p=2132","title":{"rendered":"astral-sh\/uv \u00b7 \u4e2d\u6587\u4ecb\u7ecd"},"content":{"rendered":"<!-- gh-sync:repo:astral-sh\/uv -->\n\n<div id=\"gh-catalog\"><style>\/* \u4ec5\u4f5c\u7528\u4e8e\u540c\u6b65\u6587\u7ae0\uff1b\u4e0e Kai's Log \u6d45\u8272\u6587\u7ae0\u533a\u57df\u8854\u63a5\u3002 *\/\n#gh-catalog{color-scheme:light;--bg:#fff;--panel:#faf7fa;--line:#e7dee6;--text:#29252b;--muted:#69616b;--accent:#97447f;background:transparent;color:var(--text);font:inherit;line-height:1.8;min-height:0;width:100%;overflow-wrap:anywhere}\n#gh-catalog *,#gh-catalog *::before,#gh-catalog *::after{box-sizing:border-box}\n#gh-catalog main{width:100%;max-width:none;margin:0;padding:4px 0 20px}\n#gh-catalog h1,#gh-catalog h2,#gh-catalog h3{color:#29252b;font-family:inherit;font-weight:700;letter-spacing:normal;overflow-wrap:anywhere}\n#gh-catalog h1{font-size:clamp(24px,3.5vw,34px);line-height:1.4;margin:20px 0 12px}\n#gh-catalog h2{font-size:20px;line-height:1.55;margin:0 0 12px}\n#gh-catalog p{color:inherit;margin:12px 0}\n#gh-catalog a{color:var(--accent);text-decoration:none;box-shadow:none}\n#gh-catalog a:hover{text-decoration:underline;color:#753361}\n#gh-catalog .eyebrow{font-size:12px;letter-spacing:.14em;color:var(--accent);font-weight:700}\n#gh-catalog .meta,#gh-catalog .sort-note{color:var(--muted);font-size:13px}\n#gh-catalog article{background:#fff;border:1px solid var(--line);border-radius:12px;padding:24px;margin:18px 0;box-shadow:none;color:var(--text)}\n#gh-catalog article:hover{border-color:#cba8c3}\n#gh-catalog nav{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:16px 0 0}\n#gh-catalog nav a{font-size:14px}\n#gh-catalog .rank{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:30px;border-radius:7px;background:#f3edf2;color:#715568;font-size:13px;margin-right:10px;font-variant-numeric:tabular-nums}\n#gh-catalog .top-rank{background:#f8efd9;color:#765516}\n#gh-catalog .search-panel{position:static;z-index:auto;padding:20px;background:#faf7fa;border:1px solid var(--line);border-radius:12px;margin:24px 0;box-shadow:none;backdrop-filter:none}\n#gh-catalog .search-panel label{color:var(--text);font-weight:600}\n#gh-catalog .search-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:10px}\n#gh-catalog .search-row input{flex:1 1 240px;width:auto}\n#gh-catalog input,#gh-catalog select,#gh-catalog button{border:1px solid #cdbfca;border-radius:8px;background:#fff;color:#29252b;font:inherit;line-height:1.5;max-width:100%;min-height:44px;box-shadow:none}\n#gh-catalog input{width:100%;min-width:0;padding:12px 14px}\n#gh-catalog input::placeholder{color:#756b76;opacity:1}\n#gh-catalog select{padding:11px 30px 11px 12px;width:auto}\n#gh-catalog button{padding:11px 16px;cursor:pointer;white-space:nowrap;background:#f2e6ef;color:#71345e}\n#gh-catalog button:hover{background:#ead5e5;border-color:#b98aab}\n#gh-catalog .sort-label{font-size:13px}\n#gh-catalog article nav a{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:9px 15px;border-radius:8px;font-size:13px;font-weight:600;border:1px solid #ddccda;background:#faf5f9;color:#80366a;text-decoration:none;box-shadow:none}\n#gh-catalog article nav a:first-child{background:#97447f;border-color:#97447f;color:#fff}\n#gh-catalog article nav a:hover{background:#f0e0eb;border-color:#b784a8;color:#71345e;text-decoration:none}\n#gh-catalog article nav a:first-child:hover{background:#7a3566;border-color:#7a3566;color:#fff}\n#gh-catalog .collected{display:inline-flex;gap:6px;flex-wrap:wrap;margin:10px 0 0;padding:4px 10px;background:#f8f4f7;border:1px solid var(--line);border-radius:6px;font-size:12px;color:#69616b}\n#gh-catalog ul,#gh-catalog ol{padding-left:1.5em;margin:14px 0;color:var(--text)}\n#gh-catalog li{margin:10px 0;color:inherit}\n#gh-catalog .empty{border:1px dashed #cdbfca;border-radius:12px;text-align:center;padding:32px 18px;color:var(--muted);background:#faf7fa}\n#gh-catalog footer{margin-top:28px;border-top:1px solid var(--line);padding-top:16px;color:var(--muted);font-size:12px}\n#gh-catalog [hidden]{display:none!important}\n#gh-catalog a:focus-visible,#gh-catalog button:focus-visible,#gh-catalog input:focus-visible,#gh-catalog select:focus-visible{outline:3px solid #97447f;outline-offset:3px}\n@media(max-width:600px){#gh-catalog main{padding:0 0 12px}#gh-catalog article{padding:18px 14px}#gh-catalog h2{font-size:18px}#gh-catalog .search-panel{padding:16px 14px}#gh-catalog .search-row input{flex-basis:100%}#gh-catalog article nav a{flex:1;padding:9px 10px}#gh-catalog .rank{min-width:32px;margin-right:8px}}\n<\/style><main><nav><a href=\"https:\/\/www.zhukaifu.cn\/?p=575\">\u2190 \u70ed\u95e8\u4ed3\u5e93\u5217\u8868<\/a><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/astral-sh\/uv\">\u6253\u5f00 GitHub \u4ed3\u5e93<\/a><\/nav><h1>astral-sh\/uv<\/h1><p class=\"meta\">\u2605 92,240 \u00b7 Forks 3,923<\/p><article class=\"rapid-understanding\"><section><h2>\u4e00\u53e5\u8bdd\u7406\u89e3<\/h2><p>uv \u7684\u9879\u76ee\u5de5\u4f5c\u6d41\u628a\u4f9d\u8d56\u8981\u6c42\u53d8\u6210\u4e00\u7ec4\u53ef\u5b89\u88c5\u7684\u5305\u7248\u672c\uff0c\u518d\u901a\u8fc7\u9501\u6587\u4ef6\u4fdd\u5b58\u8fd9\u7ec4\u9009\u62e9\uff0c\u901a\u8fc7\u540c\u6b65\u628a\u9009\u62e9\u843d\u5b9e\u5230\u9879\u76ee\u73af\u5883\u3002<\/p><\/section><section><h2>\u5b83\u89e3\u51b3\u4ec0\u4e48\u95ee\u9898<\/h2><p>\u4e00\u4e2a Python \u9879\u76ee\u5199\u4e0b\u4e86\u9700\u8981\u54ea\u4e9b\u5305\uff0c\u63a5\u4e0b\u6765\u8fd8\u8981\u51b3\u5b9a\u7528\u54ea\u4e9b\u7248\u672c\u3001\u628a\u5305\u88c5\u8fdb\u54ea\u4e2a\u73af\u5883\uff0c\u4ee5\u53ca\u4ece\u54ea\u91cc\u8fd0\u884c\u9879\u76ee\u547d\u4ee4\u3002uv \u628a\u8fd9\u4e9b\u5de5\u4f5c\u653e\u8fdb\u540c\u4e00\u4e2a\u5de5\u5177\u3002\u4ee5\u9879\u76ee\u7ba1\u7406\u4e3a\u4f8b\uff0c\u8f93\u5165\u662f\u9879\u76ee\u53ca\u5176\u4f9d\u8d56\u8981\u6c42\uff0c\u8f93\u51fa\u662f\u4e00\u4efd\u8bb0\u5f55\u89e3\u6790\u7ed3\u679c\u7684\u9501\u6587\u4ef6\u548c\u4e00\u4e2a\u88c5\u597d\u4f9d\u8d56\u7684\u9879\u76ee\u73af\u5883\u3002\u4e00\u6b21\u4e0a\u624b\u7ec3\u4e60\u7684\u6210\u529f\u6807\u51c6\u662f\u80fd\u5728\u9879\u76ee\u4e2d\u6dfb\u52a0\u4f9d\u8d56\u3001\u9501\u5b9a\u5e76\u540c\u6b65\u73af\u5883\uff0c\u518d\u4ece\u8fd9\u4e2a\u73af\u5883\u542f\u52a8\u6240\u9700\u7684\u547d\u4ee4\u3002<\/p><\/section><section><h2>\u4ece\u8f93\u5165\u5230\u8f93\u51fa<\/h2><p>\u53ef\u4ee5\u6cbf\u7740\u4e94\u4e2a\u73af\u8282\u7406\u89e3\u3002\u7b2c\u4e00\uff0c\u521d\u59cb\u5316\u9879\u76ee\u5e76\u58f0\u660e\u76f4\u63a5\u9700\u8981\u7684\u5305\uff0c\u8ba9 uv \u77e5\u9053\u4ece\u54ea\u4e9b\u8981\u6c42\u5f00\u59cb\u3002\u7b2c\u4e8c\uff0c\u89e3\u6790\u4f9d\u8d56\uff0c\u56e0\u4e3a\u4e00\u4e2a\u5305\u4e5f\u53ef\u80fd\u4f9d\u8d56\u5176\u4ed6\u5305\uff0cuv \u8981\u4e00\u8d77\u627e\u51fa\u6ee1\u8db3\u8981\u6c42\u7684\u7248\u672c\u7ec4\u5408\u3002\u5982\u679c\u8981\u6c42\u5f7c\u6b64\u51b2\u7a81\uff0c\u5c31\u627e\u4e0d\u5230\u53ef\u7528\u7684\u7ec4\u5408\u3002\u7b2c\u4e09\uff0c\u628a\u89e3\u6790\u7ed3\u679c\u5199\u8fdb\u9501\u6587\u4ef6\uff0c\u8ba9\u540e\u7eed\u540c\u6b65\u6709\u4e00\u4efd\u660e\u786e\u7684\u7248\u672c\u4f9d\u636e\u3002\u7b2c\u56db\uff0c\u628a\u6240\u9700\u7684\u5305\u88c5\u8fdb\u9879\u76ee\u73af\u5883\uff0c\u8ba9\u9879\u76ee\u6709\u81ea\u5df1\u7684\u4f9d\u8d56\u5b89\u88c5\u4f4d\u7f6e\u3002\u82e5\u6240\u9700\u7684\u5305\u65e0\u6cd5\u53d6\u5f97\uff0c\u9501\u6587\u4ef6\u672c\u8eab\u4e5f\u65e0\u6cd5\u8ba9\u5b89\u88c5\u5b8c\u6210\u3002\u7b2c\u4e94\uff0c\u4ece\u9879\u76ee\u73af\u5883\u8fd0\u884c\u547d\u4ee4\uff0c\u8ba9\u547d\u4ee4\u7528\u4e0a\u4e3a\u8fd9\u4e2a\u9879\u76ee\u51c6\u5907\u7684\u4f9d\u8d56\u3002\u80fd\u5426\u542f\u52a8\u547d\u4ee4\u3001\u547d\u4ee4\u6267\u884c\u540e\u5f97\u51fa\u4ec0\u4e48\u7ed3\u679c\uff0c\u662f\u4e24\u4e2a\u53ef\u4ee5\u5206\u522b\u89c2\u5bdf\u7684\u73b0\u8c61\u3002<\/p><\/section><section><h2>\u7528\u4e00\u4e2a\u5c0f\u4efb\u52a1\u7406\u89e3<\/h2><p><strong>\u7406\u89e3\u793a\u4f8b\uff08\u672a\u5b9e\u6d4b\uff09\uff1a<\/strong>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u53ea\u542b\u4e00\u4efd Python \u6e90\u6587\u4ef6\u7684\u5c0f\u9879\u76ee\uff0c\u60f3\u7528 Ruff \u68c0\u67e5\u4ee3\u7801\u3002\u5148\u7528 uv init example \u521b\u5efa\u9879\u76ee\uff0c\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u628a\u6e90\u6587\u4ef6\u653e\u8fdb\u53bb\uff0c\u518d\u7528 uv add ruff \u6dfb\u52a0\u68c0\u67e5\u5de5\u5177\u3002\u63a5\u7740\u8fd0\u884c uv lock \u548c uv sync\uff0c\u786e\u8ba4\u751f\u6210\u4e86\u9501\u6587\u4ef6\uff0c\u5e76\u628a\u9879\u76ee\u73af\u5883\u540c\u6b65\u5230\u6240\u9700\u72b6\u6001\u3002\u6700\u540e\u6267\u884c uv run ruff check\u3002\u9884\u671f\u4f1a\u770b\u5230 Ruff \u5bf9\u8be5\u76ee\u5f55\u7ed9\u51fa\u68c0\u67e5\u7ed3\u679c\u3002\u5982\u679c\u6e90\u6587\u4ef6\u89e6\u53d1\u4e86\u68c0\u67e5\u89c4\u5219\uff0c\u8f93\u51fa\u53ef\u4ee5\u662f\u95ee\u9898\u62a5\u544a\uff0c\u8fd9\u4ecd\u8bf4\u660e\u9879\u76ee\u73af\u5883\u5df2\u80fd\u542f\u52a8\u68c0\u67e5\u5de5\u5177\u3002<\/p><\/section><section><h2>\u6539\u53d8\u4e00\u4e2a\u6761\u4ef6\u4f1a\u600e\u6837<\/h2><p><strong>\u9884\u6d4b\u4e0e\u9a8c\u8bc1\uff08\u5f85\u68c0\u9a8c\uff09\uff1a<\/strong>\u53ea\u6539\u53d8\u4e00\u4e2a\u6761\u4ef6\uff0c\u5373\u9879\u76ee\u662f\u5426\u58f0\u660e Ruff \u4f9d\u8d56\u3002\u51c6\u5907\u4e24\u4efd\u542b\u76f8\u540c\u6e90\u6587\u4ef6\u7684\u5168\u65b0\u9879\u76ee\uff0c\u4fdd\u6301 Python \u548c uv \u7248\u672c\u4e00\u81f4\uff0c\u786e\u4fdd\u7cfb\u7edf\u547d\u4ee4\u641c\u7d22\u8def\u5f84\u4e0a\u6ca1\u6709\u53e6\u5916\u5b89\u88c5\u7684 Ruff\uff0c\u4e5f\u6ca1\u6709\u5176\u4ed6\u9879\u76ee\u4f9d\u8d56\u628a Ruff \u5e26\u8fdb\u6765\u3002\u4e00\u4efd\u6dfb\u52a0 Ruff\uff0c\u53e6\u4e00\u4efd\u7701\u53bb\u8fd9\u4e00\u6b65\uff0c\u4e24\u4efd\u90fd\u5b8c\u6210\u9501\u5b9a\u548c\u540c\u6b65\u540e\u6267\u884c uv run ruff check\u3002\u9884\u8ba1\u524d\u4e00\u4efd\u80fd\u542f\u52a8\u68c0\u67e5\uff0c\u540e\u4e00\u4efd\u627e\u4e0d\u5230 Ruff\u3002\u9a8c\u8bc1\u65f6\u8bb0\u5f55\u547d\u4ee4\u8f93\u51fa\u548c\u9000\u51fa\u72b6\u6001\uff0c\u533a\u5206\u5de5\u5177\u542f\u52a8\u5931\u8d25\u4e0e\u5de5\u5177\u5df2\u542f\u52a8\u4f46\u62a5\u544a\u4ee3\u7801\u95ee\u9898\u3002<\/p><\/section><section><h2>\u9002\u5408\u8c01\uff0c\u54ea\u91cc\u4f1a\u5931\u6548<\/h2><p><strong>\u6839\u636e\u8d44\u6599\u63a8\u65ad\uff1a<\/strong>\u8fd9\u6761\u6d41\u7a0b\u9002\u5408\u8981\u5171\u540c\u7ef4\u62a4\u9879\u76ee\u4f9d\u8d56\u548c\u8fd0\u884c\u73af\u5883\u7684 Python \u5f00\u53d1\u8005\u3002\u53ea\u7ef4\u62a4\u4e00\u4e2a\u811a\u672c\u65f6\uff0c\u53ef\u4ee5\u7528\u811a\u672c\u5185\u7684\u4f9d\u8d56\u58f0\u660e\uff0c\u8ba9 uv \u5728\u9694\u79bb\u73af\u5883\u91cc\u8fd0\u884c\u5b83\u3002\u5df2\u6709 requirements \u6587\u4ef6\u7684\u56e2\u961f\u4e5f\u53ef\u4ee5\u4ece uv \u7684 pip \u63a5\u53e3\u8bd5\u8d77\uff0c\u5148\u7ec3\u4e60\u751f\u6210\u548c\u540c\u6b65\u4f9d\u8d56\u6e05\u5355\u3002\u8d44\u6599\u7ed9\u51fa\u4e86\u5e38\u89c1\u547d\u4ee4\u7684\u7528\u6cd5\uff0c\u4f46\u7f3a\u5c11\u9010\u9879\u7684\u8fc1\u79fb\u517c\u5bb9\u4fe1\u606f\u3002\u9047\u5230\u4f9d\u8d56\u7279\u5b9a pip \u9009\u9879\u6216\u5b89\u88c5\u884c\u4e3a\u7684\u9879\u76ee\uff0c\u9700\u8981\u6838\u5bf9\u5bf9\u5e94\u9009\u9879\uff0c\u5e76\u7528\u5b9e\u9645\u9879\u76ee\u7684\u4f9d\u8d56\u6e05\u5355\u9a8c\u8bc1\u3002<\/p><\/section><section><h2>\u7b2c\u4e00\u6b21\u5c1d\u8bd5\u65f6\u770b\u4ec0\u4e48<\/h2><p><strong>\u6839\u636e\u8d44\u6599\u63a8\u65ad\uff1a<\/strong>\u8dd1\u901a\u5c0f\u9879\u76ee\u540e\uff0c\u53ef\u4ee5\u7ec3\u4e60\u7528\u5df2\u6709\u9501\u6587\u4ef6\u91cd\u5efa\u73af\u5883\u3002\u4fdd\u7559\u9879\u76ee\u6587\u4ef6\u548c\u9501\u6587\u4ef6\uff0c\u5728\u6ca1\u6709\u539f\u9879\u76ee\u865a\u62df\u73af\u5883\u7684\u526f\u672c\u91cc\u8fd0\u884c uv sync\uff0c\u518d\u8fd0\u884c\u540c\u4e00\u6761\u68c0\u67e5\u547d\u4ee4\u3002\u89c2\u5bdf\u65b0\u73af\u5883\u662f\u5426\u88c5\u9f50\u4e86\u4f9d\u8d56\uff0c\u4ee5\u53ca\u68c0\u67e5\u5de5\u5177\u662f\u5426\u7ed9\u51fa\u9884\u671f\u7684\u7ed3\u679c\u3002<\/p><\/section><\/article><\/main><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u2190 \u70ed\u95e8\u4ed3\u5e93\u5217\u8868\u6253\u5f00 GitHub \u4ed3\u5e93 astral-sh\/uv \u2605 92,2&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2132","post","type-post","status-publish","format-standard","hentry","category-thinking"],"_links":{"self":[{"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=\/wp\/v2\/posts\/2132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2132"}],"version-history":[{"count":2,"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=\/wp\/v2\/posts\/2132\/revisions"}],"predecessor-version":[{"id":2234,"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=\/wp\/v2\/posts\/2132\/revisions\/2234"}],"wp:attachment":[{"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhukaifu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}