Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    Kopano Python Remote Development on Windows

    Development
    2
    2
    348
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • hecke
      hecke last edited by hecke

      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

      fbartels 1 Reply Last reply Reply Quote 1
      • fbartels
        fbartels Kopano @hecke last edited by

        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.

        Regards Felix

        Resources:
        https://kopano.com/blog/how-to-get-kopano/
        https://documentation.kopano.io/
        https://kb.kopano.io/

        Support overview:
        https://kopano.com/support/

        1 Reply Last reply Reply Quote 0
        • First post
          Last post