Kopano Python Remote Development on Windows



  • Hi,

    this is my way of developing python scripts on my Windows 10 machine remotely on a Kopano server.
    It even should work on other OSs that VSCode runs on.
    Mabe this is of interest for some of you. So here we go.

    Prerequisites: VSCode

    • make a folder for your code on your Windows machine and open it on VSCode
    mkdir c:\kopano-python
    cd c:\kopano-python
    code .
    
    • install the Remote Development extension in VSCode
    ms-vscode-remote.vscode-remote-extensionpack
    
    • add a new SSH host via the command palette and connect to the server
    Remote-SSH: Add New SSH Host...
    
    username@server
    
    • right click on the new host in the Remote Explorer and choose
    Connect to Host in current Window
    
    • log in
    • select “Open Folder” from the files explorer and choose where you want to map your local folder on the remote host
    • now your machines are connected and you can start developing
    • make a new file “kopano-list-users.py”, install the recommended Python extension and reload
    • hack in some code
    import kopano
    
    server = kopano.Server(auth_user="<your admin user>", auth_pass="<password>")
    
    users = server.users()
    
    for user in users:
        print(user)
    
    • hit F5 to debug
    • et voilà, remote development with autocompletion, linting and debugging.

    This is my preferred method for writing python scripts. It’s so easy and elegant I even use it to write small one time cleanup scripts.

    Cheers,
    Hecke


  • Kopano

    Hi @hecke,

    thanks for your tutorial! The remote development extensions in Vs code are indeed quite powerful. Been using this for quite a while myself already.


Log in to reply