Skip to content

Mobile Setup

o355 edited this page Feb 1, 2018 · 6 revisions

We live in a mobile world. Thankfully, you can get PyWeather on your phone.

A quick note

Python isn't the best platform to make mobile programs on. You can most certainly go about and try to get PyWeather running on mobile in a better way than the steps below.

Android phones

Android users, you have it easy thanks to Termux and it's widgets feature.

(video coming never)

If you want to follow manual instructions, here's how:

To begin, this will use Termux's Widgets feature. You can get Termux and Termux:Widgets for free on F-Droid, or on Google Play for $1.99. If you want to support the developer, I'd highly recommend buying it from Google Play.

To install from Google Play, it's pretty simple, just install "Termux" and "Termux:Widgets".

If you want to get Termux from F-Droid, on your phone, go to f-droid.org and hit the Download button to download the APK. Once it's done downloading, install the .apk. When prompted, make sure to allow unknown installs.

Open up F-Droid, and let F-Droid update it's repositories. After that, F-Droid should be prompting you to update itself. Let F-Droid update itself, and allow the install when prompted. Open F-Droid back up, and let it update repositories again. In total this initial setup should only take a few minutes at most.

Once everything is squared away, hit the search icon, and search for Termux. Hit the download icon next to "Termux", and "Termux:Widgets". When prompted, allow both installs. This should only take a few moments.

After that's all done, finally open Termux and let it install, and it should only take a moment.

Let's now update repositories, upgrade pre-installed packages, and install a few packages. python will be used for Python, nano used for making the widget shortcut, and git to clone PyWeather. If you're not a fan of nano, you're free to install whatever text editor you want, but just note this tutorial will use nano.

Begin by issuing these commands:

apt update
apt full-upgrade
apt install nano python git

Make sure when you install the packages necessary, you enter "Y" to install them. Installing should only take a moment or two depending on your connection speed.

Next, you'll want to install necessary libraries with pip. Do so by issuing this command:

pip install requests halo colorama appjar geopy

Installing these libraries should only take a minute or so.

We're almost done, and it's time to clone PyWeather, by issuing these commands:

cd ~ (verify that we're in our home directory)
git clone https://github.com/o355/pyweather.git ./pyweather
cd pyweather
git checkout 0.6.3-beta

Finally, issue python setup.py to run PyWeather setup.

Setting up a widget shortcut for Termux Setting up a widget shortcut isn't terribly hard, and can be done very easily.

First off, let's navigate to Termux's shortcuts directory:

cd ~/.shortcuts

After that, you'll want to use this command to open up nano (the text editor we installed earlier) to begin making the shortcut file:

nano pyweather.sh

When in the text editor, you'll want to copy and paste the "code" below, or type it out yourself:

cd ~/pyweather
python pyweather.py

Once you're done with that, hold down the volume down key on your device, and type in "O", then "M", then "X". This will save the script and exit out of nano.

Finally, enter exit to exit out of Termux. Go to your homescreen, press down (or do some other gesture depending on your launcher) to add a widget, and select the 1x1 Termux widget. When the list pops up, select pyweather.sh. Congrats, you can now launch PyWeather from your home screen!

For even faster access to your weather, make your most frequently used locations favorite locations, and then you can access them with favloc:x or favoritelocation:x, where x represents the number of the favorite location. I plan to add even faster access with just fl:x soon.

However, there are a few caveats to running PyWeather on Termux:

  • Numbers aren't rounded, a fix will be coming in early to mid 2018.
  • The configupdate script doesn't work as far as I know. You might need to reprovision your config file every time a new update comes out.

If your phone can't run Termux, your only option as far as I know is to use an SSH client.

iOS devices

I'm not an iOS fan, and I don't know of a Termux alternative, or of any Python 3 apps that also somehow enable you to download GitHub code, and install pip libraries.

Create an issue if there is an app that fits these requirements on iOS.

If all else fails...

Use a mobile SSH app. There are lots of good ones on Android/iOS, along with other platforms (Termius for Android/iOS is a personal favorite). Have a Linux box with SSH access that runs PyWeather, and use that. Nearly all Linux systems that can run an SSH server with Linux also have support for PyWeather.