Git Product home page Git Product logo

Comments (8)

byteskeptical avatar byteskeptical commented on June 1, 2024

I completely agree and has been something that has bothered me for a while as well. There are however some compatibility issues across the OS's (Windows specifically). I'll look into providing the use of config as an option but it almost certainly won't be enabled by default.

from sftpretty.

Magicrafter13 avatar Magicrafter13 commented on June 1, 2024

I can't speak for all versions of Windows, but up to date versions of Windows 10, and 11, have OpenSSH built in, and the applications included in that suite will read from ~/.ssh/config if it is available (%USERPROFILE%\.ssh\config).

I'm no Python expert, but I believe something in import os will expand ~ to the user's home directory on both OS types.

from sftpretty.

byteskeptical avatar byteskeptical commented on June 1, 2024

That is true but in my admittedly limited experience the linux sub-system is a completely seperate file-system and ~ doesn't default to the linux home location. I'm also not sure if the sub-system is enabled by default on all versions of 10 or 11 or if it is a toggle-able feature on some/all.

from sftpretty.

byteskeptical avatar byteskeptical commented on June 1, 2024

Just need to add some tests before merging.

from sftpretty.

byteskeptical avatar byteskeptical commented on June 1, 2024

The feature is ready and enabled by default. I've updated the documentation with the nitty gritty but just going to iterate some important notes. By default the current procedure checks a user's default home location ~/.ssh/config but will not fail if it doesn't exist and simply sets a minimal config with no options. Trying to keep backwards compatibility in mind (those words make me cringe) I've tried to make the feature as transparent as possible when not being used while doing my best to mimic the traditional seemless config experience if you do. Currently config options take precedent over parameters but all this behavior is subject to change based on community feedback. Currently the biggest issue I forsee is the growing delta between supported security option algorithms in paramiko and a users SSH program (OpenSSH more than likely). Especially if a config is picked up without the user realizing it is being read.

from sftpretty.

Magicrafter13 avatar Magicrafter13 commented on June 1, 2024

Just tried out the new release, seems to work perfectly 👌

The only comment I have, is on your example in the README. You'll likely need to change config='~/.ssh/config' to config=os.path.expanduser('~/.ssh/config'), otherwise you'll get something like this:

Traceback (most recent call last):
  File "/home/matthew/Documents/projects/vidup/main.py", line 20, in <module>
    class Manager(QObject):
  File "/home/matthew/Documents/projects/vidup/main.py", line 217, in Manager
    cnopts = CnOpts(config='~/.ssh/config')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matthew/Documents/projects/vidup/venv/lib/python3.11/site-packages/sftpretty/__init__.py", line 85, in __init__
    self.ssh_config = self.ssh_config.from_path(config)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matthew/Documents/projects/vidup/venv/lib/python3.11/site-packages/paramiko/config.py", line 109, in from_path
    with open(path) as flo:
         ^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '~/.ssh/config'

Now I just gotta find a clean way to stop transfers mid-upload(/download), but that's probably an issue for paramiko itself...

from sftpretty.

byteskeptical avatar byteskeptical commented on June 1, 2024

Wow for shame, an issue of recursion depth, been coding too much javascript lately it seems, tried to save a line and introduced this bug instead. I'm not sure if you mean resuming an download/upload when you say 'stop transfers' but I have PR #39 in the works with that feature.

from sftpretty.

Magicrafter13 avatar Magicrafter13 commented on June 1, 2024

Wow for shame, an issue of recursion depth, been coding too much javascript lately it seems, tried to save a line and introduced this bug instead. I'm not sure if you mean resuming an download/upload when you say 'stop transfers' but I have PR #39 in the works with that feature.

Not quite looking for resume. I'm using this library for a program that is used to upload large files (usually ~11 GB) to a Linux server, which is very slow - especially if someone made a mistake or changed their mind 😁 - my current solution is a hacking implementation of threading.Thread that I can raise an exception in, and I run sftpretty in that cursed thread haha.

So I mean, my system works, but surely I can't be the only one who might want to, essentially, press Ctrl+C on that SFTP upload/download.

from sftpretty.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.