Python is a good language for writing software. It encourages clean, readable code. It's a nice interface to the underlying system.

About the only downside is that it doesn't run clientside on web browsers. For that you'll need Javascript (JS).


Many systems come with Python installed by default, but are a few other tools that are good to install globally.

sudo apt install python3-pip

Make sure you have pipenv installed:

pip3 install pipenv

Add .local/bin to the PATH by editing ~/.bashrc

export PATH

All other dependencies should be installed as part of the virtual environment (virtual-env) so they can be tracked with the project.

New Project

Best practices for starting a python project

Install dependencies using pipenv:

cd project_folder
pipenv install moments

At this point you can launch the virtualenv shell (pipenv shell), or run individual commands within the environment (pipenv run).

Files and Directories that should be included:

make a new virtualenv:


Set up a test to describe the behavior you want to see. It's okay to use a template.

Then run the test.

Helps to have this process built in early.

I have used nosetests in the past, but it may be sufficient to just use the built in unit testing at this point. py.test is also recommeded Testing Your Code — The Hitchhiker's Guide to Python

Make it easy to run tests.

Run tests often. Before you start making changes. After changes are complete. And all along the way in between.


py.test is a more popular alternative to nose(2) test:

These simplify the syntax of the native unnittest library with shortcuts like 'assert'.

pip3 install pytest

pwd /data/data/com.termux/files/home/public/moments $ pip3 install pytest

then in directory with tests:



Many great introductions to the language exist. Here are some resources that looked strong. There may be new options available. Try searching for "python learning resourxrs". How to Think Like a Computer Scientist — How to Think Like a Computer Scientist: Learning with Python v2nd Edition documentation Dive Into Python

Regular Expressions

The group() function returns the string matched by the re


how to install a module for development with pip?

sudo pip install -e sortable/