fsspec / fsspec/filesystem_spec
Make SFTP File-System more configurable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 490
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 38
Description
Currently, when we instantiate an SFTP file-system, we can pass kwargs directly to paramiko.client.SSHClient.connect(). However, I would like to be able to do more than just this - specifically, set parameters regarding host keys. The missing_host_key_policy is hard-coded to AutoAddPolicy, whereas I might prefer to use RejectPolicy. But even if I were able to change the policy, I wouldn't have a chance to add any host-keys before the connection is made.
I propose allowing the user to optionally pass in a paramiko.client.SSHClient instance to SFTPFileSystem.__init__() which is pre-configured to their desires. This should allow more freedom to users of the SFTPFileSystem, without a inheriting a significant maintenance burden.
The other option would be to allow passing in a paramiko.sftp_client.SFTPClient instance. The issue I find with this, however, is that the SFTPFileSystem.client attribute would no longer be set (or would be None), in cases where the SFTPClient is passed in. I don't know an easy way to reverse-engineer the SSHClient instance from an SFTPClient instance. Perhaps it's not important, I'll leave that up to discussion.
Thanks to the maintaners for all your great work on this library!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SFTPFileSystem.init and its connection setup; trace how kwargs reach paramiko.client.SSHClient.connect() and where missing_host_key_policy is configured. Resolve whether a pre-configured SSHClient or an SFTPClient is the supported input, then verify that host-key configuration works while SFTPFileSystem.client remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100