Skip to content

feat: provide global option -j/--workers (#190)#204

Merged
sushant-suse merged 3 commits intoopenSUSE:mainfrom
sushant-suse:issue#190-provide-global-option
Mar 18, 2026
Merged

feat: provide global option -j/--workers (#190)#204
sushant-suse merged 3 commits intoopenSUSE:mainfrom
sushant-suse:issue#190-provide-global-option

Conversation

@sushant-suse
Copy link
Copy Markdown
Collaborator

This PR adds the global CLI option -j / --workers to allow users to override concurrency settings from the command line.

Changes:

  • Added -j/--workers to the main docbuild command group.
  • Updated DocBuildContext to use the AppConfig model type for better type safety and IDE support.
  • Injected the CLI worker value into the configuration loading phase, allowing it to override file-based settings.

Validation:

  • Added tests/cli/test_worker_option.py to verify that the flag is correctly parsed and validated.
  • Current project coverage is at 96.9%.
  • Confirmed that the flag is recognized globally across subcommands.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 17, 2026

Coverage Report

For commit 7d32bb9

Click to expand Coverage Report
  Name                                           Stmts   Miss Branch BrPart  Cover
  --------------------------------------------------------------------------------
+ src/docbuild/models/deliverable.py               180      1     22      0  99.5%
+ src/docbuild/cli/cmd_check/process.py             58      0     22      1  98.8%
+ src/docbuild/models/manifest.py                  111      1     12      1  98.4%
+ src/docbuild/utils/pidlock.py                     79      1     14      1  97.8%
+ src/docbuild/cli/cmd_cli.py                       96      1     10      2  97.2%
+ src/docbuild/cli/cmd_validate/process.py         178      5     52      4  96.1%
+ src/docbuild/cli/callback.py                      35      0     10      2  95.6%
- src/docbuild/cli/cmd_config/__init__.py            9      1      0      0  88.9%
- src/docbuild/config/xml/stitch.py                 47      5     12      0  88.1%
- src/docbuild/cli/cmd_metadata/metaprocess.py     215     26     66     13  82.6%
- src/docbuild/cli/cmd_check/__init__.py            18      5      2      0  65.0%
- src/docbuild/cli/cmd_build/__init__.py            13      5      0      0  61.5%
- src/docbuild/cli/cmd_metadata/__init__.py         27     10      2      0  58.6%
- src/docbuild/cli/cmd_config/environment.py        11      6      2      0  38.5%
  --------------------------------------------------------------------------------
+ TOTAL                                           2923     67    688     24  97.0%
  
  46 files skipped due to complete coverage.

Copy link
Copy Markdown
Contributor

@tomschr tomschr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sushant! 👍

I've added some questions below.

If we allow max_workers in the app config, shouldn't we adjust the AppConfig model accordingly? => Already done in #201

I'm wondering if we should change the AppConfig.max_workers field to int. 🤔 WDYT?

Comment thread src/docbuild/cli/cmd_cli.py
Comment thread src/docbuild/cli/cmd_cli.py
@sushant-suse
Copy link
Copy Markdown
Collaborator Author

Thanks Sushant! 👍

I've added some questions below.

If we allow max_workers in the app config, shouldn't we adjust the AppConfig model accordingly? => Already done in #201

I'm wondering if we should change the AppConfig.max_workers field to int. 🤔 WDYT?

Hi Toms, Good call. Since our validator already resolves the strings into integers, I'll change the type hint to int. This makes the model cleaner and ensures the rest of the app only ever sees a concrete number.

Copy link
Copy Markdown
Contributor

@tomschr tomschr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks good! 👍

@tomschr
Copy link
Copy Markdown
Contributor

tomschr commented Mar 18, 2026

@sushant-suse Forgot one thing: Please add a news fragment file. 😉 Then it's ready to merge. Just add it and merge it, no need to ask me again. 🙂

@sushant-suse sushant-suse merged commit 141a67a into openSUSE:main Mar 18, 2026
9 checks passed
@sushant-suse sushant-suse deleted the issue#190-provide-global-option branch March 18, 2026 07:56
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.

2 participants