Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_process fails when running from .exe console_script entrypoint on windows #696

Closed
2 tasks done
graingert opened this issue Mar 7, 2024 · 21 comments · Fixed by #744
Closed
2 tasks done

run_process fails when running from .exe console_script entrypoint on windows #696

graingert opened this issue Mar 7, 2024 · 21 comments · Fixed by #744
Labels
bug Something isn't working

Comments

@graingert
Copy link
Collaborator

graingert commented Mar 7, 2024

Things to check first

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

AnyIO version

4.3.0

Python version

3.11.3

What happened?

running:

import anyio.to_process

from fastapi import FastAPI


app = FastAPI()

def sync_example():
    return 1

@app.get("/")
async def example() -> int:
    return await anyio.to_process.run_sync(sync_example)

with uvicorn demo:app fails with:

Traceback (most recent call last):
  File "C:\Users\User\uvicron_demo\Lib\site-packages\anyio\to_process.py", line 163, in run_sync
    await send_raw_command(pickled)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\anyio\to_process.py", line 89, in send_raw_command
    raise retval
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\uvicron_demo\\Scripts\\uvicorn.exe\\__main__.py'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\uvicron_demo\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 412, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\uvicron_demo\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\uvicron_demo\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\middleware\errors.py", line 186, in __call__
    raise exc
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\User\uvicron_demo\Lib\site-packages\starlette\routing.py", line 74, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\uvicron_demo\Lib\site-packages\fastapi\routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\uvicron_demo\Lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\demo.py", line 13, in example
    return await anyio.to_process.run_sync(sync_example)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\uvicron_demo\Lib\site-packages\anyio\to_process.py", line 168, in run_sync
    raise BrokenWorkerProcess(
anyio.BrokenWorkerProcess: Error during worker process initialization

How can we reproduce the bug?

see above

@graingert graingert added the bug Something isn't working label Mar 7, 2024
@agronholm
Copy link
Owner

Where should it get the interpreter path then?

@graingert
Copy link
Collaborator Author

sys.executable ?

@adilkhash
Copy link

adilkhash commented Jun 7, 2024

I think the problem is more related to uvicorn rather than to anyio. Try using another asgi web server, for example hypercorn or run you app via main section like this:

if __name__ == '__main__':
    uvicorn.run('app:app', host="0.0.0.0", port=8000)

@agronholm
Copy link
Owner

As stated above, the problem is where to get the path to the interpreter, as sys.executable points to uvicorn.exe.

@adilkhash
Copy link

Then one of the workarounds might be using the following run command:

python -m uvicorn app:app

In this case sys.executable should point to python.exe

@agronholm
Copy link
Owner

Yes, that certainly should work.

@agronholm
Copy link
Owner

One thing that occurred to me: does multiprocessing still work from within a process launched as uvicorn? If so, where does it get the path to the actual Python interpreter?

@agronholm
Copy link
Owner

After digging a while, I saw in multiprocessing/spawn.py that it was doing os.path.join(sys.exec_prefix, 'python.exe'). Probably not a bad choice.

@agronholm
Copy link
Owner

agronholm commented Jun 7, 2024

I did some more digging and turns out, I was completely wrong about where the problem occurs. sys.executable was never the culprit. The problem was that it didn't know where to find the __main__ module. What I do there is getattr(sys.modules["__main__"], "__file__", None), but on Windows, that returns C:\...\uvicorn.exe\__main__.py! Even more bizarre is that if you try the same from the module itself, its __file__ attribute is completely fine.

@agronholm
Copy link
Owner

Right, I keep forgetting that the target function doesn't even live in the __main__ module, so there is no real point in trying to import that module. The subprocess end should check if the path to __main__ exists, and only then try to import it.

@agronholm
Copy link
Owner

Alright, this was a one-liner fix in the end.

@adilkhash
Copy link

Sounds cool, I can test it right away.

@agronholm
Copy link
Owner

I'm struggling a bit to write a failing test right now.

@agronholm
Copy link
Owner

I now understand why it only failed on Windows: __main__.__file__ points to a Python script bin/uvicorn on Linux/macOS, but on Windows, it points to an .exe wrapper which cannot be loaded by the Python import machinery. Thus I believe I need to point __main__.__file__ to an existing file that would fail to be imported.

@agronholm
Copy link
Owner

@adilkhash feel free to test against the linked PR.

@adilkhash
Copy link

adilkhash commented Jun 7, 2024

it works! seems like the new release is coming 😉
thanks

@adilkhash
Copy link

looks like something is wrong, if I press Ctrl+C and KeyboardInterrupt is raised the following exception occurs:


Traceback (most recent call last):
  File "C:\...\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\...\Lib\asyncio\subprocess.py", line 72, in pipe_data_received
    reader.feed_data(data)
  File "C:\...\Lib\asyncio\streams.py", line 477, in feed_data
    assert not self._eof, 'feed_data after feed_eof'
AssertionError: feed_data after feed_eof

@agronholm
Copy link
Owner

Can you share the script you tested with?

@adilkhash
Copy link

adilkhash commented Jun 9, 2024

The one that is listed in this issue.
UPD: sorry, looks like it doesn't relate to that issue.

@agronholm
Copy link
Owner

Ok, so are you able to reproduce this other issue? Can you tell me how?

@adilkhash
Copy link

I am not sure if it is related to anyio at all.

mkjpryor pushed a commit to azimuth-cloud/azimuth that referenced this issue Sep 23, 2024
Bumps [anyio](https://github.com/agronholm/anyio) from 4.4.0 to 4.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/releases">anyio's
releases</a>.</em></p>
<blockquote>
<h2>4.5.0</h2>
<ul>
<li>Improved the performance of <code>anyio.Lock</code> and
<code>anyio.Semaphore</code> on asyncio (even up to 50 %)</li>
<li>Added the <code>fast_acquire</code> parameter to
<code>anyio.Lock</code> and <code>anyio.Semaphore</code> to further
boost performance at the expense of safety (<code>acquire()</code> will
not yield control back if there is no contention)</li>
<li>Added support for the <code>from_uri()</code>,
<code>full_match()</code>, <code>parser</code> methods/properties in
<code>anyio.Path</code>, newly added in Python 3.13 (<a
href="https://redirect.github.com/agronholm/anyio/issues/737">#737</a>)</li>
<li>Added support for more keyword arguments for
<code>run_process()</code> and <code>open_process()</code>:
<code>startupinfo</code>, <code>creationflags</code>,
<code>pass_fds</code>, <code>user</code>, <code>group</code>,
<code>extra_groups</code> and <code>umask</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/742">#742</a>)</li>
<li>Improved the type annotations and support for <code>PathLike</code>
in <code>run_process()</code> and <code>open_process()</code> to allow
for path-like arguments, just like <code>subprocess.Popen</code></li>
<li>Changed the <code>ResourceWarning</code> from an unclosed memory
object stream to include its address for easier identification</li>
<li>Changed <code>start_blocking_portal()</code> to always use daemonic
threads, to accommodate the &quot;loitering event loop&quot; use
case</li>
<li>Bumped the minimum version of Trio to v0.26.1</li>
<li>Fixed <code>__repr__()</code> of
<code>MemoryObjectItemReceiver</code>, when <code>item</code> is not
defined (<a
href="https://redirect.github.com/agronholm/anyio/pulls/767">#767</a>;
PR by <a
href="https://github.com/Danipulok"><code>@​Danipulok</code></a>)</li>
<li>Fixed <code>to_process.run_sync()</code> failing to initialize if
<code>__main__.__file__</code> pointed to a file in a nonexistent
directory (<a
href="https://redirect.github.com/agronholm/anyio/issues/696">#696</a>)</li>
<li>Fixed <code>AssertionError: feed_data after feed_eof</code> on
asyncio when a subprocess is closed early, before its output has been
read (<a
href="https://redirect.github.com/agronholm/anyio/issues/490">#490</a>)</li>
<li>Fixed <code>TaskInfo.has_pending_cancellation()</code> on asyncio
not respecting shielded scopes (<a
href="https://redirect.github.com/agronholm/anyio/issues/771">#771</a>;
PR by <a
href="https://github.com/gschaffner"><code>@​gschaffner</code></a>)</li>
<li>Fixed <code>SocketStream.receive()</code> returning
<code>bytearray</code> instead of <code>bytes</code> when using asyncio
with <code>ProactorEventLoop</code> (Windows) (<a
href="https://redirect.github.com/agronholm/anyio/issues/776">#776</a>)</li>
<li>Fixed quitting the debugger in a pytest test session while in an
active task group failing the test instead of exiting the test session
(because the exit exception arrives in an exception group)</li>
<li>Fixed support for Linux abstract namespaces in UNIX sockets that was
broken in v4.2 (<a
href="https://redirect.github.com/agronholm/anyio/issues/781">#781</a>
&lt;<a
href="https://redirect.github.com/agronholm/anyio/issues/781">agronholm/anyio#781</a>&gt;_;
PR by <a
href="https://github.com/tapetersen"><code>@​tapetersen</code></a>)</li>
<li>Fixed <code>KeyboardInterrupt</code> (ctrl+c) hanging the asyncio
pytest runner</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst">anyio's
changelog</a>.</em></p>
<blockquote>
<h1>Version history</h1>
<p>This library adheres to <code>Semantic Versioning 2.0
&lt;http://semver.org/&gt;</code>_.</p>
<p><strong>4.5.0</strong></p>
<ul>
<li>Improved the performance of <code>anyio.Lock</code> and
<code>anyio.Semaphore</code> on asyncio (even up
to 50 %)</li>
<li>Added the <code>fast_acquire</code> parameter to
<code>anyio.Lock</code> and <code>anyio.Semaphore</code> to
further boost performance at the expense of safety
(<code>acquire()</code> will not yield
control back if there is no contention)</li>
<li>Added support for the <code>from_uri()</code>,
<code>full_match()</code>, <code>parser</code> methods/properties
in <code>anyio.Path</code>, newly added in Python 3.13
(<code>[#737](agronholm/anyio#737)
&lt;https://github.com/agronholm/anyio/issues/737&gt;</code>_)</li>
<li>Added support for more keyword arguments for
<code>run_process()</code> and <code>open_process()</code>:
<code>startupinfo</code>, <code>creationflags</code>,
<code>pass_fds</code>, <code>user</code>, <code>group</code>,
<code>extra_groups</code> and <code>umask</code>
(<code>[#742](agronholm/anyio#742)
&lt;https://github.com/agronholm/anyio/issues/742&gt;</code>_)</li>
<li>Improved the type annotations and support for <code>PathLike</code>
in <code>run_process()</code> and
<code>open_process()</code> to allow for path-like arguments, just like
<code>subprocess.Popen</code></li>
<li>Changed the <code>ResourceWarning</code> from an unclosed memory
object stream to include its
address for easier identification</li>
<li>Changed <code>start_blocking_portal()</code> to always use daemonic
threads, to accommodate the
&quot;loitering event loop&quot; use case</li>
<li>Bumped the minimum version of Trio to v0.26.1</li>
<li>Fixed <code>__repr__()</code> of
<code>MemoryObjectItemReceiver</code>, when <code>item</code> is not
defined
(<code>[#767](agronholm/anyio#767)
&lt;https://github.com/agronholm/anyio/pulls/767&gt;</code>_; PR by <a
href="https://github.com/Danipulok"><code>@​Danipulok</code></a>)</li>
<li>Fixed <code>to_process.run_sync()</code> failing to initialize if
<code>__main__.__file__</code> pointed
to a file in a nonexistent directory
(<code>[#696](agronholm/anyio#696)
&lt;https://github.com/agronholm/anyio/issues/696&gt;</code>_)</li>
<li>Fixed <code>AssertionError: feed_data after feed_eof</code> on
asyncio when a subprocess is
closed early, before its output has been read
(<code>[#490](agronholm/anyio#490)
&lt;https://github.com/agronholm/anyio/issues/490&gt;</code>_)</li>
<li>Fixed <code>TaskInfo.has_pending_cancellation()</code> on asyncio
not respecting shielded
scopes (<code>[#771](agronholm/anyio#771)
&lt;https://github.com/agronholm/anyio/issues/771&gt;</code>_; PR by <a
href="https://github.com/gschaffner"><code>@​gschaffner</code></a>)</li>
<li>Fixed <code>SocketStream.receive()</code> returning
<code>bytearray</code> instead of <code>bytes</code> when
using asyncio with <code>ProactorEventLoop</code> (Windows)
(<code>[#776](agronholm/anyio#776)
&lt;https://github.com/agronholm/anyio/issues/776&gt;</code>_)</li>
<li>Fixed quitting the debugger in a pytest test session while in an
active task group
failing the test instead of exiting the test session (because the exit
exception
arrives in an exception group)</li>
<li>Fixed support for Linux abstract namespaces in UNIX sockets that was
broken in v4.2
(<a
href="https://redirect.github.com/agronholm/anyio/issues/781">#781</a>
<a
href="https://redirect.github.com/agronholm/anyio/issues/781">agronholm/anyio#781</a>_;
PR by <a
href="https://github.com/tapetersen"><code>@​tapetersen</code></a>)</li>
<li>Fixed <code>KeyboardInterrupt</code> (ctrl+c) hanging the asyncio
pytest runner</li>
</ul>
<p><strong>4.4.0</strong></p>
<ul>
<li>Added the <code>BlockingPortalProvider</code> class to aid with
constructing synchronous
counterparts to asynchronous interfaces that would otherwise require
multiple blocking</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/agronholm/anyio/commit/7f35ce79e3eb9db2a2731619b48fe289d8dd872f"><code>7f35ce7</code></a>
Bumped up the version</li>
<li><a
href="https://github.com/agronholm/anyio/commit/108cc8300aa5a0d5be2834a8bbd3eb1938b8c104"><code>108cc83</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/agronholm/anyio/issues/788">#788</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/d1aea98c4f552d04458e49f1484b9c018f2a3ca8"><code>d1aea98</code></a>
Fixed KeyboardInterrupt hanging the asyncio test runner (<a
href="https://redirect.github.com/agronholm/anyio/issues/779">#779</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/c1aff53d8ae5ddc2cf1b8558614a7a2d60c12518"><code>c1aff53</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/agronholm/anyio/issues/785">#785</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/89d8b4c9609e22306c597cea98ecf3fba45fb663"><code>89d8b4c</code></a>
Use sphinx_rtd_theme also as an extension</li>
<li><a
href="https://github.com/agronholm/anyio/commit/4e9f18dfaa6e7db55231a35fcd93e18c343519a4"><code>4e9f18d</code></a>
Enabled uvloop to be used in the test suite on Python 3.13</li>
<li><a
href="https://github.com/agronholm/anyio/commit/7de644113250a817dd3224e6df9b3658cb09802d"><code>7de6441</code></a>
Pin Sphinx to a compatible version with sphinx-rtd-theme</li>
<li><a
href="https://github.com/agronholm/anyio/commit/41647f4ba7389dc756b0401033af1e3f41ad8a60"><code>41647f4</code></a>
Fixed feed_data after feed_eof assertion errors on asyncio (<a
href="https://redirect.github.com/agronholm/anyio/issues/752">#752</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/38890e607c726be6ea29ea2af445e8df43df5725"><code>38890e6</code></a>
Accept abstract namespace paths for unix domain sockets (<a
href="https://redirect.github.com/agronholm/anyio/issues/782">#782</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/0c8ad519e136c4b136b51333863966a445080a97"><code>0c8ad51</code></a>
Delegated the implementations of Lock and Semaphore to the async backend
clas...</li>
<li>Additional commits viewable in <a
href="https://github.com/agronholm/anyio/compare/4.4.0...4.5.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=anyio&package-manager=pip&previous-version=4.4.0&new-version=4.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mkjpryor pushed a commit to azimuth-cloud/cluster-api-addon-provider that referenced this issue Sep 26, 2024
Bumps [anyio](https://github.com/agronholm/anyio) from 4.4.0 to 4.6.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/releases">anyio's
releases</a>.</em></p>
<blockquote>
<h2>4.6.0</h2>
<ul>
<li>Dropped support for Python 3.8 (as <a
href="https://redirect.github.com/agronholm/anyio/issues/698">#698</a>
cannot be resolved without cancel message support)</li>
<li>Fixed 100% CPU use on asyncio while waiting for an exiting task
group to finish while said task group is within a cancelled cancel scope
(<a
href="https://redirect.github.com/agronholm/anyio/issues/695">#695</a>)</li>
<li>Fixed cancel scopes on asyncio not propagating
<code>CancelledError</code> on exit when the enclosing cancel scope has
been effectively cancelled (<a
href="https://redirect.github.com/agronholm/anyio/issues/698">#698</a>)</li>
<li>Fixed asyncio task groups not yielding control to the event loop at
exit if there were no child tasks to wait on</li>
<li>Fixed inconsistent task uncancellation with asyncio cancel scopes
belonging to a task group when said task group has child tasks
running</li>
</ul>
<h2>4.5.0</h2>
<ul>
<li>Improved the performance of <code>anyio.Lock</code> and
<code>anyio.Semaphore</code> on asyncio (even up to 50 %)</li>
<li>Added the <code>fast_acquire</code> parameter to
<code>anyio.Lock</code> and <code>anyio.Semaphore</code> to further
boost performance at the expense of safety (<code>acquire()</code> will
not yield control back if there is no contention)</li>
<li>Added support for the <code>from_uri()</code>,
<code>full_match()</code>, <code>parser</code> methods/properties in
<code>anyio.Path</code>, newly added in Python 3.13 (<a
href="https://redirect.github.com/agronholm/anyio/issues/737">#737</a>)</li>
<li>Added support for more keyword arguments for
<code>run_process()</code> and <code>open_process()</code>:
<code>startupinfo</code>, <code>creationflags</code>,
<code>pass_fds</code>, <code>user</code>, <code>group</code>,
<code>extra_groups</code> and <code>umask</code> (<a
href="https://redirect.github.com/agronholm/anyio/issues/742">#742</a>)</li>
<li>Improved the type annotations and support for <code>PathLike</code>
in <code>run_process()</code> and <code>open_process()</code> to allow
for path-like arguments, just like <code>subprocess.Popen</code></li>
<li>Changed the <code>ResourceWarning</code> from an unclosed memory
object stream to include its address for easier identification</li>
<li>Changed <code>start_blocking_portal()</code> to always use daemonic
threads, to accommodate the &quot;loitering event loop&quot; use
case</li>
<li>Bumped the minimum version of Trio to v0.26.1</li>
<li>Fixed <code>__repr__()</code> of
<code>MemoryObjectItemReceiver</code>, when <code>item</code> is not
defined (<a
href="https://redirect.github.com/agronholm/anyio/pulls/767">#767</a>;
PR by <a
href="https://github.com/Danipulok"><code>@​Danipulok</code></a>)</li>
<li>Fixed <code>to_process.run_sync()</code> failing to initialize if
<code>__main__.__file__</code> pointed to a file in a nonexistent
directory (<a
href="https://redirect.github.com/agronholm/anyio/issues/696">#696</a>)</li>
<li>Fixed <code>AssertionError: feed_data after feed_eof</code> on
asyncio when a subprocess is closed early, before its output has been
read (<a
href="https://redirect.github.com/agronholm/anyio/issues/490">#490</a>)</li>
<li>Fixed <code>TaskInfo.has_pending_cancellation()</code> on asyncio
not respecting shielded scopes (<a
href="https://redirect.github.com/agronholm/anyio/issues/771">#771</a>;
PR by <a
href="https://github.com/gschaffner"><code>@​gschaffner</code></a>)</li>
<li>Fixed <code>SocketStream.receive()</code> returning
<code>bytearray</code> instead of <code>bytes</code> when using asyncio
with <code>ProactorEventLoop</code> (Windows) (<a
href="https://redirect.github.com/agronholm/anyio/issues/776">#776</a>)</li>
<li>Fixed quitting the debugger in a pytest test session while in an
active task group failing the test instead of exiting the test session
(because the exit exception arrives in an exception group)</li>
<li>Fixed support for Linux abstract namespaces in UNIX sockets that was
broken in v4.2 (<a
href="https://redirect.github.com/agronholm/anyio/issues/781">#781</a>
&lt;<a
href="https://redirect.github.com/agronholm/anyio/issues/781">agronholm/anyio#781</a>&gt;_;
PR by <a
href="https://github.com/tapetersen"><code>@​tapetersen</code></a>)</li>
<li>Fixed <code>KeyboardInterrupt</code> (ctrl+c) hanging the asyncio
pytest runner</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst">anyio's
changelog</a>.</em></p>
<blockquote>
<h1>Version history</h1>
<p>This library adheres to <code>Semantic Versioning 2.0
&lt;http://semver.org/&gt;</code>_.</p>
<p><strong>4.6.0</strong></p>
<ul>
<li>Dropped support for Python 3.8
(as <code>[#698](agronholm/anyio#698)
&lt;https://github.com/agronholm/anyio/issues/698&gt;</code>_ cannot be
resolved
without cancel message support)</li>
<li>Fixed 100% CPU use on asyncio while waiting for an exiting task
group to finish while
said task group is within a cancelled cancel scope
(<code>[#695](agronholm/anyio#695)
&lt;https://github.com/agronholm/anyio/issues/695&gt;</code>_)</li>
<li>Fixed cancel scopes on asyncio not propagating
<code>CancelledError</code> on exit when the
enclosing cancel scope has been effectively cancelled
(<code>[#698](agronholm/anyio#698)
&lt;https://github.com/agronholm/anyio/issues/698&gt;</code>_)</li>
<li>Fixed asyncio task groups not yielding control to the event loop at
exit if there were
no child tasks to wait on</li>
<li>Fixed inconsistent task uncancellation with asyncio cancel scopes
belonging to a
task group when said task group has child tasks running</li>
</ul>
<p><strong>4.5.0</strong></p>
<ul>
<li>Improved the performance of <code>anyio.Lock</code> and
<code>anyio.Semaphore</code> on asyncio (even up
to 50 %)</li>
<li>Added the <code>fast_acquire</code> parameter to
<code>anyio.Lock</code> and <code>anyio.Semaphore</code> to
further boost performance at the expense of safety
(<code>acquire()</code> will not yield
control back if there is no contention)</li>
<li>Added support for the <code>from_uri()</code>,
<code>full_match()</code>, <code>parser</code> methods/properties
in <code>anyio.Path</code>, newly added in Python 3.13
(<code>[#737](agronholm/anyio#737)
&lt;https://github.com/agronholm/anyio/issues/737&gt;</code>_)</li>
<li>Added support for more keyword arguments for
<code>run_process()</code> and <code>open_process()</code>:
<code>startupinfo</code>, <code>creationflags</code>,
<code>pass_fds</code>, <code>user</code>, <code>group</code>,
<code>extra_groups</code> and <code>umask</code>
(<code>[#742](agronholm/anyio#742)
&lt;https://github.com/agronholm/anyio/issues/742&gt;</code>_)</li>
<li>Improved the type annotations and support for <code>PathLike</code>
in <code>run_process()</code> and
<code>open_process()</code> to allow for path-like arguments, just like
<code>subprocess.Popen</code></li>
<li>Changed the <code>ResourceWarning</code> from an unclosed memory
object stream to include its
address for easier identification</li>
<li>Changed <code>start_blocking_portal()</code> to always use daemonic
threads, to accommodate the
&quot;loitering event loop&quot; use case</li>
<li>Bumped the minimum version of Trio to v0.26.1</li>
<li>Fixed <code>__repr__()</code> of
<code>MemoryObjectItemReceiver</code>, when <code>item</code> is not
defined
(<code>[#767](agronholm/anyio#767)
&lt;https://github.com/agronholm/anyio/pulls/767&gt;</code>_; PR by <a
href="https://github.com/Danipulok"><code>@​Danipulok</code></a>)</li>
<li>Fixed <code>to_process.run_sync()</code> failing to initialize if
<code>__main__.__file__</code> pointed
to a file in a nonexistent directory
(<code>[#696](agronholm/anyio#696)
&lt;https://github.com/agronholm/anyio/issues/696&gt;</code>_)</li>
<li>Fixed <code>AssertionError: feed_data after feed_eof</code> on
asyncio when a subprocess is
closed early, before its output has been read
(<code>[#490](agronholm/anyio#490)
&lt;https://github.com/agronholm/anyio/issues/490&gt;</code>_)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/agronholm/anyio/commit/8cce74917ffc7523203ab44862f20fd61f065cc5"><code>8cce749</code></a>
Bumped up the version</li>
<li><a
href="https://github.com/agronholm/anyio/commit/01a37c603d55605e0d6f21b7d43828f4738c7a3d"><code>01a37c6</code></a>
Fixed TaskGroup and CancelScope exit issues on asyncio (<a
href="https://redirect.github.com/agronholm/anyio/issues/774">#774</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/7f35ce79e3eb9db2a2731619b48fe289d8dd872f"><code>7f35ce7</code></a>
Bumped up the version</li>
<li><a
href="https://github.com/agronholm/anyio/commit/108cc8300aa5a0d5be2834a8bbd3eb1938b8c104"><code>108cc83</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/agronholm/anyio/issues/788">#788</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/d1aea98c4f552d04458e49f1484b9c018f2a3ca8"><code>d1aea98</code></a>
Fixed KeyboardInterrupt hanging the asyncio test runner (<a
href="https://redirect.github.com/agronholm/anyio/issues/779">#779</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/c1aff53d8ae5ddc2cf1b8558614a7a2d60c12518"><code>c1aff53</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/agronholm/anyio/issues/785">#785</a>)</li>
<li><a
href="https://github.com/agronholm/anyio/commit/89d8b4c9609e22306c597cea98ecf3fba45fb663"><code>89d8b4c</code></a>
Use sphinx_rtd_theme also as an extension</li>
<li><a
href="https://github.com/agronholm/anyio/commit/4e9f18dfaa6e7db55231a35fcd93e18c343519a4"><code>4e9f18d</code></a>
Enabled uvloop to be used in the test suite on Python 3.13</li>
<li><a
href="https://github.com/agronholm/anyio/commit/7de644113250a817dd3224e6df9b3658cb09802d"><code>7de6441</code></a>
Pin Sphinx to a compatible version with sphinx-rtd-theme</li>
<li><a
href="https://github.com/agronholm/anyio/commit/41647f4ba7389dc756b0401033af1e3f41ad8a60"><code>41647f4</code></a>
Fixed feed_data after feed_eof assertion errors on asyncio (<a
href="https://redirect.github.com/agronholm/anyio/issues/752">#752</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/agronholm/anyio/compare/4.4.0...4.6.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=anyio&package-manager=pip&previous-version=4.4.0&new-version=4.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mkjpryor pushed a commit to azimuth-cloud/azimuth that referenced this issue Oct 4, 2024
Bumps [anyio](https://github.com/agronholm/anyio) from 4.5.0 to 4.6.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/releases">anyio's
releases</a>.</em></p>
<blockquote>
<h2>4.6.0</h2>
<ul>
<li>Dropped support for Python 3.8 (as <a
href="https://redirect.github.com/agronholm/anyio/issues/698">#698</a>
cannot be resolved without cancel message support)</li>
<li>Fixed 100% CPU use on asyncio while waiting for an exiting task
group to finish while said task group is within a cancelled cancel scope
(<a
href="https://redirect.github.com/agronholm/anyio/issues/695">#695</a>)</li>
<li>Fixed cancel scopes on asyncio not propagating
<code>CancelledError</code> on exit when the enclosing cancel scope has
been effectively cancelled (<a
href="https://redirect.github.com/agronholm/anyio/issues/698">#698</a>)</li>
<li>Fixed asyncio task groups not yielding control to the event loop at
exit if there were no child tasks to wait on</li>
<li>Fixed inconsistent task uncancellation with asyncio cancel scopes
belonging to a task group when said task group has child tasks
running</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst">anyio's
changelog</a>.</em></p>
<blockquote>
<h1>Version history</h1>
<p>This library adheres to <code>Semantic Versioning 2.0
&lt;http://semver.org/&gt;</code>_.</p>
<p><strong>4.6.0</strong></p>
<ul>
<li>Dropped support for Python 3.8
(as <code>[#698](agronholm/anyio#698)
&lt;https://github.com/agronholm/anyio/issues/698&gt;</code>_ cannot be
resolved
without cancel message support)</li>
<li>Fixed 100% CPU use on asyncio while waiting for an exiting task
group to finish while
said task group is within a cancelled cancel scope
(<code>[#695](agronholm/anyio#695)
&lt;https://github.com/agronholm/anyio/issues/695&gt;</code>_)</li>
<li>Fixed cancel scopes on asyncio not propagating
<code>CancelledError</code> on exit when the
enclosing cancel scope has been effectively cancelled
(<code>[#698](agronholm/anyio#698)
&lt;https://github.com/agronholm/anyio/issues/698&gt;</code>_)</li>
<li>Fixed asyncio task groups not yielding control to the event loop at
exit if there were
no child tasks to wait on</li>
<li>Fixed inconsistent task uncancellation with asyncio cancel scopes
belonging to a
task group when said task group has child tasks running</li>
</ul>
<p><strong>4.5.0</strong></p>
<ul>
<li>Improved the performance of <code>anyio.Lock</code> and
<code>anyio.Semaphore</code> on asyncio (even up
to 50 %)</li>
<li>Added the <code>fast_acquire</code> parameter to
<code>anyio.Lock</code> and <code>anyio.Semaphore</code> to
further boost performance at the expense of safety
(<code>acquire()</code> will not yield
control back if there is no contention)</li>
<li>Added support for the <code>from_uri()</code>,
<code>full_match()</code>, <code>parser</code> methods/properties
in <code>anyio.Path</code>, newly added in Python 3.13
(<code>[#737](agronholm/anyio#737)
&lt;https://github.com/agronholm/anyio/issues/737&gt;</code>_)</li>
<li>Added support for more keyword arguments for
<code>run_process()</code> and <code>open_process()</code>:
<code>startupinfo</code>, <code>creationflags</code>,
<code>pass_fds</code>, <code>user</code>, <code>group</code>,
<code>extra_groups</code> and <code>umask</code>
(<code>[#742](agronholm/anyio#742)
&lt;https://github.com/agronholm/anyio/issues/742&gt;</code>_)</li>
<li>Improved the type annotations and support for <code>PathLike</code>
in <code>run_process()</code> and
<code>open_process()</code> to allow for path-like arguments, just like
<code>subprocess.Popen</code></li>
<li>Changed the <code>ResourceWarning</code> from an unclosed memory
object stream to include its
address for easier identification</li>
<li>Changed <code>start_blocking_portal()</code> to always use daemonic
threads, to accommodate the
&quot;loitering event loop&quot; use case</li>
<li>Bumped the minimum version of Trio to v0.26.1</li>
<li>Fixed <code>__repr__()</code> of
<code>MemoryObjectItemReceiver</code>, when <code>item</code> is not
defined
(<code>[#767](agronholm/anyio#767)
&lt;https://github.com/agronholm/anyio/pulls/767&gt;</code>_; PR by <a
href="https://github.com/Danipulok"><code>@​Danipulok</code></a>)</li>
<li>Fixed <code>to_process.run_sync()</code> failing to initialize if
<code>__main__.__file__</code> pointed
to a file in a nonexistent directory
(<code>[#696](agronholm/anyio#696)
&lt;https://github.com/agronholm/anyio/issues/696&gt;</code>_)</li>
<li>Fixed <code>AssertionError: feed_data after feed_eof</code> on
asyncio when a subprocess is
closed early, before its output has been read
(<code>[#490](agronholm/anyio#490)
&lt;https://github.com/agronholm/anyio/issues/490&gt;</code>_)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/agronholm/anyio/commit/8cce74917ffc7523203ab44862f20fd61f065cc5"><code>8cce749</code></a>
Bumped up the version</li>
<li><a
href="https://github.com/agronholm/anyio/commit/01a37c603d55605e0d6f21b7d43828f4738c7a3d"><code>01a37c6</code></a>
Fixed TaskGroup and CancelScope exit issues on asyncio (<a
href="https://redirect.github.com/agronholm/anyio/issues/774">#774</a>)</li>
<li>See full diff in <a
href="https://github.com/agronholm/anyio/compare/4.5.0...4.6.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=anyio&package-manager=pip&previous-version=4.5.0&new-version=4.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants