add stats, versioning

This commit is contained in:
C committed 2026-01-05 16:23:44 -08:00
1 parent dfd2c2f07d
commit bcf625d2b0
6 files changed
+33 -6

No files matched your search

+1
View File
@@ -0,0 +1 @@
0.3.0
+16 -4
View File
@@ -1,8 +1,18 @@
import multiprocessing
import os
import git
import src.banner as banner
def get_git_commit():
"""Get first 6 characters of current git commit hash"""
try:
repo = git.Repo(search_parent_directories=True)
return repo.head.commit.hexsha[:6]
except Exception:
return "unknown"
# Server socket
bind = "127.0.0.1:7433" # nginx will proxy to this
backlog = 2048
@@ -71,11 +81,13 @@ def on_reload(server):
def when_ready(server):
print(banner.generate("studspider v0.1"))
commit_hash = get_git_commit()
print(f"{banner.generate("studspider v0.3.0")} - {commit_hash}")
print("Built for PLAY-WELL TEKNOLOGIES by contact@studspider.sh\n\n")
print(f"STUDSPIDER HOOK v0.1 RUNNING ON {bind}")
print(f"WORKERS: {workers}")
print(f"WORKING CLASS: {worker_class}\n")
print(f"BOOTING ON:\t{bind}")
print(f"WORKERS:\t{workers}")
print(f"WORKER TYPE:\t{worker_class}")
print(f"{'=' * 60}\n")
def worker_int(worker):
+2 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "studpider"
version = "0.1.0"
version = "0.3.0"
description = ""
authors = [{ name = "CF", email = "ph0sgene@pm.me" }]
requires-python = ">=3.13,<3.14"
@@ -22,6 +22,7 @@ dependencies = [
"uvicorn>=0.40.0",
"gunicorn>=23.0.0",
"async-lru>=2.0.4",
"gitpython>=3.1.0",
]
[build-system]
+1 -1
View File
@@ -2,7 +2,7 @@ from setuptools import setup
setup(
name="studspider",
version="0.1",
version="0.3.0",
description="Bricket + Square integration application",
author="CF",
author_email="chris-forst@pm.me",
+11
View File
@@ -4,11 +4,22 @@ Queries Square catalog to collect metrics about LEGO inventory quality.
"""
import json
import git
from typing import Dict, Any
from square import AsyncSquare
from . import get_sq_env
from . import abricksetapi
def get_git_commit() -> str:
"""Get first 6 characters of current git commit hash"""
try:
repo = git.Repo(search_parent_directories=True)
return repo.head.commit.hexsha[:6]
except Exception:
return "unknown"
# Initialize Square client
client = AsyncSquare(token=get_sq_env.SQUARE_TOKEN, environment=get_sq_env.environment)
+2
View File
@@ -83,6 +83,8 @@ async def get_stats():
return {
"status": "success",
"version": "0.3.0",
"git_commit": stats.get_git_commit(),
"stats": daily_stats,
"completion_rate": round(completion_rate, 1),
"brickset_cache": cache_stats,