Termux UV PyPI Configuration

November 19, 2025

I wish I’d found the Termux-specific PyPI index sooner. This PyPI has wheels pre-compiled to run under Termux.

Here’s how to set it up as the default under Termux.

The Configuration File Location

In Termux, uv looks for the configuration file at:

~/.config/uv/uv.toml

Full absolute path in Termux:

/data/data/com.termux/files/home/.config/uv/uv.toml

Creating The Configuration

uv doesn’t create this file automatically. Create the directory and file:

mkdir -p ~/.config/uv && touch ~/.config/uv/uv.toml

Adding The Termux Index

Edit the configuration file:

nano ~/.config/uv/uv.toml

Add the Termux user repository:

[[index]]
name = "termux"
url = "https://termux-user-repository.github.io/pypi/"

Verification

Test with:

uv pip list

Or:

uvx <package-name>

The verbose output will show if uv picks up the configuration.

Copier _subdirectory Best Practice: Keep Template Files Organised

November 18, 2025

Copier’s getting started documentation doesn’t mention the _subdirectory setting, but you need it if you’re going to have a template in a repo that you then want to apply to multiple projects. See: _subdirectory.

The Problem

By default, Copier expects template files to live in the repository root alongside configuration files like copier.yml, README, and other repository metadata. This quickly becomes confusing, especially accidentally copying the .git folder from the template.

The Solution

Use the _subdirectory property in your copier.yml to specify a dedicated folder for template files:

_subdirectory: template

This tells Copier to look for template files in the template/ directory rather than the repository root. Your repository structure becomes:

my-copier-template/
├── copier.yml              # Configuration
├── README.md               # Template documentation
├── .gitignore
└── template/               # All template files here
    ├── src/
    ├── tests/
    └── README.md

Further Reading

The Copier maintainers recommend this approach for keeping templates organised. The official documentation covers additional _subdirectory use cases.

Pydantic In Termux? Install Rust And Some Patience

November 04, 2025

Installing Pydantic in Termux requires building from source. The solution: install Rust and wait.

The Problem

Attempting to pip install pydantic in Termux fails because pydantic-core needs to be built from source. No precompiled wheel is available for the Termux environment.

The Solution

Install Rust, pkg install rust then let pip build pydantic-core from source.

The build takes approximately 10 minutes. Let it run in the Termux window without interruption.

A Better Solution

Use uv with the Termux PyPI repository which provides precompiled wheels. This avoids the need to build from source and is significantly faster.

Asking Copilot To Write Diagnostic Scripts When Stuck

November 01, 2025

When Copilot gets stuck trying to directly fix a problem, asking it to write a diagnostic script can help get unstuck.

The Pattern

Instead of repeatedly asking Copilot to fix the issue directly, request a standalone diagnostic script. The script should:

  • Test different configurations to isolate the problem
  • Output detailed information about what works and what doesn’t
  • Be independent and easy to run

Example

Whilst fixing a web scraper that was getting 403 errors, direct attempts to fix the issue went in circles. Asking Copilot to write a diagnostic script revealed that the issue was missing HTTP headers.

The diagnostic script tested multiple header combinations and logged the results, making the root cause obvious. See diagnose_403.py for the implementation.

Why This Works

  • Diagnostic scripts gather facts rather than making assumptions
  • The output provides concrete data for subsequent fixes
  • The script becomes documentation of the investigation process
  • It’s faster than iterative trial-and-error

Termux API Install Needs to Be from F-Droid

October 27, 2025

Quick fix for a key signing error when using Termux API.

The Problem

Installed Termux from F-Droid, then installed Termux:API via command line:

pkg install termux-api

When attempting to use the API (e.g., termux-storage-get), encountered a key signing error preventing the API from functioning.

The Solution

Install Termux:API from F-Droid, not via pkg install.

Both Termux and Termux:API must come from the same source (F-Droid) to have matching signatures.

The Steps

  1. Open F-Droid
  2. Search for “Termux:API”
  3. Install the Termux:API app
  4. The command-line tools will now work correctly

References

F-Droid Termux page
F-Droid Termux:API page

GitHub Copilot CLI Running On Raspberry Pi

October 23, 2025

This post is being written from GitHub Copilot command line running on a Raspberry Pi.

I attempted to get the install working on Termux on Android first, but couldn’t get it to work. The Raspberry Pi installation was straightforward by comparison.

Google Vision Handwriting Recognition Works!

October 14, 2025

Got Google Vision working on Android mobile. Example picture worked perfectly.

Testing on Android

The entire workflow runs on Android mobile using Termux:

  1. Set up Google Vision API with service account credentials
  2. Transferred credentials securely via Tailscale
  3. Ran the Python script directly on the phone
  4. Recognition accuracy was excellent

Example Test

Tested with a hand-drawn workflow diagram showing the process: paper → Google Vision API → GitHub. The API accurately recognised the handwritten text written in casual handwriting.

Results

Text accuracy: Excellent - recognised handwritten notes accurately
Setup simplicity: Straightforward once grpcio installation sorted
API response time: Fast enough for real-time use

See the complete working code on GitHub.

The gvision-text repository contains the full working implementation and setup instructions.

Accessing Google Vision API from Python on Android

October 13, 2025

Here’s a summary of what I needed to do to access the Google Vision API from Python using Termux on Android.

  1. Get API key on laptop - Generate service account key JSON file using Google Cloud Console on a desktop/laptop
  2. Transfer using Tailscale - Use Tailscale’s file transfer feature to securely move the key file from laptop to phone
  3. Install grpcio via Termux package - pip install grpcio won’t work on Android. Use Termux’s native package instead:
# Don't use pip for grpcio on Android
# pip install grpcio  # This fails

# Use Termux package instead
pkg install python-grpcio

Complete Instructions

See gvision-text repository for detailed setup and usage instructions.

Starting With Mobile Development Using React Native Expo Go

September 25, 2025

I’m planning to write a new app to remind my wife when she has to pay for a ticket at the barrier-less car park she uses for work.

As a first step I’m experimenting with React Native Expo Go. To start I simply want to display the lat-long value that my phone currently receives.

How To Steer GitHub Copilot Agent Mid-Task: Comment On The Pull Request, Not The Issue

September 11, 2025

Here’s something I learnt when working with GitHub Copilot’s coding agent: if you want to provide feedback or steer the agent whilst it’s working on a task, you need to comment on the pull request it creates, not on the original issue.

The Problem

When Copilot starts working on an issue, it creates a pull request and begins implementing changes. Your natural instinct might be to add comments to the original issue if you want to clarify requirements, suggest a different approach, or provide additional context.

This doesn’t work. Comments added to the parent issue appear to be completely ignored by the agent.

The Solution

Instead, navigate to the pull request that Copilot has created and add your comments there. The agent actively monitors the PR for feedback and will incorporate your guidance into its ongoing work.

Even review comments can be hit-and-miss. I’ve seen Copilot pick up the review comment immediately. I’ve seen Copilot completely ignore review comments. If you’ve put a review in and Copilot is ignoring it, then a @copilot please work to correct the review comments prompt usually gets its attention.