tractor icon indicating copy to clipboard operation
tractor copied to clipboard

`trio.Process` deprecations

Open goodboy opened this issue 3 years ago • 1 comments

trio changed it's subprocess API as per the large discussion in https://github.com/python-trio/trio/issues/1104.

Summary:

  • they dropped the Process.aclose() behaviour due to it being "surprising", prone to bugs and,

    Process.aclose was always just a convenience wrapper around other existing public APIs, and that hasn't changed. as per comment: https://github.com/python-trio/trio/pull/1568#discussion_r668920523

  • changed the run_process() API to allow for calling via a process = await nursery.start(run_process, ...) style and a new deliver_cancel() callback api from: https://github.com/python-trio/trio/pull/1568
    • i commented here, and this might be a way for us to simplify our implementation by leveraging the now existing shielded-nursery-spawns-killer-task style which is more or less what we implemented before this APi landed: https://github.com/python-trio/trio/pull/1568#pullrequestreview-551374713
      • currently the default impls don't close the stdstreams on a hard kill? I'll be copying that in from the old Process.aclose() in the interim.
home/goodboy/repos/tractor/tractor/_spawn.py:191: TrioDeprecationWarning: using trio.Process as an async context manager is deprecated since Trio 0.20.0; use run_process or nursery.start(run_process, ...) instead (https://github.com/python-trio/trio/issues/1104)
  async with proc:  # calls ``trio.Process.aclose()``
/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_abc.py:261: TrioDeprecationWarning: trio.Process.aclose is deprecated since Trio 0.20.0; use run_process or nursery.start(run_process, ...) instead (https://github.com/python-trio/trio/issues/1104)
  await self.aclose()

Mostly comprehensive list of related trio issues & PRs:

  • https://github.com/python-trio/trio/issues/1104
  • https://github.com/python-trio/trio/pull/1525
  • https://github.com/python-trio/trio/issues/1209
  • https://github.com/python-trio/trio/pull/1568#discussion_r668920523
  • https://github.com/python-trio/trio/issues/1104

goodboy avatar Oct 07 '22 18:10 goodboy

I guess #356 mostly resolved any issues for this.

Not sure if we should close it yet though?

goodboy avatar Jul 17 '25 22:07 goodboy