9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] plumber support for python lookup
@ 2013-08-20 15:03 Anthony Sorace
  2015-07-21 17:04 ` Anthony Sorace
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Sorace @ 2013-08-20 15:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'm in the middle of a medium-size python project. It would be
really helpful if the plumber could do things like look up things
in python's dot notation. Anyone have plumbing rules or helper
functions they'd like to share for python work with acme and
plumber on p9p?

Anthony




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] plumber support for python lookup
  2013-08-20 15:03 [9fans] plumber support for python lookup Anthony Sorace
@ 2015-07-21 17:04 ` Anthony Sorace
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Sorace @ 2015-07-21 17:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> On Aug 20, 2013, at 11:03 , Anthony Sorace <a@9srv.net> wrote:
> 
> I'm in the middle of a medium-size python project. It would be
> really helpful if the plumber could do things like look up things
> in python's dot notation. Anyone have plumbing rules or helper
> functions they'd like to share for python work with acme and
> plumber on p9p?

I don’t think I ever shared what I came up with for this, and it’s come up on IRC a few times, so:

I wrote a script, apy [1], which takes arguments of a directory “wdir” and a python function “app.file.function", tries to find app/file in wdir or its parents, and plumbs the result.

Then this simple plumbing rule
	# Find python modules.
	type is text
	data matches '([0-9A-Za-z]*)\.([0-9A-Za-z]*)\.([0-9A-Za-z]*)'
	plumb start apy $wdir $0
will let me click on foo.bar.function names in my project and Acme will get me to the named function.

It’s very simplistic (in particular, it only bothers with functions and doesn’t really do anything about system modules unless you get lucky), but gets me 90% of what I wanted Acme to do for me when working with python. It’s particularly nice when looking at Django’s urls.py and treating it as an index.

I think I’m doing something silly with the newline trimming; if anyone wants to point out what I’m missing, I’d love to hear it.

Anthony

[1]	/n/sources/contrib/anothy/bin/unix/apy




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-21 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20 15:03 [9fans] plumber support for python lookup Anthony Sorace
2015-07-21 17:04 ` Anthony Sorace

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).