astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.44k stars 460 forks source link

Rye wrongly assumes a project is managed by Rye if there is a `pyproject.toml` #1285

Open laclouis5 opened 1 month ago

laclouis5 commented 1 month ago

Steps to Reproduce

Create an empty project with a pyproject.toml file:

mkdir test
cd test
touch pyproject.toml

Then rye show outputs:

project: <unnamed>
path: /home/louis/Downloads/test
venv: /home/louis/Downloads/test/.venv
target python: cpython@3.11.9
venv python: cpython@3.11.9
virtual: false
configured sources:
  default (index: https://pypi.org/simple/)

This indicated that Rye thinks that the project is managed by Rye, but it is not the case (it could be manage by anything else such as Poetry).

Additionally, Rye does not seem to honor the managed flag in the pyproject.toml configuration:

[tool.rye]
managed = false

Adding these lines results in the same output from rye show.

Expected Result

Rye shouldn't assumes a project is managed by itself solely based on the presence of a pyproject.toml file since other Python project managing tools such a Poetry may use it for this same purpose.

This results in the impossibility to manage a Python project with Poetry using a Rye "system" Python toolchain (global-python = true).

Actual Result

Poetry fails to find Python toolchains fetched by Rye.

Version Info

rye 0.37.0

Stacktrace

No response

bluss commented 1 month ago

What is the more specific harm here? It would make it easier to understand what to change if it was more specific about what's wrong. IMO it's only good that rye can interact to some extent with projects it doesn't manage - for example rye run works on unmanaged projects today. And rye show should not modify the project it is inspecting (that would be a bug).