Hi does anyone have an example of moderately compl...
# python
Hi does anyone have an example of moderately complex project with packages and functions?
That's... really interesting. Now I know what you were referring to yesterday @billowy-army-68599. So you don't have any problems importing things from
If you've the time, could you take a look and tell me what I'm doing wrong here then: https://github.com/followben/pulumi-example
AFAIK my setup is identical, yet I get errors when running pulumi if the project imports modules or packages from outside the project directory.
this isn't my setup, it's just a setup I'm familiar with from the community
I suspect the import works because the entire project is a module. So they
poetry install
the entire repo insto a virtualenv, then run
pulumi -C src/.../ up
from within the virtualenv, which means components are imported properly (via the installed package). That might actually be the solution to our woes as well.
Got it. Thanks @brave-knife-93369. We don't use poetry, but guess we could achieve the same with setup.py and pip, but I'd really rather avoid all of that given we don't actually need to package it.
@enough-leather-70274 I wonder if modifying the site and using
file would help https://pymotw.com/3/site/index.html
But installing the "app" into the VENV is a common solution as well
Oh nice... at the moment we're just doing
before we import
I guess we could modify the site in our pulumi automation script, but the imports would still fail when using the CLI locally.
And I think the explicit append in the file is a more obvious workaround than either installing the app to venv or adding a sitecustomize.py + .pth file.
I think we'll throw a simple setup.py together and just
python setup.py install
it in our pipelines - should be pretty low effort yet "clean"