astral-sh/uv
在 GitHub 查看Improve UX when `uv add` or `uv sync` are run in a directory with no `pyproject.toml`
Open
#12,988 创建于 2025年4月20日
enhancementerror messageshelp wanted
仓库指标
- Star
- (84,934 star)
- PR 合并指标
- (平均合并 7天 16小时) (30 天内合并 259 个 PR)
描述
Summary
Currently if uv add or uv sync are run in a directory with no pyproject.toml, the resultant error message is:
$ mkdir testcase-uv && cd $_
$ uv add urllib3
error: No `pyproject.toml` found in current directory or any parent directory
$ uv sync
error: No `pyproject.toml` found in current directory or any parent directory
To improve the UX for users migrating from pip (or uv's uv pip interface), it would help if this error message hinted that the user should probably run uv init or else see the uv getting started docs.
Example
Perhaps something roughly like this?
$ uv add urllib3
error: No `pyproject.toml` found in current directory or any parent directory.
To create one run `uv init`, or see: https://docs.astral.sh/uv/guides/projects/