hatch icon indicating copy to clipboard operation
hatch copied to clipboard

With rye {root:uri}/../../packages/ seems to traverse more than 2 folders up

Open ShravanSunder opened this issue 1 year ago • 6 comments

i'm trying to use rye sync with a python monorepo and root:uri

the resolution of folders doesn't seem to work. for example

    "askluna-dotenv @ {root:uri}/../../packages/dotenv" => error: Distribution not found at: file:///Users/shravansunder/Documents/dev/project-dev/askluna-project/packages/dotenv
error: could not write production lockfile for workspace

    "askluna-dotenv @ {root:uri}/../packages/dotenv" =>error: Distribution not found at: file:///Users/shravansunder/Documents/dev/project-dev/askluna-project/askluna/apps/packages/dotenv

So for some reason, ../../ seems to traverse by more than 2 folders up instead of exactly 2 folders. And ../ only traverses 1 folder up

related to https://github.com/astral-sh/uv/issues/4321

ShravanSunder avatar Jun 14 '24 12:06 ShravanSunder

Does the parent modifier work for you? https://hatch.pypa.io/latest/config/context/#global-fields

ofek avatar Jun 14 '24 14:06 ofek

its very interesting. i'm not sure which part of the rye tool chain has an impact

  • "askluna-dotenv @ {root:parent:uri}/../packages/dotenv",
    • Works ✅
  • "askluna-dotenv @ {root:parent:uri}/packages/dotenv",
    • does not work ❌
    • file:///Users/shravansunder/Documents/dev/project-dev/askluna-project/askluna/%7Broot:parent:uri%7D/packages/dotenv
  • "askluna-dotenv @ {root:parent:uri}/./packages/dotenv"
    • does not work ❌
    • file:///Users/shravansunder/Documents/dev/project-dev/askluna-project/askluna/%7Broot:parent:uri%7D/packages/dotenv

So i partly have a solution, but i find this preplexing.

maybe related issues:

  • https://github.com/astral-sh/rye/issues/168
  • https://github.com/astral-sh/rye/pull/1023

ShravanSunder avatar Jun 14 '24 17:06 ShravanSunder

Anything to do here or can this be closed?

ofek avatar Jun 20 '24 17:06 ofek

Well I’m unsure if this uri feature works as I mentioned above, however perhaps I just don’t understand the behaviour. You can close it if you like.

ShravanSunder avatar Jun 20 '24 18:06 ShravanSunder

Does it work for you outside of Rye?

ofek avatar Jun 20 '24 18:06 ofek

i actually don't use hatch aside from rye. feel free to close it if you'd like!

ShravanSunder avatar Jun 20 '24 19:06 ShravanSunder