Re: [Twisted-Python] Distributing apilinks.py

2014-05-05 Thread Tom Prince
Eventually, apilinks should just go away. I think I have convinced
Michael (pydoctor's maintainer) that pydoctor should just genereate an
objects.inv that sphinx can read. Then the regular :py:*: annoations can
be used, rather than the apilinks ones (which interpert <> backwards
anyway).

That doesn't address the issue of what to do in the mean time. Looking
at the code, it looks very similar to what the builtin extlinks
extension does; except that apilinks wants `path.to.object  and
extlinks wants `title `. (But I guess this doesn't
address the issue of # in the links being put in the wrong place. But,
https://twistedmatrix.com/documents/current/api/twisted.web.iweb.IRequest.getSession.html
does exists (probably to make this kind of linking work.

  Tom

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


Re: [Twisted-Python] Distributing apilinks.py

2014-05-05 Thread Adi Roiban
Hi Tom,

Many, many thanks for pushing this forward!

IRequest.getSession.html and extlinks is a workaround, but I hope that
we can fix the source problem soon so that we don't have to stick with
the workaround for to long.

Is there a ticket in pydoctor for the generation of objects.inv ?

Michael, are you convinced that it would be nice for pydoctor to
generate objects.inv ?

I think that implementing this feature could help other project using
only sphinx for both narrative and api documentation.
I can try to send a patch for that.

Thanks!



On 5 May 2014 11:07, Tom Prince  wrote:
> Eventually, apilinks should just go away. I think I have convinced
> Michael (pydoctor's maintainer) that pydoctor should just genereate an
> objects.inv that sphinx can read. Then the regular :py:*: annoations can
> be used, rather than the apilinks ones (which interpert <> backwards
> anyway).
>
> That doesn't address the issue of what to do in the mean time. Looking
> at the code, it looks very similar to what the builtin extlinks
> extension does; except that apilinks wants `path.to.object  and
> extlinks wants `title `. (But I guess this doesn't
> address the issue of # in the links being put in the wrong place. But,
> https://twistedmatrix.com/documents/current/api/twisted.web.iweb.IRequest.getSession.html
> does exists (probably to make this kind of linking work.
>
>   Tom



-- 
Adi Roiban

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


[Twisted-Python] Serial interface for software program

2014-05-05 Thread anatoly techtonik
Hello, network hackers,

Recently I've got a Raspberry Pi and a friend showed me its serial
interface and helped to setup it. I was stunned. What I saw - you open
serial terminal, and you jump in into the middle of boot section. Just
open a terminal and you see what's going on inside of R.Pi. Any time.
That's was an intro. =)

For a long time I wanted the same interface for debugging software
programs. When I was hacking on Spyder I found that my human brain is
too limited to squeeze details of dynamic of interaction of objects at
run-time. Spyder is written in Python with Qt, and it is a parallel
application much like any Twisted app is. But I wanted to push the
progress, I have to deal with complexity, so I badly needed to be able
to draw a video of interaction at run-time. That was the problem I
tried to solve.

And for the first step I needed a way to connect to Spyder at run-time
and see what's going on. I didn't know how to call that way before,
but now I have a rather accurate wording - "a serial interface for an
application". That is the background for the question I am trying to
ask.

What is the best way to implement such interface considering the
following properties:
1. it needs to be simple (so that you can quickly create python script
that reads the info)
2. it needs to be universal (so that script for one app worked for other)
3. it should be asynchronous (connected terminal should not degrade performance)
4. it needs to be reliable (at least detecting missing packets)
5. and cross-platform (and pure python)

Why Twisted? For the first I think that this problem is actual for
people who are dealing with complexity of dynamic and interconnected
systems built with the help of Twisted. For the second I believe it
can only be solved or analyzed by people skilled in interprocess and
internetwork communications.

One button test:
1. program behaves weird
2. user hits the button
3. terminal pops up
4. shows a lot of data for a running program

I am interested to know.
1. how the button should discover the program
network port seems cool, but what about two parallel programs? what
about different programs that provide this interface?

2. how terminal receives the data
i see it as line based - one line - one event, everything is text

3. how to make it fast
TCP clearly won't here

4. how to send the data
what if two threads (or parallel code) produce serial data? who should
run the server that serves connected terminals, and how other thread
will send message to this server? you can not run two TCP servers on
the same port on the app side, so is there an alternative? how to
detect missing data in a stream? how to avoid dealing with incomplete
packets and low level network details?

Thanks. I'd like to get back to hacking on Spyder one day, but this is
a stumbling block for me every time I think about it or any program of
compared complexity.
-- 
anatoly t.

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


Re: [Twisted-Python] overly specific ImportError assert for python 3?

2014-05-05 Thread exarkun

On 02:17 am, gl...@twistedmatrix.com wrote:
cyli was working on  and 
encountered this peculiar failure on her branch (and not on trunk): 
.


The interesting bit of the failure is that in one case, the 
ImportError's message is "import of 'service_identity' halted; None in 
sys.modules" and on trunk it's apparently 'No module named 
service_identity'.


The branch in question changes conch, which isn't even tested on python 
3.


So... anyone have an idea what's going on?


Here's the "versions" report from a build on that builder which recently 
succeeded:


http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2210/steps 
/report-module-versions/logs/versions


And here's the "versions" report from a build of that branch on that 
builder:


http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2212/steps 
/report-module-versions/logs/versions


Notice that the state of a somewhat relevant dependency is different 
between the two builds.  Backing up, look at which build slave did each 
of those builds:


http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2210
http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2212

So I suppose the test only passes by accident on trunk because it 
happened to be run on one slave with one configuration rather than the 
other slave with the other configuration...


Considering we seem to have no mechanism whatsoever for ensuring the 
configuration of two different slaves for a particular builder is the 
same, I wonder if we should reconsider using multiple slaves for 
individual builders.


Jean-Paul

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


Re: [Twisted-Python] Serial interface for software program

2014-05-05 Thread Laurens Van Houtven
Hi Anatoly,


Do you know about manhole? I made a video that also demos axiom, but it
should show you what manhole does :)

https://www.youtube.com/watch?v=3-UZiO-AnLc

Essentially it's "repl in a running process".


hth
lvh


On Mon, May 5, 2014 at 4:43 AM, anatoly techtonik wrote:

> Hello, network hackers,
>
> Recently I've got a Raspberry Pi and a friend showed me its serial
> interface and helped to setup it. I was stunned. What I saw - you open
> serial terminal, and you jump in into the middle of boot section. Just
> open a terminal and you see what's going on inside of R.Pi. Any time.
> That's was an intro. =)
>
> For a long time I wanted the same interface for debugging software
> programs. When I was hacking on Spyder I found that my human brain is
> too limited to squeeze details of dynamic of interaction of objects at
> run-time. Spyder is written in Python with Qt, and it is a parallel
> application much like any Twisted app is. But I wanted to push the
> progress, I have to deal with complexity, so I badly needed to be able
> to draw a video of interaction at run-time. That was the problem I
> tried to solve.
>
> And for the first step I needed a way to connect to Spyder at run-time
> and see what's going on. I didn't know how to call that way before,
> but now I have a rather accurate wording - "a serial interface for an
> application". That is the background for the question I am trying to
> ask.
>
> What is the best way to implement such interface considering the
> following properties:
> 1. it needs to be simple (so that you can quickly create python script
> that reads the info)
> 2. it needs to be universal (so that script for one app worked for other)
> 3. it should be asynchronous (connected terminal should not degrade
> performance)
> 4. it needs to be reliable (at least detecting missing packets)
> 5. and cross-platform (and pure python)
>
> Why Twisted? For the first I think that this problem is actual for
> people who are dealing with complexity of dynamic and interconnected
> systems built with the help of Twisted. For the second I believe it
> can only be solved or analyzed by people skilled in interprocess and
> internetwork communications.
>
> One button test:
> 1. program behaves weird
> 2. user hits the button
> 3. terminal pops up
> 4. shows a lot of data for a running program
>
> I am interested to know.
> 1. how the button should discover the program
> network port seems cool, but what about two parallel programs? what
> about different programs that provide this interface?
>
> 2. how terminal receives the data
> i see it as line based - one line - one event, everything is text
>
> 3. how to make it fast
> TCP clearly won't here
>
> 4. how to send the data
> what if two threads (or parallel code) produce serial data? who should
> run the server that serves connected terminals, and how other thread
> will send message to this server? you can not run two TCP servers on
> the same port on the app side, so is there an alternative? how to
> detect missing data in a stream? how to avoid dealing with incomplete
> packets and low level network details?
>
> Thanks. I'd like to get back to hacking on Spyder one day, but this is
> a stumbling block for me every time I think about it or any program of
> compared complexity.
> --
> anatoly t.
>
> ___
> 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


Re: [Twisted-Python] Serial interface for software program

2014-05-05 Thread Itamar Turner-Trauring
If Spyder *just* uses Qt, it's a single-threaded event loop. There's a 
3rd party event loop for Twisted that runs on top of Qt (qt4reactor), 
which would allow Twisted and Qt code to run in the same thread.


-Itamar

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


Re: [Twisted-Python] overly specific ImportError assert for python 3?

2014-05-05 Thread Glyph

On May 5, 2014, at 4:43 AM, exar...@twistedmatrix.com wrote:

> On 02:17 am, gl...@twistedmatrix.com wrote:
>> cyli was working on  and 
>> encountered this peculiar failure on her branch (and not on trunk): 
>> .
>> 
>> The interesting bit of the failure is that in one case, the ImportError's 
>> message is "import of 'service_identity' halted; None in sys.modules" and on 
>> trunk it's apparently 'No module named service_identity'.
>> 
>> The branch in question changes conch, which isn't even tested on python 3.
>> 
>> So... anyone have an idea what's going on?
> 
> Here's the "versions" report from a build on that builder which recently 
> succeeded:
> 
> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2210/steps 
> /report-module-versions/logs/versions
> 
> And here's the "versions" report from a build of that branch on that builder:
> 
> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2212/steps 
> /report-module-versions/logs/versions
> 
> Notice that the state of a somewhat relevant dependency is different between 
> the two builds.  Backing up, look at which build slave did each of those 
> builds:
> 
> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2210
> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2212
> 
> So I suppose the test only passes by accident on trunk because it happened to 
> be run on one slave with one configuration rather than the other slave with 
> the other configuration...
> 
> Considering we seem to have no mechanism whatsoever for ensuring the 
> configuration of two different slaves for a particular builder is the same, I 
> wonder if we should reconsider using multiple slaves for individual builders.

Actually, one of the areas I was hoping that we could focus on for 14.1 would 
be to upgrade our packaging infrastructure and have our builders acquire 
dependencies automatically via 'pip install' or similar.

See for example .

It's interesting to me that I've had issues with the divergent dependencies on 
this exact builder twice, and both times re-building trunk multiple times has 
happened to always hit the "good" builder, making it look like the branch is 
somehow at fault.  What's up with that?  Just luck of the draw

-glyph


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


Re: [Twisted-Python] Distributing apilinks.py

2014-05-05 Thread Glyph
On May 5, 2014, at 1:07 AM, Tom Prince  wrote:

> Eventually, apilinks should just go away. I think I have convinced
> Michael (pydoctor's maintainer) that pydoctor should just genereate an
> objects.inv that sphinx can read. Then the regular :py:*: annoations can
> be used, rather than the apilinks ones

This would be very nice.  Did you file an actual bug on pydoctor or is this a 
conversation which will be momentarily forgotten? :)

>  (which interpert <> backwards anyway).

Yes, this annoyed me greatly. :-\.

-glyph


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


Re: [Twisted-Python] Serial interface for software program

2014-05-05 Thread Daniel Sank
> There's a 3rd party event loop for Twisted that runs on top of Qt
(qt4reactor), which would
> allow Twisted and Qt code to run in the same thread.

Speaking of which, why isn't that thing officially part of twisted? Super
useful.

Daniel



On Mon, May 5, 2014 at 10:24 AM, Itamar Turner-Trauring  wrote:

> If Spyder *just* uses Qt, it's a single-threaded event loop. There's a 3rd
> party event loop for Twisted that runs on top of Qt (qt4reactor), which
> would allow Twisted and Qt code to run in the same thread.
>
> -Itamar
>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Daniel Sank
Department of Physics
Broida Hall
University of California
Santa Barbara, CA 93117
(805)893-3899
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Serial interface for software program

2014-05-05 Thread exarkun

On 06:49 pm, sank.dan...@gmail.com wrote:

There's a 3rd party event loop for Twisted that runs on top of Qt

(qt4reactor), which would

allow Twisted and Qt code to run in the same thread.


Speaking of which, why isn't that thing officially part of twisted? 
Super

useful.


The PyQt team insists that the PyQt license is incompatible with 
Twisted's license (this is an intentional simplification, you can read 
more about the issue on PyQt's website if you really care).


Since PySide now exists this is potentially no longer an issue. 
However, the last thing I heard about using PySide to run the Qt reactor 
is that it segfaulted sometimes.


So perhaps the reason is that someone needs to do some work to determine 
if PySide is actually safe to use with the Qt reactor now and, if it is, 
shuffle some code around.


However, I'm not even sure if the GUI reactors *should* be distributed 
as part of the main Twisted package.  They are already first-class 
reactors via the plugin system.  Independent releases let them track 
changes in the GUI library they're each concerned with more quickly than 
they could if they were part of Twisted itself.


Perhaps there are other reasons, like simplicity of packaging or quality 
of continuous integration testing, that would override those issues and 
make it worth bringing Qt reactor back into Twisted.  Sorting that out 
is also a task that requires someone interested to step up an do some 
work, though. :)


Jean-Paul

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


Re: [Twisted-Python] overly specific ImportError assert for python 3?

2014-05-05 Thread Dustin J. Mitchell
Using 'pip freeze' to print versions can help, as can either using
requirements.txt or 'pip install -U' to do the installs.

On Mon, May 5, 2014 at 2:46 PM, Glyph  wrote:
>
> On May 5, 2014, at 4:43 AM, exar...@twistedmatrix.com wrote:
>
>> On 02:17 am, gl...@twistedmatrix.com wrote:
>>> cyli was working on  and 
>>> encountered this peculiar failure on her branch (and not on trunk): 
>>> .
>>>
>>> The interesting bit of the failure is that in one case, the ImportError's 
>>> message is "import of 'service_identity' halted; None in sys.modules" and 
>>> on trunk it's apparently 'No module named service_identity'.
>>>
>>> The branch in question changes conch, which isn't even tested on python 3.
>>>
>>> So... anyone have an idea what's going on?
>>
>> Here's the "versions" report from a build on that builder which recently 
>> succeeded:
>>
>> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2210/steps
>>  /report-module-versions/logs/versions
>>
>> And here's the "versions" report from a build of that branch on that builder:
>>
>> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2212/steps
>>  /report-module-versions/logs/versions
>>
>> Notice that the state of a somewhat relevant dependency is different between 
>> the two builds.  Backing up, look at which build slave did each of those 
>> builds:
>>
>> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2210
>> http://buildbot.twistedmatrix.com/builders/python-3.3-tests/builds/2212
>>
>> So I suppose the test only passes by accident on trunk because it happened 
>> to be run on one slave with one configuration rather than the other slave 
>> with the other configuration...
>>
>> Considering we seem to have no mechanism whatsoever for ensuring the 
>> configuration of two different slaves for a particular builder is the same, 
>> I wonder if we should reconsider using multiple slaves for individual 
>> builders.
>
> Actually, one of the areas I was hoping that we could focus on for 14.1 would 
> be to upgrade our packaging infrastructure and have our builders acquire 
> dependencies automatically via 'pip install' or similar.
>
> See for example .
>
> It's interesting to me that I've had issues with the divergent dependencies 
> on this exact builder twice, and both times re-building trunk multiple times 
> has happened to always hit the "good" builder, making it look like the branch 
> is somehow at fault.  What's up with that?  Just luck of the draw
>
> -glyph
>
>
> ___
> 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


Re: [Twisted-Python] Serial interface for software program

2014-05-05 Thread Itamar Turner-Trauring

On 05/05/2014 03:06 PM, exar...@twistedmatrix.com wrote:


However, I'm not even sure if the GUI reactors *should* be distributed 
as part of the main Twisted package.  They are already first-class 
reactors via the plugin system.  Independent releases let them track 
changes in the GUI library they're each concerned with more quickly 
than they could if they were part of Twisted itself.


Someone remind me to file a "ReactorBuilder doesn't support external 
reactors" ticket tomorrow...


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


Re: [Twisted-Python] tor hidden service endpoint parser returns a deferred

2014-05-05 Thread David Stainton
OK... I decided that txtorcon's endpoint constructor should only take
string arguments besides the reactor arg...
because serverFromString passes only str args to the endpoint constructor.

I wrote the endpoint parser to be as simple as possible.
The endpoint's `listen` method now handles the tor configuration and
launch logic... and returns a deferred which will
fire with an IListenPort.

The pip method definitely works... my code works but prints traceback
with this error:
"Unexpected error while writing cache file"
Do you as well?

Here's my endpoint parser plugin:
https://github.com/david415/txtorcon/blob/endpoint_parser_plugin-rewrite3/twisted/plugins/txtorcon_endpoint_parser.py

Here's how I install it:
cd ~/projects/virtualenv-1.11.5
./virtualenv.py ~/virtenv-txtorcon
. ~/virtenv-txtorcon/bin/activate
usewithtor pip install twisted
cd ~/projects
git clone https://github.com/david415/txtorcon.git
cd txtorcon
git checkout endpoint_parser_plugin-rewrite3
python setup.py install


Running the example code:
cd examples
python launch_tor_endpoint.py
Unexpected error while writing cache file
Traceback (most recent call last):
  File 
"/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/internet/endpoints.py",
line 1465, in serverFromString
return _serverFromStringLegacy(reactor, description, _NO_DEFAULT)
  File 
"/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/internet/endpoints.py",
line 1393, in _serverFromStringLegacy
nameOrPlugin, args, kw = _parseServer(description, None, default)
  File 
"/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/internet/endpoints.py",
line 1380, in _parseServer
for plugin in getPlugins(IStreamServerEndpointStringParser):
  File 
"/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/plugin.py",
line 209, in getPlugins
allDropins = getCache(package)
---  ---
  File 
"/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/plugin.py",
line 181, in getCache
dropinPath.setContent(pickle.dumps(dropinDotCache))
exceptions.AttributeError: 'ZipPath' object has no attribute 'setContent'
I have set up a hidden service, advertised at: < of twisted.web.server.Site on 55141>
http://mqrcnytlnh4xynmh.onion:80
locally listening on IPv4Address(TCP, '127.0.0.1', 55141)

and txtorcon's setup.py output:
python setup.py install
WARNING: not using PyPi over SSH!
running install
running bdist_egg
running egg_info
writing requirements to txtorcon.egg-info/requires.txt
writing txtorcon.egg-info/PKG-INFO
writing top-level names to txtorcon.egg-info/top_level.txt
writing dependency_links to txtorcon.egg-info/dependency_links.txt
package init file 'twisted/plugins/__init__.py' not found (or not a
regular file)
reading manifest file 'txtorcon.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'scripts/*.py'
warning: no previously-included files found matching 'docs/_static/*~'
warning: no previously-included files found matching 'examples/*~'
writing manifest file 'txtorcon.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/twisted
creating build/bdist.linux-x86_64/egg/twisted/plugins
copying build/lib.linux-x86_64-2.7/twisted/plugins/txtorcon_endpoint_parser.py
-> build/bdist.linux-x86_64/egg/twisted/plugins
creating build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/stream.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/log.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/torconfig.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/router.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/torcontrolprotocol.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/circuit.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/addrmap.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/interface.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/spaghetti.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/torstate.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/torinfo.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/__init__.py ->
build/bdist.linux-x86_64/egg/txtorcon
copying build/lib.linux-x86_64-2.7/txtorcon/util.py ->
build/bdist.linux-x86_64/egg/txtorcon
byte-compiling 
build/bdist.linux-x86_64/egg/twisted/plugins/txtorcon_endpoint_parser.py
to txtorcon_endpoint_parser.pyc
byte-compiling build/bdist.linux-x86_64/egg/txtorcon/stream.py to stream.pyc
byte-compiling build/bdist

Re: [Twisted-Python] Serial interface for software program

2014-05-05 Thread Glyph

On May 5, 2014, at 6:02 PM, Itamar Turner-Trauring  wrote:

> On 05/05/2014 03:06 PM, exar...@twistedmatrix.com wrote:
>> 
>> However, I'm not even sure if the GUI reactors *should* be distributed as 
>> part of the main Twisted package.  They are already first-class reactors via 
>> the plugin system.  Independent releases let them track changes in the GUI 
>> library they're each concerned with more quickly than they could if they 
>> were part of Twisted itself.
> 
> Someone remind me to file a "ReactorBuilder doesn't support external 
> reactors" ticket tomorrow...

File a "ReactorBuilder doesn't support external reactors" ticket tomorrow.

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


Re: [Twisted-Python] tor hidden service endpoint parser returns a deferred

2014-05-05 Thread Glyph

On May 5, 2014, at 6:52 PM, David Stainton  wrote:

> OK... I decided that txtorcon's endpoint constructor should only take
> string arguments besides the reactor arg...
> because serverFromString passes only str args to the endpoint constructor.

I strongly suggest that this is wrong.

The endpoint constructor should do _construction_.  The endpoint parser should 
do _parsing_.  The task of parsing is of taking strings and producing 
meaningful values.

You may want to have the endpoint parser actually live in a separate method in 
txtorcon rather than putting it into the plugin itself, and leave the plugin 
simply the task of plugging in, but the parsing method should not be called 
__init__.

(Also, don't use asserts.  This is probably indicative of a weakness in the 
parsing API we've provided, but you should likely raise something like 
UsageError.)

> I wrote the endpoint parser to be as simple as possible.
> The endpoint's `listen` method now handles the tor configuration and
> launch logic... and returns a deferred which will
> fire with an IListenPort.

Great.

> The pip method definitely works... my code works but prints traceback
> with this error:
> "Unexpected error while writing cache file"
> Do you as well?
> 

What exactly is 'usewithtor'?

> usewithtor pip install twisted



> Running the example code:
> cd examples
> python launch_tor_endpoint.py
> Unexpected error while writing cache file
> Traceback (most recent call last):
>  File 
> "/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/internet/endpoints.py",
> line 1465, in serverFromString
>return _serverFromStringLegacy(reactor, description, _NO_DEFAULT)
>  File 
> "/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/internet/endpoints.py",
> line 1393, in _serverFromStringLegacy
>nameOrPlugin, args, kw = _parseServer(description, None, default)
>  File 
> "/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/internet/endpoints.py",
> line 1380, in _parseServer
>for plugin in getPlugins(IStreamServerEndpointStringParser):
>  File 
> "/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/plugin.py",
> line 209, in getPlugins
>allDropins = getCache(package)
> ---  ---
>  File 
> "/home/human/virtenv-txtorcon/local/lib/python2.7/site-packages/twisted/plugin.py",
> line 181, in getCache
>dropinPath.setContent(pickle.dumps(dropinDotCache))
> exceptions.AttributeError: 'ZipPath' object has no attribute 'setContent'
> I have set up a hidden service, advertised at: < 'twisted.internet.tcp.Port'> of twisted.web.server.Site on 55141>

This traceback is actually harmless, if annoying.  It's trying to generate the 
plugin cache, which is explained here:



> http://mqrcnytlnh4xynmh.onion:80
> locally listening on IPv4Address(TCP, '127.0.0.1', 55141)
> 
> and txtorcon's setup.py output:
> python setup.py install


> running bdist_egg
 ^ This right here is your problem.

There are a couple of solutions, in order of increasing complexity:

Don't build eggs.  Why are you building eggs?  Eggs are unfortunately a huge 
problem magnet.  I don't think 'pip install' builds eggs; I don't manually run 
setup.py anywhere any more because I assume pip understands these concerns 
better than I do.
Set zip_safe in your setup.py to False, which will turn your egg into a 
directory rather than a directory.
Figure out a way to hook the _build_ step specifically so you can run 
getPlugins() to generate the dropin cache before zipping up your zip file.  
Twisted plugins actually do work within zip files, but nobody has bothered 
working out the setuptools incantation to get them to generate at the 
appropriate time for building an egg.  This is extra tricky because you only 
want to generate this dropin.cache file if the dropin is going to live inside 
an egg; otherwise, it would conflict with the communal dropin.cache file 
generated at install time.  This option will be the most confusing and 
frustrating for you, but I hope you choose it, because it would be GREAT to 
have a Right Way™ to address this problem in a Twisted plugin project's 
setup.py :).

> zip_safe flag not set; analyzing archive contents...

It's probably best to set zip_safe one way or the other though, even if you 
want to set it to 'true'.  Letting setuptools guess like this will, 
unsurprisingly, get you unpredictable results.

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