The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-6946-e7cd5b1ee030908455b65c79defc9c98e60a9372
 has succeeded.
Run started by GitHub user aicam (triggered by aicam).

Head commit for run:
d8bb0f180fa0ea12f25babd5af5dd24e316c3477 / ali risheh <[email protected]>
refactor(pyamber): replace PyFilesystem2 with tempfile and unpin setuptools 
(#6946)

### What changes were proposed in this PR?

Implements the migration planned in #6917: `ExecutorManager` drops `fs`
(PyFilesystem2) for stdlib `tempfile`, and `setuptools` is unpinned. The
issue covers the rationale, the before/after shape, the required
footprint, and the alternatives that were ruled out — this description
only covers what it doesn't.

**Two behaviours `fs` was providing implicitly, now explicit.** Both
came out of review:

- **Encoding.** `OSFS.open` defaults to `encoding="utf-8"` with
`newline=""`; the builtin `open()` uses the locale encoding and
translates newlines. Since `importlib` always decodes source as UTF-8
(PEP 3120), a UDF containing non-ASCII text would have failed at *write*
time under a non-UTF-8 locale. The write is now pinned to
`encoding="utf-8", newline="\n"`, with a regression test.
- **Reclaim on GC.** `FS.__del__` → `TempFS.close()` → `clean()` meant
an `ExecutorManager` abandoned without `close()` still had its directory
removed when collected. A bare `mkdtemp` would have turned that into a
permanent leak, so the `TemporaryDirectory` handle is held on the
instance and `close()` calls `cleanup()`. Force kill runs no finalizers
either way — that case is unchanged, and is what the long-standing TODO
in `tmp_dir` is about.

**Not included:** `importlib.invalidate_caches()`. This branch carried
its own copy; #7173 landed the same fix on `main` first, and the hunks
merge cleanly into a doubled call. Dropped on rebase in favour of what's
on `main`.

### Any related issues, documentation, discussions?

Closes #6917. Supersedes #6911 (the setuptools v83 bump — closed, it
could not merge while `fs` was present) and #6412 (`setuptools<82`, the
interim bound). Same goal as #6928 (closed); the non-ASCII round-trip
test is lifted from it. Original pin: #4199, re-affirmed by the #6110
pin audit.

### How was this PR tested?

Rebased onto `main` (`e7cd5b1`) and re-verified on Python 3.12 in a
clean venv built from `amber/requirements.txt` +
`amber/dev-requirements.txt`, proto bindings generated via
`bin/python-proto-gen.sh`. `import fs` in that venv raises
`ModuleNotFoundError`, confirming nothing reaches it.

- `pytest -m "not integration"` → **997 passed, 1 deselected, 1
xfailed**. Exercises `ExecutorManager` directly and end to end through
UDF loading (`pytexera/udf/`, `test_initialize_executor_handler.py`,
`test_update_executor_handler.py`, `runnables/test_main_loop.py`).
`test_executor_manager.py` run 5× consecutively → 25 passed each time.
- The encoding regression test was checked in both directions under
`LC_ALL=C PYTHONCOERCECLOCALE=0 PYTHONUTF8=0` (interpreter reports
`preferred: ANSI_X3.4-1968`): passes with the fix, and fails with
`UnicodeEncodeError: 'ascii' codec can't encode characters in position
70-73` without it. CI runners are UTF-8, so this would not have been
caught there.
- `ruff check` and `ruff format --check` over `src/main/python
src/test/python` → clean.
- License drift, the same check CI runs: `pip-licenses` over the runtime
closure + `bin/licensing/check_binary_deps.py
--ignore-transitive-version python` → `OK: 109 Python packages match
LICENSE-binary`. Running that same package list against `main`'s
`LICENSE-binary-python` reports exactly `STALE: appdirs==1.4.4,
fs==2.4.16` — the removals here are precisely what's required, and
nothing more.
- The unpin was checked independently of torch: a
`requirements.txt`-only venv on 3.12 ships **no** `setuptools` or
`pkg_resources` at all, and importing every runtime dependency with both
names blocked from `sys.meta_path` raises nothing.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/30845952433

With regards,
GitHub Actions via GitBox

Reply via email to