pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.98k stars 410 forks source link

Task verbosity change introduce in 2.21 breaks some scripts #3313

Open noirbizarre opened 4 days ago

noirbizarre commented 4 days ago

Describe the bug

In 2.21, in https://github.com/pdm-project/pdm/pull/3278 more precisely, default scripts verbosity has been changed, and it breaks some existing scripts relying on output:

To reproduce

Expected Behavior

One of:

  1. default script behavior just run the script without decoration, echoing script name and command line being by definition verbosity
  2. this behavior is opt-in, aka. no output as default, a user setting allows enabling this when not verbose, but remain whatever the setting value in verbose mode
  3. this behavior is opt-in and progressive, aka. no output as default, a user setting allows disabling the task name only in normal, and the full output remain in verbose mode whatever the setting value

(The third one is having my preference)

Environment Information

PDM version: 2.21.0 Python Interpreter:

/.venv/bin/python (3.11) Project Root: Local Packages: { "implementation_name": "cpython", "implementation_version": "3.12.7", "os_name": "posix", "platform_machine": "x86_64", "platform_release": "6.11.9-arch1-1", "platform_system": "Linux", "platform_version": "#1 SMP PREEMPT_DYNAMIC Sun, 17 Nov 2024 16:06:17 +0000", "python_full_version": "3.11.9", "platform_python_implementation": "CPython", "python_version": "3.11", "sys_platform": "linux" } ### Additional Context Given I also understand some people like having tasks feedback by default, this PR is to start discussing what should be the solution, choose a setting name (`scripts.echo` ? `scripts.display_name` ? `scripts.always_show_name` ?) if a setting-based solution is accepted. ### Are you willing to submit a PR to fix this bug? - [X] Yes, I would like to submit a PR.
frostming commented 3 days ago

Yes, I should have discussed it clearly with the author in the PR, but out of some laziness, I didn't.

I tend to think the five points posted here makes more sense to me. @guru-desh You should read it to understand how other users are using this feature. And I would like to know what you think of it

guru-desh commented 3 days ago

These 5 points make sense to me as well. I like the idea of having a user-setting control. I think that using [tool.pdm.options] could solve this issue. For users that want to have the task name and command outputted by default, users could simply add the following to pyproject.toml:

[tool.pdm.options]
run = ["--verbose"]

Else, users that do not want verbosity by default don't need to add this section in pyproject.toml

I think the easiest way to resolve this is by doing the following:

  1. Reverting PR #3278
  2. Adding a section in the scripts documentation about how users can default verbosity when running scripts.

Thoughts?

frostming commented 3 days ago

I think the easiest way to resolve this is by doing the following:

I have no objections, either you or @noirbizarre PR welcome.

guru-desh commented 3 days ago

I don't mind making the PR. @noirbizarre does the proposed solution work for you?

noirbizarre commented 2 days ago

I thought about it and I don't think tool.pdm.options is a good approach, here's my reasoning:

So I made a proposal PR in #3315 (which includes a suggestion of a colleague preferring to display the help instead of task title)