Skip to content

Python Notes

Richard Harmonson edited this page Mar 3, 2018 · 39 revisions

Python

.bashrc

Update ~/.bashrc with alias python=python3 and alias idle=idle3 dnf install python3-tools for idle3

Atom

Alternative to idle3 is to use Atom.

To install Atom from the official RPM package provide by the Atom team (which is only suitable for 64-bit systems!) for the latest stable (as opposed to beta releases which are also packaged at RPMs) Atom release, run:

sudo dnf install $(curl -sL "https://api.github.com/repos/atom/atom/releases/latest" | grep "https.*atom.x86_64.rpm" | cut -d '"' -f 4)

While there is no official way to auto-update these binaries here is a ~/.bashrc (also compatible with the Zsh shell's ~/.zshrc file) snippet that will automatically check for available Atom updates and install them whenever one opens a terminal:

ATOM_INSTALLED_VERSION=$(rpm -qi atom | grep "Version" |  cut -d ':' -f 2 | cut -d ' ' -f 2)
ATOM_LATEST_VERSION=$(curl -sL "https://api.github.com/repos/atom/atom/releases/latest" | grep -E "https.*atom-amd64.tar.gz" | cut -d '"' -f 4 | cut -d '/' -f 8 | sed 's/v//g')

if [[ $ATOM_INSTALLED_VERSION < $ATOM_LATEST_VERSION ]]; then
  sudo dnf install -y https://github.com/atom/atom/releases/download/v${ATOM_LATEST_VERSION}/atom.x86_64.rpm

Customize Atom

Script

Using "Settings" install package "script" by rgbkrk.

Syntax

Using "Settings" install Theme "predawn-syntax." To enable the theme, select "Themes" and change syntax theme to "Predawn."

Editor

Use "Source Code Pro" for font and size 20. Scroll ..down.. and enable "Scroll Past End."

Set Tab Length from 2 to 4.

Auto-complete

To disable the default auto-complete, select packages and remove "autocomplete-plus" and "autocomplete-snippets."

Add Python autocomplete by installing package "autocomplete-python."

Additional Packages

  • file-icons
  • minimap
  • auto-pep8; also, dnf install python3-autopep8
  • linter-flake8; dnf install python3-flake8

Clone this wiki locally