On Fri, Aug 17, 2018, 12:12 Chris Jerdonek <chris.jerdo...@gmail.com> wrote:
> If I'm reading the docs correctly, it looks like an async library has > to depend on sniffio in order to be detected by sniffio: > > https://sniffio.readthedocs.io/en/latest/#adding-support-to-a-new-async-library If you don't want to depend then you can do the traditional try: import sniffio except ImportError: have_sniffio = False else: have_sniffio = True dance. For trio I was lazy and just made it a dependency because the sniffio wheel is a whopping 4 kilobytes. But there's no problem with doing that if you want. > Did you also think about whether it would be possible for a library to > advertise itself without having to depend on a third-party library > (e.g. using some sort of convention)? That would permit a less > "centralized" approach. > What kind of convention do you have in mind? The problem with a convention AFAICT is that you need some shared agreement about where to rendezvous. That's basically all the sniffio library is: a shared, neutral place for libraries to advertise themselves. (Plus a fallback for detecting asyncio, because stdlib libraries have special constraints.) -n
_______________________________________________ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/