Is it possible to run pydev connected to a virtualbox instance? - python

At the moment I'm developing using a simple editor, putty, and a VirtualBox instance of a linux server. I've heard good things about pydev and would like to try it, but I'd like to use the python install & terminal from my VirtualBox guest OS.
I'm already using a Shared Folder with VirtualBox so my Guest OS can see my local files.
Is it possible to tell pydev to use this "remote" host over SSH to execute its python-related commands?
UPDATE:
My main environment is windows, but I'd also like to be able to work this way on OS X.

I assume your host box is windows.
I also assume that pydev will run under linux (since it's eclipse based). Are you ok installing the dev environment on your linux server?
In which case:
install and run xming on your windows box
Install eclipse & pydev on your linux box
Configure x forwarding in putty
Run pydev through putty and you'll have the UI appear on your windows machine like normal
Then pydev will be running on the linux box quite happily, and so using the python environment on there.
Downsides: you will need to install the X libraries & java on your server (installing eclipse using your normal package manager should be enough), although you won't need to run X itself, since that's what Xming is for.

UPDATE:
Let me understand the situation, Windows is hosting the virtualBox which host the linux.
You connect to the linux using putty.
Python files are on the linux machine and you wish to edit them from your Windows using pydev. So either do that using the sharing features of virtual box (which can work for you in vboth ways) or use ssh to edit the linux files from windows.
both options would be valid for MacOSx AFAIK
Below you cna find the way to do so over SSH
You map a netwrok drive over SSH and then you can access the files via that drive letter
see more at
http://www.neophob.com/serendipity/index.php?/archives/103-Map-a-Network-drive-net-use-over-SSH.html
and
http://smithii.com/map_a_network_drive_over_ssh_in_windows

Related

How to connect local PyCharm to python installed on a server? Is this even possible?

I have PyCharm on my machine (8GB RAM). I am required to to heavy data processing, and would like to use an institutionally provided server. This server has Python installed, but without any IDE. So all I see is a CUI, and it is difficult to program in such an environment.Also note that I cannot ask server admin to install software on the server for me. So, how can one connect one's local PyCharm to a python installed on a remote server? Is this even possible?
You can configure an interpreter using SSH:
Open the Add Python Interpreter dialogue
In the left-hand pane of the Add Python Interpreter dialogue, click SSH Interpreter.
Follow the wizard.
For more detailed instructions, check:
https://www.jetbrains.com/help/pycharm/configuring-remote-interpreters-via-ssh.html
Note: unfortunately, this option is not available in the PyCharm Community Edition.

Visual Studio Code use on remote files

Is there any way to use the python extension to edit files that reside on a remote server? I have tried NFS and remoteFS, but I do not see any way to get Intellisense working using the remote installation. I normally edit and test on a windows machine, while the target runs on Linux.
I realise this is not limited to this extension, but is a more general issue.
Visual Studio Code now officially supports this using an Extension: Remote SSH
Read the release notes here: https://code.visualstudio.com/blogs/2019/05/02/remote-development
Today we're excited to announce the preview of three new extensions for Visual Studio Code that enable seamless development in Containers, remotely on physical or virtual machines, and with the Windows Subsystem for Linux (WSL). You can get started right away by installing the Remote Development Extension Pack.
As a workaround, I'm using a Linux Hosted virtual machine which has a similar setup as the target. This works surprisingly well. It is a shame VMware 12 removed support for unity.
I use SSHFS (wikipedia) (github repo)
sshfs OWN_USER#SERVER:/PATH_TO_FILES/ MOUNT_POINT
This makes the remote files visible to any program on your computer, as-if they were local files, through a virtual "FUSE" filesystem.
If your own user can't access the files (you need root or some other user), you can sudo like so:
sshfs -o sftp_server="sudo -u SYSTEM_USER /usr/libexec/openssh/sftp-server" \
OWN_USER#SERVER:/PATH_TO_FILES/ MOUNT_POINT
You can install sshfs for Linux, Mac, or Windows, check out Digital Ocean's guide in my first link.
Don't forget to umount, fusermount -u, or eject that MOUNT_POINT once you're done.
I don't know if other VS Code plugins like IntelliSense would work with this. They should because the sshfs makes the files visible just like any others. But, it would require that the python tool chain you have installed locally be the same on your laptop and on the server. It'd be interesting to find out.
Or, Microsoft just announced some new plugins on the way
Yes there are some. I used this one. It allows to synchronize code between local and remote server.
You will have to keep copy on local host and it can be configured to automatically update code on remote.
https://gurumantra.themillennialpost.info/2020/05/edit-linux-files-remotely-in-vscode.html
Download and install vscode in your localPc if you don’t have it. (click here to download vscode)
Summary :
Install Vscode, remote vscode – LocalPC
Install ssh and Rmate – RemotePc
Ready to access files/data
Detailed Steps:
https://gurumantra.themillennialpost.info/2020/05/edit-linux-files-remotely-in-vscode.html

Run Ansible-Playbook on localhost on Windows

I know Ansible supports Windows clients/nodes. What I really enjoy about Ansible is that I can create a Linux VM, pull a git repo that contains Ansible playbooks for and without any configuration or setup of a control server, I am able to run the playbook on the local machine.
Since you can execute Python on Windows, would it be possible to run roles/playbooks on localhost on Windows?
This would be the first step for running Ansible in a datacenter with only Windows where it is not possible to even run Linux in VirtualBox.
Ansible won't run on a windows control machine, as stated in the documentation:
Reminder: You Must Have a Linux Control Machine
Note running Ansible from a Windows control machine is NOT a goal of the project. Refrain from asking for this feature, as it limits what technologies, features, and code we can use in the main project in the future. A Linux control machine will be required to manage Windows hosts.
Cygwin is not supported, so please do not ask questions about Ansible running from Cygwin.

How to install django applications on a Memory Stick

I am currently developing an open source software based on python/django. The software should later be easy installable by a standard windows/linux users without any programming experiance. It should also be portable to different computers. The only installation that should be required on these computers should be python itself.
Is there a way to get this to work?
I already found this "dbuilder" Django Projects as Desktop applications : how to?
desktop-applications-how-to
It seems to be a bit outdated and not a very smooth solution.
Are there better solutions?
Just use a portable version of python on your memory stick. Make a batch file that runs
projname.bat file:
python.exe /django-app-path/manage.py runserver
now open a browser and browse for it
the default address will be:
http://127.0.0.1:8000
If you need to browse your app on other device that you're app is running:
get your server ip with
windows shell>ipconfig
linux shell# ifconfig
then run your development server on that address (in the batch file):
python.exe /django-app-path/manage.py runserver your-ip-address:port-if-not-80

Python: run a process inside a windows host

I need to run a process inside a windows host from a linux host using python.
I saw WMI python library but seems to work only from a windows host, not linux, how can I do?
I neeed something like PSEXEC, but it works only for windows.
Since you cannot install anything on the windows host, does it have openoffice, or libreoffice installed?
You coult then use the Python interpreter bundled with it to create a python script that listens to xmlrpc and get you job done, controling this script remotely.
If there is no Python installed on the windows side, and yur remote host is Linux, there is this recipe here: http://code.activestate.com/recipes/577945-execute-remote-commands-on-windows-like-psexec/
It does depend on windows - as it imports win32wnet - in my experience, these windows specific modules will run fine in a Windows python installed on a Wine configuration on a Linux machinne.
An easy solution is to run a SSH server on the windows box and use the paramiko library on the client side.

Categories

Resources