Issue
I'm writing a simple one-off script, without any functions, and I'd like to run it through Poetry, in its virtual environment. However, it appears this currently isn't possible, as Poetry expects a callable:
https://github.com/sdispater/poetry/blob/af8f86cda703144e9261b700d3165433aa2d3603/poetry/console/commands/run.py#L35-L37
My Python is rusty, so maybe there's a way around this (which makes it a documentation concern), but if there isn't, I suggest adding a quick heuristic, checking for the presence of a colon, and just executing import_module('{}') instead of import_module('{}').{}() otherwise.
Issue
I'm writing a simple one-off script, without any functions, and I'd like to run it through Poetry, in its virtual environment. However, it appears this currently isn't possible, as Poetry expects a callable:
https://github.com/sdispater/poetry/blob/af8f86cda703144e9261b700d3165433aa2d3603/poetry/console/commands/run.py#L35-L37
My Python is rusty, so maybe there's a way around this (which makes it a documentation concern), but if there isn't, I suggest adding a quick heuristic, checking for the presence of a colon, and just executing
import_module('{}')instead ofimport_module('{}').{}()otherwise.