mcauser / mcauser/awesome-micropython
Show last commit dates for repos in the README list
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 221
- PR merge metrics
- No merged PRs in 30d
Description
Seeing some similar libraries might have old code, I wanted to see last commit dates to find the newer ones. Didn't know really how to write what I wanted, so I got some Ai help. "We" created this Python script to add the date of last commits for GitHub repos to the README and save it locally.
Hopefully this is useful for others. Thanks for your Awesome work!
update_readme_with_commit_dates.py.zip
# Update README with commit dates
import os
import re
import json
import time
import requests
from tqdm import tqdm # ✅ Progress bar
README_URL = "https://raw.githubusercontent.com/mcauser/awesome-micropython/master/readme.md"
OUTPUT_FILENAME = "readme_with_commit_dates.md"
CACHE_FILE = "commit_dates_cache.json"
# 🔐 GitHub token for more API requests
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", "your_token_here")
HEADERS = {
"Authorization": f"token {GITHUB_TOKEN}",
"Accept": "application/vnd.github.v3+json"
}
# Regex patterns
REPO_LINK_RE = re.compile(r"https://github\.com/([\w\-]+)/([\w\-]+)$")
LIST_ITEM_RE = re.compile(r"^\* \[(.*?)\]\((.*?)\)(.*)")
def load_cache():
if os.path.exists(CACHE_FILE):
with open(CACHE_FILE, "r") as f:
return json.load(f)
return {}
def save_cache(cache):
with open(CACHE_FILE, "w") as f:
json.dump(cache, f)
def get_last_commit_date(owner, repo, cache):
repo_key = f"{owner}/{repo}"
if repo_key in cache:
return cache[repo_key]
url = f"https://api.github.com/repos/{owner}/{repo}/commits"
try:
response = requests.get(url, headers=HEADERS)
if response.status_code == 200:
commits = response.json()
if commits:
date = commits[0]['commit']['committer']['date'][:10]
cache[repo_key] = date
time.sleep(0.5) # Be kind to the API
return date
else:
print(f"⚠️ Skipping {repo_key} — status code {response.status_code}")
except Exception as e:
print(f"❌ Error fetching {repo_key}: {e}")
return None
def update_readme(text, cache):
updated_lines = []
lines = text.splitlines()
# ⏳ Pre-process to find all real repo links
repo_lines = [
(i, LIST_ITEM_RE.match(line))
for i, line in enumerate(lines)
if LIST_ITEM_RE.match(line) and REPO_LINK_RE.fullmatch(LIST_ITEM_RE.match(line).group(2).strip())
]
# 📊 Progress bar time!
for i, match in tqdm(repo_lines, desc="🔄 Processing repos", unit="repo"):
title, url, desc = match.groups()
url = url.strip()
desc = desc.strip()
owner, repo = REPO_LINK_RE.fullmatch(url).groups()
date = get_last_commit_date(owner, repo, cache)
if date:
if "Last commit:" in desc:
desc = re.sub(r"_\(Last commit: .*?\)_", f"_(Last commit: {date})_", desc)
else:
desc += f" _(Last commit: {date})_"
lines[i] = f"* [{title}]({url}) {desc}"
return "\n".join(lines)
def main():
print("📥 Downloading README...")
response = requests.get(README_URL)
if response.status_code != 200:
print("❌ Failed to download README")
return
readme_text = response.text
cache = load_cache()
print("🔍 Updating repository descriptions (this will take a while)...")
try:
updated = update_readme(readme_text, cache)
except KeyboardInterrupt:
print("\n🛑 Stopped by user. Saving partial results...")
save_cache(cache)
return
print("💾 Saving updated file...")
with open(OUTPUT_FILENAME, "w", encoding="utf-8") as f:
f.write(updated)
save_cache(cache)
print(f"✅ Done! Output saved to: {OUTPUT_FILENAME}")
if __name__ == "__main__":
main()
It generated this updated README with the dates added. (Sorry, I have not learned the proper ways of GitHub, yet. Going through the Python Crash Course book now.)
SAMPLE:
AI
- MicroMLP - A micro neural network multilayer perceptron for MicroPython (used on ESP32 and Pycom modules). (Last commit: 2020-12-23)
- MicroPython-NeuralNetwork - Neural Network for MicroPython.
- upython-chat-gpt - ChatGPT for MicroPython. (Last commit: 2023-06-05)
- emlearn-micropython - Efficient Machine Learning engine for MicroPython. (Last commit: 2025-03-28)
- mp_esp_dl_models - MicroPython binding for the ESP DL vision models like face detection. (Last commit: 2025-03-29)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the attached update_readme_with_commit_dates.py script and the generated readme_with_commit_dates.md, then compare them with the repository's README list. Determine how the GitHub commit dates should be maintained in the README; done means the list includes accurate dates without disrupting non-GitHub entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, python
- Domain
- content, documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100