allow passing kwargs to sftp client - #41
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #41 +/- ##
==========================================
- Coverage 94.30% 93.64% -0.67%
==========================================
Files 13 12 -1
Lines 738 803 +65
==========================================
+ Hits 696 752 +56
- Misses 42 51 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@efiop Would you mind reviewing this PR? |
|
Hey, @ttomasz , thanks for the PR! Please see some suggestions above. |
|
@ttomasz a gentle reminder :) or can we close this PR? |
|
Sorry, was quite busy past few months 😅 I should be able to finish this up in June. |
2a39ec4 to
0a8a32d
Compare
|
Changed popping kwargs to separate parameter for stuff to pass to underlying library. |
|
Sorry for the mess with the commits. Do you want me to revert client_args/connect_args to being kwargs instead of parameter? Or is the current state ok? |
|
Can I ask for this PR to get revived? I too need to pass options to I need to override the default |
There was a problem hiding this comment.
🟡 Not ready to approve
As written it likely doesn’t fully resolve Issue #39 because path_encoding passed as a top-level kwarg would still be forwarded to asyncssh.connect(), and the new behavior also needs targeted tests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR adds a way to pass asyncssh.SSHClientConnection.start_sftp_client() keyword arguments through SSHFileSystem, enabling configuration such as path_encoding (referenced in Issue #39) without overloading asyncssh.connect() options.
Changes:
- Add
sftp_client_kwargstoSSHFileSystemand plumb it through the connection/pool setup. - Update the SFTP channel pool base class to store
sftp_client_kwargsand forward them intostart_sftp_client(**...). - Refactor connection argument passing to distinguish
connect_argsfrom SFTP-client args.
File summaries
| File | Description |
|---|---|
| sshfs/spec.py | Adds sftp_client_kwargs and separates connect_args from SFTP-client kwargs during connection/pool creation. |
| sshfs/pools/base.py | Stores sftp_client_kwargs on the pool and forwards them to client.start_sftp_client(**...). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Assert the options reach the channel pool and that a filesystem constructed with sftp_version=3 works end to end. Trim the call-site comments and wrap the docstring within the line limit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2292727 to
d02015d
Compare
|
Rebased this onto
To answer the open question: the explicit |
… annotation Both raised by Copilot review: the pool-level test captures the kwargs actually passed to start_sftp_client (the fs-level test only proves they are stored), and the timeout annotation now allows None as the docstring describes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Not ready to approve
It currently introduces a backward-incompatible API behavior by always passing sftp_client_kwargs into pool_type(...), which will break existing custom pool implementations.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
sshfs/spec.py:126
sftp_client_kwargsis always normalized to{}and then unconditionally passed intopool_type(...). That makes every custompool_type(which previously only needed to acceptclientandmax_channels) start failing withTypeError: __init__() got an unexpected keyword argument 'sftp_client_kwargs'even when the caller doesn’t use this new feature. Consider only passingsftp_client_kwargsto the pool when it’s actually provided/non-empty, so existing custom pool implementations remain compatible by default.
pool = pool_type(
client,
max_channels=max_sftp_channels,
sftp_client_kwargs=sftp_client_kwargs,
)
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
path_encoding=None flows through sftp_client_kwargs to a real channel and asyncssh delivers paths as raw bytes, which is the workaround for servers with non-UTF-8 file names that motivated the issue. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Re Copilot's "not ready to approve" note about always passing |
Fixes #39