Skip to content

Conversation

Mikachu2333
Copy link
Collaborator

问题描述

  1. uv 无法在 win 上使用且 uv python 换源缺失
  2. fix uv 换源不完整,还需考虑 Python 解释器本身下载地址的换源 #309
  3. fix Windows 上 uv 换源需要 grep #308

方案与实现

  1. 更新贡献者信息
  2. 增加一系列 类、函数 用于uv查询配置与换源 (PlPythonUvConfigpl_python_uv_config_define_pythonpl_python_uv_config_define_pypiPlPythonUvConfigSummarypl_python_uv_config_summary_struct_is_fullpl_python_uv_config_find等)
  3. 根据配置文件优先级顺序对 src 进行查找
  4. 拒绝grep等难以在win上安装的软件
  5. 还没改完

Copy link

Hi @Mikachu2333

❤️ 感谢你的贡献!我们将在最少半小时,最多5天内阅读此 PR 并回复你

@Mikachu2333
Copy link
Collaborator Author

目前 pl_python_uv_getsrc 没问题了,setsrc 还没开始写,此外我感觉自己需要帮助,还是没弄明白怎么给 uv python 添加一批全新的源……

目前的想法是我先写死一个镜像源,后面靠大佬把这个新的镜像源(可以叫cpythonuvpython,可以叫cpython的原因是因为uv本质上是下载了cpython)框架再搭出来,然后我再朝里面塞实际内容就是了

@Mikachu2333
Copy link
Collaborator Author

commits的地狱命名转正式再说,现在不想动它

@Mikachu2333 Mikachu2333 force-pushed the fix/uv branch 2 times, most recently from 1153c7a to 2500b04 Compare October 13, 2025 16:58
@Mikachu2333 Mikachu2333 marked this pull request as ready for review October 13, 2025 16:58
@Mikachu2333
Copy link
Collaborator Author

理论上来说是能用的,本地测试也没问题。但是由于逻辑太要命,检查实在是看不动了,还请帮忙看看逻辑漏没漏……

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR updates the UV configuration handling to enable proper functionality on Windows systems and adds support for UV Python mirror switching. The changes implement a comprehensive configuration file management system that respects UV's configuration file priority order and handles both uv.toml and pyproject.toml files.

Key changes:

  • Enhanced cross-platform Windows support with proper path handling
  • Added comprehensive UV configuration parsing for both Python install mirrors and PyPI sources
  • Implemented configuration file priority system following UV's specification

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/recipe/lang/Python/uv.c Complete rewrite of UV configuration handling with new data structures, path resolution, and configuration management functions
src/recipe/lang/Python/rawstr4c.md Updated documentation to reflect new configuration format for both uv.toml and pyproject.toml files
src/recipe/lang/Python/rawstr4c.h Updated raw strings to match new configuration templates, removing grep-dependent commands

@ccmywish
Copy link
Contributor

逻辑太要命,检查实在是看不动了

我认可你的毅力和精神,但是这种改动已经如同我们上次提到的情况:过于复杂,受益甚小。

  1. Windows 可以安装 grepsed
  2. 就算没有这两者,也可以提示用户手动操作 (chsrc as a document)

@ccmywish
Copy link
Contributor

ccmywish commented Oct 15, 2025

我觉得你应当考虑做减法而不是做加法,这样费劲去做解析,不但维护非常非常困难,以现在的人手来看,也不会有人有足够的耐心和时间去审查这么多代码,这导致最终维护者只有你一人。

如果你真的想做到解析,我认为你应当认真考虑使用别的语言去做,你用别的语言做这件事,是事半功倍的。你甚至可以单独写一个小的exe文件,chsrc 运行的时候主动去下载帮助用户执行都行(我只是说乐观情况,我不能保证)。 单纯地用C语言去处理这个问题只是一个无底洞。

当你开始一个工作的时候,你应当从宏观的角度去先权衡一下对整个项目的利弊以及成本和收益。

@ccmywish
Copy link
Contributor

cpython 那个,可以参考

  1. nvm.c
  2. common.h 定义的 pl_js_nodejs_binary,是一个完全虚拟的 target.

@Mikachu2333
Copy link
Collaborator Author

如果你真的想做到解析,我认为你应当认真考虑使用别的语言去做,你用别的语言做这件事,是事半功倍的。你甚至可以单独写一个小的exe文件,chsrc 运行的时候主动去下载帮助用户执行都行(我只是说乐观情况,我不能保证)。 单纯地用C语言去处理这个问题只是一个无底洞。

我之前考虑过这事来着,但是考虑到调用安全的问题于是放弃……目前在想我是不是应该写个库出来,然后chsrc编译的时候直接静态编译进去……

c在不调库的情况下确实太难用了(

@Mikachu2333
Copy link
Collaborator Author

这玩意先搁置吧,等我再想想怎么办……

目前这解析着实是令人有些撑不住了,无论是逻辑、代码量还是代码的屎山程度对于一个不熟悉c的贡献者来说都是在有些难绷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants