Skip to content

feat(utils): implement async rsync wrapper with RsyncOptions - #460

Merged
sushant-suse merged 2 commits into
openSUSE:mainfrom
sushant-suse:issue#452
Aug 20, 2026
Merged

feat(utils): implement async rsync wrapper with RsyncOptions#460
sushant-suse merged 2 commits into
openSUSE:mainfrom
sushant-suse:issue#452

Conversation

@sushant-suse

Copy link
Copy Markdown
Collaborator

Addresses #452

What was done:

  • Created RsyncOptions Dataclass: Implemented a flexible configuration class in docbuild.utils.sync to handle common rsync flags (archive, delete, dry_run, etc.) alongside an extra_args list, preventing function signature bloat while maintaining full CLI flexibility.
  • Implemented Async rsync Wrapper: Created an asynchronous rsync() function that wraps docbuild.utils.shell.run_command to execute synchronization tasks safely and concurrently.
  • Smart Trailing Slash Handling: Added path inspection to automatically infer if the user intends to sync a directory or just its contents based on the presence of a trailing slash, with an explicit content_only override parameter.
  • Registered System Dependency: Added rsync to the SYSTEM_DEPENDENCIES dictionary in constants.py so it is automatically verified by the docbuild doctor command.
  • Added Comprehensive Tests: Wrote isolated unit tests verifying argument generation, trailing slash behavior, and Path object compatibility.
  • Resolved Type Warnings: Fixed a pedantic Pylance strict-typing error regarding Enum.name types in constants.py.

@tomschr, as we discussed, I kept this PR strictly focused on the core rsync utility implementation to keep a clean separation of concerns. Once this is merged, I will open the next PR to actually integrate this into the build subcommand logic.

Checklist

  • Code is properly formatted (uvx ruff check --fix and uvx ruff format)
  • Tests have been updated and are passing locally
  • A changelog entry was added to changelog.d/
  • Documentation has been updated (N/A for this PR)

Signed-off-by: sushant-suse <sushant.gaurav@suse.com>
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Coverage Report

For commit 124ae24

Click to expand Coverage Report
  Name                                          Stmts   Miss Branch BrPart  Cover
  -------------------------------------------------------------------------------
+ src/docbuild/tasks/portal.py                    140      0     50      1  99.5%
+ src/docbuild/models/manifest.py                 156      1     32      1  98.9%
+ src/docbuild/logging.py                         104      1     26      1  98.5%
+ src/docbuild/utils/pidlock.py                    79      1     14      1  97.8%
+ src/docbuild/cli/cmd_config/list.py              28      0     10      1  97.4%
+ src/docbuild/cli/cmd_portal/cmd_list.py         168      1     86      7  96.9%
+ src/docbuild/models/deliverable/__init__.py      95      2     14      2  96.3%
+ src/docbuild/models/deliverable/view.py         175      3     48      6  96.0%
+ src/docbuild/cli/callback.py                     35      0     10      2  95.6%
+ src/docbuild/utils/concurrency.py                65      3     18      1  95.2%
+ src/docbuild/tasks/metadata/runner.py            65      3     16      1  95.1%
+ src/docbuild/cli/cmd_cli.py                     142      7     28      6  92.4%
+ src/docbuild/utils/sync.py                       46      3     14      2  91.7%
+ src/docbuild/cli/cmd_metadata/__init__.py        41      2      4      2  91.1%
- src/docbuild/cli/cmd_doctor.py                   37      4     10      2  87.2%
- src/docbuild/tasks/build/runner.py               88     14     16      3  83.7%
- src/docbuild/tasks/metadata/manifest.py         130     16     48      6  83.1%
- src/docbuild/cli/cmd_config/validate.py          21      2     12      3  78.8%
- src/docbuild/cli/cmd_check/__init__.py           22      9      4      0  50.0%
- src/docbuild/cli/cmd_build/__init__.py           59     38      8      0  31.3%
  -------------------------------------------------------------------------------
+ TOTAL                                          3983    110   1088     48  96.5%
  
  58 files skipped due to complete coverage.

@tomschr tomschr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work! 👍

I have some small comments for you.

Comment thread changelog.d/452.feature.rst Outdated
Comment thread src/docbuild/utils/sync.py Outdated
Comment thread src/docbuild/constants.py
Comment thread tests/utils/test_sync.py Outdated
Comment thread tests/utils/test_sync.py Outdated
Comment thread tests/utils/test_sync.py Outdated
Signed-off-by: sushant-suse <sushant.gaurav@suse.com>
@sushant-suse
sushant-suse requested a review from tomschr August 20, 2026 14:13

@tomschr tomschr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great! Thank you very much, Sushant! 👍

Please merge it!

@sushant-suse
sushant-suse merged commit 52b3bd1 into openSUSE:main Aug 20, 2026
10 checks passed
@sushant-suse
sushant-suse deleted the issue#452 branch August 20, 2026 14:53
@tomschr tomschr mentioned this pull request Aug 20, 2026
5 tasks
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