Tuesday, 22 February 2022

How can I remove the service name prefix in PyCharm when using the docker-compose interpreter type?

I have created a simple app using docker-compose and its PyCharm support. I've configured a docker-compose interpreter using PyCharm's GUI. I want to run a pytest test using that interpreter, and enter the debugger. The problem is that when I enter the debugger, the service name (app_1) is prepended to all of the container output. This makes it very hard to read the session.

Recreating docker-compose-demo_app_1 ... 
Attaching to docker-compose-demo_app_1
Connected to pydev debugger (build 213.5744.248)
app_1  | Launching pytest with arguments test_foo.py::test_foo --no-header --no-summary -q in /opt/project
app_1  | 
app_1  |app_1  | ============================= test session starts ==============================
app_1  | collecting ... collected 1 item
app_1  |app_1  | 
app_1  | test_foo.py::test_foo ##teamcity[testSuiteStarted timestamp='2022-02-15T16:20:52.396' locationHint='python</opt/project>://test_foo' name='test_foo' nodeId='1' parentNodeId='0']
app_1  |>>> 42
app_1  | PyDev console: starting.
app_1  | 
app_1  | 42
>>> 

Here I've evaluated the expression 42, you can see my text entered after the prompt.

I see that docker-compose logs has a --no-log-prefix option that can apparently hide these logs, but as the interpreter configuration in PyCharm doesn't seem to expose any way to pass options to docker-compose, I don't know if I can use this option. Is there any way to get a cleaner output at the console?



from How can I remove the service name prefix in PyCharm when using the docker-compose interpreter type?

No comments:

Post a Comment