Re: [Twisted-Python] [ANN] thimble 0.1.0

2014-05-20 Thread Glyph

On May 19, 2014, at 2:29 AM, Laurens Van Houtven _...@lvh.io wrote:

 On Mon, May 19, 2014 at 12:19 AM, Glyph gl...@twistedmatrix.com wrote:
 I think this is the sort of thing that should move into Twisted itself, 
 eventually.  Thoughts?
 
 I agree! There's a few things I'd like to work out with the freedom to break 
 things of a v0.x.x semver version before that happens though.

Oh, definitely.  Hence: eventually.

 Notably, this thing assumes that all attribute accesses are thread-safe and 
 synchronous. That's often true, but hey, this is Python, so you get to do 
 whatever you want when you access an attribute (and @property even makes it 
 easy to do so). Also because right now I'm suggesting a pool with a singled 
 thread for synchronized access to an object that isn't thread safe; 
 especially if you *know* the object isn't thread safe you probably want 
 something to take care of attribute access too :-)

Just write a decorator that programmatically verifies that everything about the 
attribute it's decorating is thread-safe.  Simple!  ;-)

-g___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] [ANN] thimble 0.1.0

2014-05-19 Thread Laurens Van Houtven
On Mon, May 19, 2014 at 12:19 AM, Glyph gl...@twistedmatrix.com wrote:

 I think this is the sort of thing that should move into Twisted itself,
 eventually.  Thoughts?


I agree! There's a few things I'd like to work out with the freedom to
break things of a v0.x.x semver version before that happens though.

Notably, this thing assumes that all attribute accesses are thread-safe and
synchronous. That's often true, but hey, this is Python, so you get to do
whatever you want when you access an attribute (and @property even makes it
easy to do so). Also because right now I'm suggesting a pool with a singled
thread for synchronized access to an object that isn't thread safe;
especially if you *know* the object isn't thread safe you probably want
something to take care of attribute access too :-)

hth
lvh
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] [ANN] thimble 0.1.0

2014-05-18 Thread Glyph
On May 17, 2014, at 6:53 AM, Laurens Van Houtven _...@lvh.io wrote:

 Hi everyone!

 thimble is a library that makes it easy to wrap blocking objects with a 
 thread pool to give you an async API. In particular, it lets you selectively 
 wrap blocking methods, and takes an explicit reactor and thread pool, making 
 it at least slightly harder to do the obvious but potentially bad thing and 
 tricky to test thing (global reactor state, using the reactor thread pool). 

Thanks for putting this together.

 (It's a thimble because it lets you play with threads without pricking 
 yourself :-))

I love the name, and the rationale :).

 This is a small library: it doesn't really fix any big engineering problems, 
 and that's okay. It just removes a bunch of boilerplate I've seen in many a 
 Twisted software project, usually boilerplate that's implemented using the 
 suboptimal methods described above.

I think this is the sort of thing that should move into Twisted itself, 
eventually.  Thoughts?

 The README should run you through it real quick: 
 https://pypi.python.org/pypi/thimble
 
 This is just an early release. I expect that the documentation isn't good 
 enough to get best practices out the door, particularly in setting up thread 
 pools. I think it's pretty decent and probably already worth a look, though 
 :-)
 
 Thanks to Rackspace for letting me write it open source  on company time :-)
 
 hth
 lvh
 
 ___
 Twisted-Python mailing list
 Twisted-Python@twistedmatrix.com
 http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] [ANN] thimble 0.1.0

2014-05-17 Thread Laurens Van Houtven
Hi everyone!


thimble is a library that makes it easy to wrap blocking objects with a
thread pool to give you an async API. In particular, it lets you
selectively wrap blocking methods, and takes an explicit reactor and thread
pool, making it at least slightly harder to do the obvious but potentially
bad thing and tricky to test thing (global reactor state, using the reactor
thread pool).

(It's a thimble because it lets you play with threads without pricking
yourself :-))

This is a small library: it doesn't really fix any big engineering
problems, and that's okay. It just removes a bunch of boilerplate I've seen
in many a Twisted software project, usually boilerplate that's implemented
using the suboptimal methods described above.

The README should run you through it real quick:
https://pypi.python.org/pypi/thimble

This is just an early release. I expect that the documentation isn't good
enough to get best practices out the door, particularly in setting up
thread pools. I think it's pretty decent and probably already worth a look,
though :-)

Thanks to Rackspace for letting me write it open source  on company time
:-)

hth
lvh
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python