astral-sh/uv

Improve UX when `uv add` or `uv sync` are run in a directory with no `pyproject.toml`

Ouverte

#12 988 ouverte le 20 avr. 2025

 (1 commentaire) (1 réaction) (0 personne assignée)Rust (3 111 forks)batch import
enhancementerror messageshelp wanted

Métriques du dépôt

Stars
 (84 934 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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/

Guide contributeur