Skip to content

[BUG] Exception when running function-pythonic render and targeting BaseComposite #47

@bror-lauritz-sk

Description

@bror-lauritz-sk

I'm getting an exception when I'm doing function-pythonic render targeting the full path of a BaseComposite.

$ function-pythonic render xr.yaml xrds.composites.namegen.NameGenComposite --python-path . --render-unknowns
Traceback (most recent call last):
  File "$dir/.venv/bin/function-pythonic", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "$dir/.venv/lib64/python3.14/site-packages/crossplane/pythonic/main.py", line 24, in main
    asyncio.run(args.command(args).run())
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.14/asyncio/runners.py", line 204, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.14/asyncio/runners.py", line 127, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.14/asyncio/base_events.py", line 719, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "$dir/.venv/lib64/python3.14/site-packages/crossplane/pythonic/render.py", line 122, in run
    composition = await self.setup_composition(composite, api)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$dir/.venv/lib64/python3.14/site-packages/crossplane/pythonic/render.py", line 217, in setup_composition
    if not issubclass(clazz, composite.BaseComposite):
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: issubclass() arg 2 must be a class, a tuple of classes, or a union

As far as I can tell, it happens because the composite module is shadowed in the crossplane/pythonic/render.py file:

from . import (
    command,
    composite, # <-- Is shadowed by parameters in setup_composition(self, composite, api=None)
    function,
    protobuf,
)

...
    async def setup_composition(self, composite, api=None):
        ...
        if not issubclass(clazz, composite.BaseComposite): <-- Fails here

crossplane-function-pythonic: 0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions