Skip to content

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

Merged
StableLlama merged 10 commits into
StableLlama: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 into
StableLlama:mainfrom
Lex-DRL:dict-immutable-support

Conversation

@Lex-DRL

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

Copy link
Copy Markdown
Contributor

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 commented Mar 14, 2026

Copy link
Copy Markdown
Contributor Author

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

@Lex-DRL

Lex-DRL commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author
  • 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 commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

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