Skip to content

Command to print project root directory #13636

@Hawk777

Description

@Hawk777

Summary

From what I understand from reading somewhere (I can’t remember where), UV’s mechanism for discovering the project root directory is somewhat complicated, involving searching upwards from the CWD for a .python-version file, and also searching for a pyproject.toml file but only one that contains a [project] table. That’s not exactly something that’s easy to do in a small utility shell script, yet discovering the project root can be useful in shell scripts. It would be nice if UV had a command to just print the discovered project root directory. It already does so in debug output when -v is passed to certain other unrelated subcommands, but it would be nice to not have to do horrid things with sed to the debug stream.

Example

~/myproject/some/subdir $ uv print project-dir
/home/me/myproject

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions