asgiref icon indicating copy to clipboard operation
asgiref copied to clipboard

document Local()

Open collinanderson opened this issue 4 years ago • 5 comments

Hi All,

Currently there's a hint in the readme that asgiref provides thread locals, but they're undocumented as far as I can tell.

Thanks! Collin

collinanderson avatar Apr 08 '21 15:04 collinanderson

Ah yes, excellent point. They are mostly drop-in for threading.Local, but it is likely wise to explain the differences.

andrewgodwin avatar Apr 08 '21 16:04 andrewgodwin

Honestly, all I really need to know is how to import it. Currently the docs say there's a module that provides a drop-in replacement, but doesn't say what the name of the module is so I can import it.

collinanderson avatar Apr 08 '21 18:04 collinanderson

Basically, anywhere you would write:

from threading import Local

you can instead write

from asgiref.local import Local

and it will work the same, with the same API, except it will differentiate based on coroutine rather than just by thread.

andrewgodwin avatar Apr 08 '21 18:04 andrewgodwin

Right, yeah exactly. What you just said should probably be added to the readme and/or documentation.

collinanderson avatar Apr 08 '21 18:04 collinanderson

Hello, I would like to contribute. How to get started?

yusharth avatar Oct 23 '21 10:10 yusharth