First time here? Check out the FAQ!
1

Debug/Execute a poetry packaged project

I'm trying to debug a https://python-poetry.org/ managed project (https://github.com/djrobstep/migra) with a script command like...

[tool.poetry.scripts]
migra = 'migra:do_command'

I wrote my own run.py like

from migra import do_command

do_command()

and that worked, but seemed a little clunky, to have to add my own code to debug with wing. Is there a better way?

rmorison's avatar
11
rmorison
asked 2020-05-28 20:03:38 -0500
Wingware Support's avatar
4.1k
Wingware Support
updated 2020-05-28 22:19:45 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Using 'python -m' is increasingly the standard for launching utilities and tools that are part of Python packages. If it's possible to launch poetry with 'python -m poetry' then you don't need to create a run.py but can instead set Main Entry Point under the Debug tab of Project Properties to Use Selected Entry Point and create a Named Entry Point from there which uses the "Named Module" option with module name poetry.

Another approach would be to start debug from code run by poetry and run it from the command line or Wing's OS Commands tool. I think just adding a run.py is cleaner, but this is documented at https://wingware.com/doc/debug/debugg...

Wingware Support's avatar
4.1k
Wingware Support
answered 2020-05-29 08:04:39 -0500
edit flag offensive 0 remove flag delete link

Comments

1

If -m supported -m module:function, yeah would be great. Afaik, there's no python command line arg to set the entrypoint to anything other then the beginning of the script file (or __main__.py for packages.)

run.py it is, then.

rmorison's avatar rmorison (2020-05-29 11:23:25 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer