hatch icon indicating copy to clipboard operation
hatch copied to clipboard

feat: Add working_directory configuration option

Open kfazi opened this issue 2 years ago • 3 comments

In my projects, I often work in a subdirectory of the project root. When executing scripts hatch changes its working directory to the project root, which is confusing when scripts take files as arguments.

This PR introduces a new global configuration option to allow the user to select how hatch should behave:

  • change the working directory to the project root as it is now;
  • execute the script in the current working directory.

I left the old behavior as the default one.

kfazi avatar Mar 16 '23 10:03 kfazi

i'm not sure whether i understand the docs correctly, but have you considered to make that option available on the environment-level as well? please ignore if that's already happeneing here.

funkyfuture avatar Mar 24 '23 09:03 funkyfuture

i'm not sure whether i understand the docs correctly, but have you considered to make that option available on the environment-level as well? please ignore if that's already happeneing here.

This PR provides only the global option.

I don't have time to do it right now, but I'll be happy to add it later

kfazi avatar Mar 30 '23 20:03 kfazi

@ofek Is there a workaround for this at the moment ?

Tobi-De avatar Dec 22 '23 10:12 Tobi-De

Sorry for the lack of review time! The next minor release introduces a breaking change such that the current directory will no longer be modified if already inside the root: https://github.com/pypa/hatch/pull/1371

ofek avatar Apr 14 '24 21:04 ofek