current position:Home>Better use atom to support jupyter based Python development

Better use atom to support jupyter based Python development

2021-08-22 23:30:28 harrylyx

About using Atom Conduct Python There are few online materials developed , Recently, it has been found that Atom combination Hydrogen Plug in Python Development , Especially the work related to data mining , The overall experience is better than Vscode,Vscode Although there are connections Jupyter Tools for , But interactive development Hydrogen Experience better .

Here is a moving picture to show Hydrogen A powerful

Plug in installation

Python

  • Hydrogen
  • atom-ide-ui
  • ide-python

Pay attention here , The local pip need install python-language-server[all], stay ide-python Of readme It's detailed in

Remote connection

  • Remote FTP

beautify

  • simplified-chinese-menu( Chinese patch )

  • file-icons( Folder icon )

  • bracket-colorizer( Rainbow brackets , For a long time , To be sure is to cooperate with the dark theme )

  • atom-bracket-highlight( Brackets highlight )

  • atom-clock( Add a clock in the lower right corner )

  • highlight-selected( Highlight selection )

  • minimap( similar sublime The right side of the map bar )

  • minimap-highlight-selected( After selecting the code ,map It also highlights , Easy to locate code )

The plug-in configuration

Remote FTP

Let's talk about my needs first , I need to use it to connect to the content on the company's server , But the company server needs a springboard , So I need a springboard machine to access , Therefore, the configuration will be a little complicated

{
    "protocol": "sftp",
    "host": " Springboard domain name ", // string - Hostname or IP address of the server. Default: 'localhost'
    "port":  Springboard port , // integer - Port number of the server. Default: 22
    "user": " user name ", // string - Username for authentication. Default: (none)
    "pass": " If you use a key, you don't have to fill in ", // string - Password for password-based user authentication. Default: (none)
    "promptForPass": false, // boolean - Set to true for enable password/passphrase dialog. This will prevent from using cleartext password/passphrase in this config. Default: false
    "remote": " Actual server directory , for example :/ Server domain name / user name / Catalog ", // try to use absolute paths starting with /
    "agent": "", // string - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. Linux/Mac users can set "env" as a value to use env SSH_AUTH_SOCK variable. Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin "UNIX socket." Default: (none)
    "privatekey": " Local private key path", // string - Absolute path to the private key file (in OpenSSH format). Default: (none)
    "passphrase": "", // string - For an encrypted private key, this is the passphrase used to decrypt it. Default: (none)
    "hosthash": "", // string - 'md5' or 'sha1'. The host's key is hashed using this method and passed to the hostVerifier function. Default: (none)
    "ignorehost": true,
    "connTimeout": 10000, // integer - How long (in milliseconds) to wait for the SSH handshake to complete. Default: 10000
    "keepalive": 10000, // integer - How often (in milliseconds) to send SSH-level keepalive packets to the server (in a similar way as OpenSSH's ServerAliveInterval config option). Set to 0 to disable. Default: 10000
    "keyboardInteractive":  If you want to use a dynamic token , Here you have to fill in true, // boolean - Set to true for enable verifyCode dialog. Keyboard interaction authentication mechanism. For example using Google Authentication (Multi factor)
    "keyboardInteractiveForPass": false, // boolean - Set to true for enable keyboard interaction and use pass options for password. No open dialog.
    "remoteCommand": "",
    "remoteShell": "",
    "watch":[],
    "watchTimeout":500, // integer - The duration ( in milliseconds ) from when the file was last changed for the upload to begin.
}

ide-python

I need to configure it Python Executable

Fill in your python route , For example, we use conda A virtual environment , Just write

/xxx/anaconda3/envs/xxx/bin/python

Hydrogen

Connect local Kernel

First, you need to fill in the path above python Installation in the environment ipykernel

python -m ipykernel install --user --name py37

And then use atom Open one py file , Input

# %%
print('hello atom')

# %%
print(' every last # %% Represents a new cell')

Then again 2 Press... At the end of the line ctrl+enter It will pop up automatically to let you choose the pop-up window of the environment , Select the newly created environment

And then in Hydrogen Inside by using # %% To divide each cell, stay Mac Use in option+shift+enter Key combination to run the current whole ceil, Use command+enter Run the current line , Use shift+enter Run the current line and jump to the next line , For details, please refer to the official documents

Connect remote Kernel

Connect remote Jupyter Just configure Hydrogen Set the inside Kernel Gateways, Just fill in the following

[{"name": "Remote server",
  "options": {
    "baseUrl": "jupyter url",
    "token": "jupyter token"
  }
}]

And then click Connect to Remote Kernel that will do

copyright notice
author[harrylyx],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2021/08/20210822233024963g.html

Random recommended