Files
uj-mastering-master/pyproject.toml
T
irene 5df802a574 Add web UI: same backend, browser front end
Reuses the analysis backend unchanged. metrics.py already split compute()
from build_spec(), and plotspec.PlotSpec is backend-agnostic, so the web UI
reimplements only the renderer: uPlot for curves/bands, a canvas for the
spectrogram heatmap. No PyQt5, pyqtgraph or matplotlib on the web path.

Uploaded audio is never persisted on the host. The browser copies each file
into Origin Private File System (sandboxed browser storage) and streams the
bytes to the server per request; the server spools each body to a temp file,
decodes, computes, and unlinks it in a finally before responding. There is no
upload directory, no cache of audio, and no session state keyed on a path:
file_id is the SHA-256 of the audio, so re-sending a master for another metric
reuses the first decode. Verified: a spool is observable mid-request and gone
after the response.

Being precise: the bytes do have to reach the server, since librosa decodes
from a path and the analysis is CPU-bound numpy/scipy. The claim is that
running this does not accumulate masters on the host, not that audio is never
on the machine mid-request.

New:
  metrics_json.py       PlotSpec/metric data -> JSON (the renderer seam)
  web_session.py        headless analysis session, content-addressed tracks
  webapp.py             FastAPI routes, raw-body analysis, ujm-web entry point
  static/               browser front end + test suite
  scripts/webapi_smoke.py  61 end-to-end assertions against a running server

Also fixes a bug the direct-uvicorn dev loop had hidden: the CLI advertises
logger_setup's WARN level but passed it straight to uvicorn, which only knows
'warning' -- `ujm-web --log-level WARN` died with KeyError: 'warn'.

Removes an earlier /api/collect debug route that served every source module
over HTTP.

pyproject: 'web' extra (fastapi, uvicorn, python-multipart), package-data for
static/, Apache-2.0 licence.
2026-09-14 01:44:48 +09:00

70 lines
1.9 KiB
TOML

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "uj-mastering-master"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
"librosa",
"numpy",
"matplotlib",
"mutagen",
"pyloudnorm",
"PyQt5>=5.15.10",
# 5.15.2 is the only pyqt5-qt5 release with a Windows wheel; later
# versions are Linux/macOS only.
"PyQt5-Qt5==5.15.2 ; sys_platform == 'win32'",
"pyqtgraph>=0.14.0",
]
license = {text = "Apache-2.0"}
[project.optional-dependencies]
# Web front end (the `feature/web-ui` branch). Installed with:
# uv sync --extra web
# Deliberately separate from the desktop path: a server install of the web UI
# needs no Qt/wheel stack, and a desktop install needs no ASGI stack.
web = [
"fastapi>=0.110",
"uvicorn[standard]>=0.27",
"python-multipart>=0.0.9", # multipart upload parsing for FastAPI
]
[project.scripts]
ujm = "main:main"
ujm-web = "webapp:main"
[tool.setuptools]
py-modules = [
"main",
"analysis_results_manager",
"audio_visualization_widget",
"master_core",
"metrics",
"plotspec",
"font_manager",
"plot_control_widget",
"ref_line_widget",
"logger_setup",
"setup_fonts",
# web front end
"webapp",
"web_session",
"metrics_json",
]
[tool.setuptools.package-data]
# Vendored browser assets: uPlot (curves), no CDN at runtime. `webapp.py`
# resolves them relative to `__file__`, so on an installed wheel they must sit
# next to the modules — see `[tool.setuptools.data-files]` for the sdist path.
"*" = ["static/*"]
[tool.setuptools.data-files]
# The web assets live next to the *modules*, not in site-packages/static, so a
# wheel install needs them copied into the package directory. `MANIFEST.in`
# keeps them in the sdist; running from a checkout (the documented path) needs
# neither.
"lib/python-static" = ["static/*"]