datalad_next.utils.chpwd

class datalad_next.utils.chpwd(path: str | Path | None, mkdir: bool = False, logsuffix: str = '')[source]

Bases: object

Wrapper around os.chdir which also adjusts environ['PWD']

The reason is that otherwise PWD is simply inherited from the shell and we have no ability to assess directory path without dereferencing symlinks.

If used as a context manager it allows to temporarily change directory to the given path