Repository navigation
Python Notes
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
fi
Create a top-level directory to maintain your projects.
$ mkdir /home/username/pyvenvs
Create a project folder, e.g. project1, then a virtual environment.
$ mkdir project1
$ cd project1
$ python3 -m venv project1
$ ls project1
bin include lib lib64 pyvenv.cfg
Activate the project1 virtual environment then launch Atom--use of python3 versus the system wide or non-virtual environment default, python2.
$ pwd
/home/username/pyvenvs/project1
$ . /bin/activate <-- space after the "."
(project1) $
$ atom
When done execute deactivate to exit the virtual environment.
Download and install before starting Atom. For Windows download and right-mouse click to install. For Linux, install the appropriate package, i.e. Fedora is adobe-source-code-pro-fonts. Note as of July 2018, it appears the name of the fonts are "Source Code Variable." Download using the URI given below.
https://github.com/adobe-fonts/source-code-pro/releases/tag/variable-fonts
On opening, Atom will display tabs:
- Welcome Guide: select "Open a Project" then browse, select, and click the OK button for the project1 folder.
- Welcome: remove the check to Show Welcome Guide on opening Atom
- Telemetrics: Disable or permit
Open Atom Settings pane by selecting "Edit" from the menu then Preferences.
Using "Settings" select "Install" then install "script" by rgbkrk.
Change selection from Packages to Themes then install "predawn-syntax" by jamiewilson. Next, select "Themes" and select Predawn under Syntax Theme.
Using "Settings" select "Editor"
- Font Family: Source Code Pro or Source Code Variable
- Font Size: 20
- Scroll Past End: enable
- Tab Length: 4
Not a fan of auto-complete so disable it.
Using "Settings" select "Packages" then disable "autocomplete-plus" and "autocomplete-snippets."
If you desire auto-complete, consider using the Python specific one. You can install it, disable, then Enable as needed.
Using "Settings" select "Install" then install package "autocomplete-python."
Install package python-autopep8 then
- Format On Save: enable
- Install within venv
pip install autopep8 - Also, use
ctrl-alt-sto reformat code
Install package linter by steelbrain. After installation, it will prompt you to install linter-ui-default which in turns prompts you to install intentions and busy-signal`.
Install package linter-flake8 by AtomLinter, then install within venv pip install flake8.
- file-icons
- minimap
If things go wrong or you just want a fresh start, execute rm -rf ~/.atom.