Add sonilo-video-kit: Python companion package (ffmpeg video-soundtrack helpers) - #7
Merged
Conversation
…t timeout - assert_safe_download_url now canonicalizes decimal/hex/octal integer hosts and trailing-dot dotted-quads before the IP-literal check, matching what a WHATWG URL parser (JS's `new URL()`) does before ducking-api.ts's isIpLiteralHost ever runs. Previously urlsplit()+ipaddress.ip_address let 0x7f000001 / 2130706433 / 017700000001 / 127.0.0.1. / 0xA9FEA9FE (169.254.169.254) straight through. - download_ducked_mix now bounds each attempt's WALL-CLOCK lifetime inside the streaming loop, not just httpx's inter-chunk read timeout (which resets on every byte and never trips for a slow-loris server). - download_ducked_mix now treats any response >= 300 (not just >= 400) as a download failure, since follow_redirects=False returns a 3xx as an ordinary response rather than raising (unlike JS's redirect:"error").
…es; note AAC container and refunded semantics
Sapient docs evalsWaiting for the staging docs URL before running evals. Sapient will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes. Commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
sonilo-video-kit— Python companion packageA faithful, sync Python port of the JavaScript
sonilo-video-kit, added to this repo as a second, independently-published package. The coresoniloclient is untouched.What it is
sonilo-video-kit(importsonilo_video_kit) ships local ffmpeg-based video-soundtrack helpers on top of thesoniloclient, giving Python the same three capabilities as the JS package:generate_music_for_video— generate a soundtrack for a video (wrapsvideo_to_music).mix_with_video— loudness-matched local mix (ffmpeg), delivery-normalized to −14 LUFS.duck_music_under_speech— ride the music under speech via the Sonilo ducking API.Cross-language parity:
pip install sonilo-video-kitmirrorsnpm install sonilo-video-kit.Design
sonilo-video-kit/with its ownpyproject.toml(hatchling),version = 0.1.0,requires-python = ">=3.9",dependencies = ["sonilo>=0.3,<0.4"]. The publishedsonilocore is not modified.signal/fetchoptions dropped.loudness.pyconstants are a byte-for-byte port of the JSloudness.ts. The ffmpeg layer shells out viasubprocess(no extra runtime deps). The ducking transport is self-contained (the core client has no ducking resource), reusing the client's authenticatedhttpxtransport for submit/poll and a separate unauthenticated client for the download..local/.internal), a streaming download byte cap with an expected-bytes floor and a per-attempt wall-clock timeout, a JSON body cap, and submit-never-retried (it charges the account).Verification
Clean-room fresh-venv install; 52 companion tests pass and the 143 core tests remain green (core unaffected).
python -m build sonilo-video-kitproduces thesonilo_video_kit-0.1.0sdist + wheel.CI / release
ci.ymlextended to install and test both packages (Python 3.9/3.12, ffmpeg).publish-video-kit.yml: tag-triggered (sonilo-video-kit-v*) publish to PyPI via OIDC trusted publishing, with a tag↔version guard andskip-existing. Merging this PR does not publish — only pushing the release tag does.Required before the first publish (manual)
Configure a PyPI pending trusted publisher for the new project
sonilo-video-kit(ownersonilo-ai, reposonilo-python, workflowpublish-video-kit.yml) — this lets OIDC create the new project tokenlessly. Then tagsonilo-video-kit-v0.1.0to publish.🤖 Generated with Claude Code