Skip to content

fix: expand user home in anatomy roots - #1882

Closed
Viodmian wants to merge 3 commits into
ynput:developfrom
Viodmian:fix-expand-user-roots
Closed

fix: expand user home in anatomy roots#1882
Viodmian wants to merge 3 commits into
ynput:developfrom
Viodmian:fix-expand-user-roots

Conversation

@Viodmian

@Viodmian Viodmian commented Jun 8, 2026

Copy link
Copy Markdown

Changelog Description

Expand ~ in anatomy root definitions so paths like ~/foo/bar resolve to the current user's home directory before root values are cleaned and exposed through helpers.

Fixes #1874.

Additional info

This keeps the existing environment-variable formatting behavior for current-platform roots and applies home expansion to configured root values before they are stored in raw_data / cleaned_data.

Testing notes:

  1. python -m pytest tests\client\ayon_core\pipeline\anatomy\test_roots.py -q
  2. git diff --check
  3. python -m py_compile client\ayon_core\pipeline\anatomy\roots.py tests\client\ayon_core\pipeline\anatomy\test_roots.py

@iLLiCiTiT

Copy link
Copy Markdown
Member

May I ask what is the use-case to use home directory in roots?

try:
self.value = lowered_platform_keys[current_platform].format_map(
os.environ
self.value = self._expand_root_value(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the _expand_root_value also handle format_map with os.environ?

self._log = None
lowered_platform_keys = {
key.lower(): value
key.lower(): self._expand_root_value(value)

@iLLiCiTiT iLLiCiTiT Jun 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the expand should happen only for current platform. BTW if someone would use the ~ in roots the remapping of roots probably won't work as expected.

If there is calculated path on different machine/user (e.g. in workfile) you can't remap it on different machine.

@iLLiCiTiT

Copy link
Copy Markdown
Member

Closing in favor of #1884

@iLLiCiTiT iLLiCiTiT closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YN-0773: make sure variables are expanded in roots

5 participants