Skip to content

ci: ban sys.path edits in Python; remove all 35 - #2311

Merged
zackees merged 2 commits into
masterfrom
ci/ban-sys-path
Oct 25, 2026
Merged

zackees merged 2 commits into
masterfrom
ci/ban-sys-path

Conversation

@zackees

@zackees zackees commented Oct 25, 2026

Copy link
Copy Markdown
Member

Maintainer request: a sys.path.insert(0, ...) usually means a script isn't run through uv run, so it should fail lint. Part of #2294's cleanup.

  • RED (first commit): ci/test_no_sys_path_edits.py, which runs in ./lint through the ci/ self-tests. It's an AST check over every tracked .py (except deps/, plugins/obs-websocket/, plugins/obs-browser/) for sys.path.insert/append/extend/..., assignment, augmented assignment and slice assignment. Comments don't match, and the detector has its own test. It failed on 35 sites.
  • GREEN:
    • The 31 inserts of the ci/ directory are removed. A script run with uv run ci/x.py already has its own directory as sys.path[0], and unittest discover -s ci adds ci/. Stale # noqa: E402 markers and unused import sys lines go with them.
    • rust/tools/benchmarks/recording.py, test/packaged-startup.py and rust/obs-build/tests/libobs/websocket_probe.py load obsws and recording_evidence_check by file path through importlib.
  • ./lint passes except test_local_gate_probe.py, which fails on master too for hosts with soldr ≥ 0.9.41. ci: soldr 0.9.42 verdict ledger; native Dylint beside Clippy (#2293) #2309 fixes it.

ci/ scripts already have their own directory first on sys.path when run
with uv run, and unittest discover -s ci puts ci/ there, so the 31
inserts of the ci directory were redundant. The three modules loaded
from another directory (obsws from test/websocket-tier4, the recording
evidence check) are imported by path with importlib instead.
@zackees
zackees added this pull request to the merge queue Oct 25, 2026
Merged via the queue into master with commit f8d5620 Oct 25, 2026
30 checks passed
zackees added a commit that referenced this pull request Oct 25, 2026
#2311 (now on master) bans sys.path edits; the merge group failed
test_no_sys_path_edits on ci/test_deb_asset_name.py:17.
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 25, 2026
…t#2330)

* ci: Test that the Qt lane's unittest command imports its modules (RED)

Since obs-rust#2311 no test puts ci/ on sys.path, so the Qt Frontend Linux lane's
'python -m unittest ci.test_...' fails with ModuleNotFoundError:
platform_ifdef_ratchet on every frontend PR.

* ci: Put ci/ on PYTHONPATH for the Qt lane's unittest command (GREEN)

The real-Qt tests import their ci/ siblings (platform_ifdef_ratchet,
test_settings_platform_facade) by name, which obs-rust#2311 left to the caller.
Fixes the Qt Frontend Linux lane on every frontend PR.
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 25, 2026
* ci: Test that the .deb asset names its Ubuntu release (RED)

Refs obs-rust#2297

* release: Name the .deb after the Ubuntu release it needs (GREEN)

The asset was OBS-Studio-Rust-<ver>-linux-x86_64.deb, which reads as
the Linux .deb, but dpkg-shlibdeps pins it to the build runner's Ubuntu
26.04 libraries. Name it <ver>-ubuntu-26.04-x86_64.deb from the runner's
os-release, and say 26.04 only in the release body.

Fixes obs-rust#2297

* ci: Import release_decision without editing sys.path (obs-rust#2311)
@zackees
zackees deleted the ci/ban-sys-path branch October 26, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant