Skip to content

Support for arbitrary mappings and immutable dicts as inputs for dict nodes#46

Merged
StableLlama merged 10 commits intoStableLlama:mainfrom
Lex-DRL:dict-immutable-support
Mar 22, 2026
Merged

Support for arbitrary mappings and immutable dicts as inputs for dict nodes#46
StableLlama merged 10 commits intoStableLlama:mainfrom
Lex-DRL:dict-immutable-support

Conversation

@Lex-DRL
Copy link
Copy Markdown
Contributor

@Lex-DRL Lex-DRL commented Mar 6, 2026

Currently, the node pack doesn't work with custom mapping-like classes.

In my node pack, I rely on frozendict to ensure that other poorly coded nodes down the line can't accidentally change the contents of a connected input dict coming from my node. And for any dict-related work, I recommend this "Basic Data Handling" pack instead of reinventing the wheel for the 100th time.

So, I made all the dict-related nodes to work in general case: with ANY dict-like objects, and not just with the built-in dict itself.

@Lex-DRL Lex-DRL changed the title Support for arbitrary mappings and immutable dicts for dict nodes Support for arbitrary mappings and immutable dicts as inputs for dict nodes Mar 6, 2026
@Lex-DRL Lex-DRL force-pushed the dict-immutable-support branch from b31b20a to 7d280c6 Compare March 9, 2026 02:11
@Lex-DRL
Copy link
Copy Markdown
Contributor Author

Lex-DRL commented Mar 14, 2026

I see the failed test. I'll investigate it later.

@Lex-DRL Lex-DRL force-pushed the dict-immutable-support branch 3 times, most recently from 0535ce6 to cc8a24e Compare March 22, 2026 05:33
@Lex-DRL
Copy link
Copy Markdown
Contributor Author

Lex-DRL commented Mar 22, 2026

  • The previously failed test is fixed in: 00f6069
  • Additionally, I've updated tests for all the modified nodes to also verify returned type - in case a custom mapping is passed. As an example, frozendict is used.
  • The current implementation might not work with ANY possible Mapping class (the Mapping itself doesn't imply that the class has an init at all), but if the custom class is implemented in such a way that its instance could be build similarly to how it's done with dict(), it should work.
    • in case we're dealing with one of such unsupported custom classes, the returned result is falling back to the built-in dict, the type isn't preserved.

Ready for review/merge.

@Lex-DRL Lex-DRL force-pushed the dict-immutable-support branch from cc8a24e to d26e633 Compare March 22, 2026 05:52
@Lex-DRL Lex-DRL force-pushed the dict-immutable-support branch from 54e92f0 to a69162c Compare March 22, 2026 16:46
@Lex-DRL Lex-DRL force-pushed the dict-immutable-support branch from a69162c to eee342a Compare March 22, 2026 16:58
@Lex-DRL Lex-DRL force-pushed the dict-immutable-support branch from eee342a to b90ca06 Compare March 22, 2026 17:00
@Lex-DRL
Copy link
Copy Markdown
Contributor Author

Lex-DRL commented Mar 22, 2026

I had to make a few rebases and force-pushes in order to run the existing github workflows myself. The branch now also contains small QoL improvements to the existing workflows.

@StableLlama StableLlama merged commit 2e85a05 into StableLlama:main Mar 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants