Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Justin Miller
    @jpmio
    hello
    I just discovered plumbum and it is very interesting to me
    I have a question about SshMachine tunneling
    I need to ssh from my machine, through a middle machine, to a destination machine
    In the documentation there is an example of setting up an ssh tunnel from my machine to the middle machine, then opening a socket to the destination machine
    Is it possible to use SshMachine to setup another ssh session from the middle machine to the destination machine?
    Henry Schreiner
    @henryiii
    Could you do it by setting up a .ssh/config alias where that does the tunneling? Or does it need to be in Python
    Host myhost
       Hostname example.com
       User me
       ProxyCommand ssh -q -x me@proxy.com -W %h:22
    then connect to myhost with SshMachine
    Justin Miller
    @jpmio
    It needs to be in Python. I'm writing a test script that could be run many different places, and I can't control the .ssh/config
    I may be able to accomplish what I need with ParamikoMachine
    It's nice that is also an option
    Jacek Wielemborek
    @d33tah
    Hi! Is there a way to do process substitution in plumbum?
    Something like aws["s3", path, "-"] | tee[<(command_1()), <(command_2())]
    Henry Schreiner
    @henryiii
    local[command_1()] (followed by whatever you need to do)?
    (Depending on printed string, there I was assuming a command was returning a command name
    Jacek Wielemborek
    @d33tah
    I basically want to pipe copied output of one command to a couple of other commands' input
    @henryiii does it make sense?
    Jacek Wielemborek
    @d33tah
    @henryiii consider the following example:
    from plumbum.cmd import aws, tee, mkfifo, rm, pigz, rg
    from plumbum import BG
    
    mkfifo['pipe1']()
    mkfifo['pipe2']()
    mkfifo['pipe3']()
    p = ((
        aws['s3', 'cp', 's3://some/huge-file', '-'] |
        pigz['-dc'] |
        tee['pipe1', 'pipe2', 'pipe3']
    ) > "/dev/null") & BG
    
    processes = []
    processes.append(((rg['microsoft'] < "pipe1") > 'microsoft') & BG)
    processes.append(((rg['apple'] < "pipe2") > 'apple') & BG)
    processes.append(((rg['google'] < "pipe3") > 'google') & BG)
    
    p.wait()
    for sub in processes:
        sub.wait()
    rm['pipe1', 'pipe2', 'pipe3']()
    is there a way to implement this with more help from plumbum?
    Henry Schreiner
    @henryiii
    I’ll try to look at it tonight or tomwrrow (in meeting now)
    Jacek Wielemborek
    @d33tah
    okay, thanks!
    Jacek Wielemborek
    @d33tah
    also, how do I pass arguments as a list?
    never mind, I think I figured this one out, just had a bug. still not sure about process substitution.
    Jacek Wielemborek
    @d33tah
    ping @henryiii
    Henry Schreiner
    @henryiii
    Ping me tomorrow please :) Working on slides for a talk on Monday.
    Jacek Wielemborek
    @d33tah
    @henryiii ping
    Henry Schreiner
    @henryiii
    I’m traveling in Milan and will try to look into it on the train tomorrow. I copied the example so I’ll have it to play with. I am not sure if reading from a stream in two places can work
    Jacek Wielemborek
    @d33tah
    @henryiii enjoy the travel! It can work, as demonstrated by my example.
    Henry Schreiner
    @henryiii
    There may be a way to make it a bit nicer, or somethign that can be added to Plumbum. I think the main issue is reading from stream in two places. I think it’s an intersting thing to investegate, you just caught me at a bad time, this month has a ton of travel in it. :/
    Hopefully the train will be a good place to work a bit.
    venkat
    @venkata_adem_twitter
    Hello Guys, I am a SAP consultant and my client asked to install python plumbum on one of the linux box, Can someone please help me with some documentation or steps to install the same.
    Henry Schreiner
    @henryiii
    The instructions here are a bit terse; if you already have python and pip you can just run pip install python.
    It’s a plain Python-only library, so the install is pretty standard for a Python package. Python packing is a bit complex though if you are not used to it.
    Henry Schreiner
    @henryiii
    For example, if you use the conda distribution instead of normal Python, the nicest way it to do conda install -c conda-forge plumbum instead (only benefit there is that you get Paramiko, which is a nice ssh library). If you don’t have sudo, then pip install --user plumbum will install it for all Pythons but only the current user, and if you are in a virtual environment… :)
    venkat
    @venkata_adem_twitter
    thank you Henry, I shud install PIP first then.
    Uryga
    @lubieowoce
    hi! anyone here?
    Uryga
    @lubieowoce
    well, i'll post my question anyway in case someone comes by. i'm having problems with using shell builtins as commands; e.g. on Ubuntu, local['type'] fails with CommandNotFound. i understand that this is because type is a bash builtin, and has no corresponding executable. so my question is: is there a way to do shell builtins with plumbum? i.e. something that'll just do the equivalent of subprocess.run(['type', ...], shell=True, ...) without trying to locate the (non-existent) binary?
    Jacek Wielemborek
    @d33tah
    @henryiii Hi! Could you take a look at my SO question, in case I missed something? https://stackoverflow.com/questions/58431070/avoid-escaping-dollar-sign-in-a-subcommand
    Henry Schreiner
    @henryiii
    Could you copy and paste that into an issue? I’ll try to look at it this weekend, but someone else might see it sooner. I’m traveling in UK at the moment.