Skip to content

[PEP389] introduce argparse deprecate optparse#5425

Open
nausikt wants to merge 5 commits intodmwm:masterfrom
nausikt:py312/PEP389-introduce-argparse-deprecate-optparse
Open

[PEP389] introduce argparse deprecate optparse#5425
nausikt wants to merge 5 commits intodmwm:masterfrom
nausikt:py312/PEP389-introduce-argparse-deprecate-optparse

Conversation

@nausikt
Copy link
Copy Markdown
Contributor

@nausikt nausikt commented Mar 4, 2026

Resolve #5424

The hardest part is preserving the strict disable_interspersed_args behaviour and adding back the validating of unknown flags in CRABOptParser.py.
Thanks to LLM, helping me polish this part meanwhile we both looking at original optparse.py

So, CRABOptParser in general + submit, createmyproxy subcommands will behave exactly the same.
See also the important bit disable_interspersed_args

P.S. Let me exhaustively test first (may write some unit-tests), do we already have test cases covered these behaviors?
P.S. Besides that, I think my proposed abstraction/structure is fairly minimal and clean. what do you think?

@cmsdmwmbot
Copy link
Copy Markdown

Jenkins results:

  • Python3 Pylint check: failed
    • 38 warnings and errors that must be fixed
    • 4 warnings
    • 679 comments to review
  • Pycodestyle check: succeeded
    • 932 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-CRABClient-PR-test/1149/artifact/artifacts/PullRequestReport.html

@belforte
Copy link
Copy Markdown
Member

belforte commented Mar 4, 2026

Hi @nausikt I tried to understand this disable_interspersed_args but it requires too much time. I think I have looked at this in the pasta and it may be that the only reason for that is that original developers wanted to have
crab --debug <command> <other options>
And I have no idea if anybody is actually using that, other than us in some test scripts.
If all that we need to simplify our life is to move that to be
crab command --debug --this --that
I am surely in favor !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace optprase with argparse [PEP389]

3 participants