anki-code / xontrib-pipeliner Goto Github PK
View Code? Open in Web Editor NEWLet your pipe lines flow thru the Python code in xonsh.
License: BSD 2-Clause "Simplified" License
Let your pipe lines flow thru the Python code in xonsh.
License: BSD 2-Clause "Simplified" License
Thanks for the useful snippet.
I tried this plugin with bashisms
loaded but couldn't get it to work. When I do echo "hello world" | pl "line"
. It is stuck forever and doesn't print anything.
After removing bashishms
from xontrib load
, it is working as expected. I read the bashishms
source code but couldn't figure out the conflicting piece of code.
Would be nice if there was a mode where lambda argument instead of line-by-line was a file object for the whole input stream.
Trying pipeliner on a Mac and the command never returns.
This does not return:
> echo 1 | ppl 'line'
Neither does this:
> echo 1 | ppl 'line' | cat
> xonfig
+------------------+----------------------+
| xonsh | 0.10.1 |
| Git SHA | 337cf25a |
| Commit Date | Nov 17 15:37:41 2021 |
| Python | 3.9.9 |
| PLY | 3.11 |
| have readline | True |
| prompt toolkit | 3.0.24 |
| shell type | prompt_toolkit |
| history backend | json |
| pygments | 2.11.2 |
| on posix | True |
| on linux | False |
| on darwin | True |
| on windows | False |
| on cygwin | False |
| on msys2 | False |
| is superuser | False |
| default encoding | utf-8 |
| xonsh encoding | utf-8 |
| encoding errors | surrogateescape |
| on jupyter | True |
| jupyter kernel | None |
| xontrib 1 | bashisms |
| xontrib 2 | coreutils |
| xontrib 3 | jedi |
| xontrib 4 | pipeliner |
| xontrib 5 | pyenv |
| xontrib 6 | sh |
| xontrib 7 | vox |
| xontrib 8 | vox_tabcomplete |
| xontrib 9 | voxapi |
+------------------+----------------------+
Hi!
I'm playing with xonsh and this contrib is really useful to leverage it.
I detected some inconsistencies with the experimental feature @(). The following can help polish it.
The ls | pl @( line )
works as it's expected but not ls | pl @( line.upper() )
. However, ls | pl @( (lambda l: l.upper())(line) )
does.
probably needs to be added in setup.py
Options:
I'm trying to use ppl
with this pipe find . | ppl "str(num) + ' ' + line"
and get error.
any idea how to fix it?
~/D/C/book $ XONSH_SHOW_TRACEBACK = True
~/D/C/book $ find . | ppl "str(num) + ' ' + line"
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/local/Cellar/xonsh/0.9.27/libexec/lib/python3.9/site-packages/xontrib/pipeliner_parallel.py", line 28, in __call__
return self.f(x)
File "/usr/local/Cellar/xonsh/0.9.27/libexec/lib/python3.9/site-packages/xontrib/pipeliner_parallel.py", line 10, in f
ctx = __xonsh__.ctx
NameError: name '__xonsh__' is not defined
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/Cellar/xonsh/0.9.27/libexec/lib/python3.9/site-packages/xonsh/procs/proxies.py", line 508, in run
r = self.f(self.args, sp_stdin, sp_stdout, sp_stderr, spec, spec.stack)
File "/usr/local/Cellar/xonsh/0.9.27/libexec/lib/python3.9/site-packages/xonsh/procs/proxies.py", line 305, in proxy_three
return f(args, stdin, stdout)
File "/usr/local/Cellar/xonsh/0.9.27/libexec/lib/python3.9/site-packages/xontrib/pipeliner.py", line 65, in _ppl
xppl.go(func_args, stdout)
File "/usr/local/Cellar/xonsh/0.9.27/libexec/lib/python3.9/site-packages/xontrib/pipeliner_parallel.py", line 23, in go
for result in parallel_tasks:
File "/usr/local/Cellar/[email protected]/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
NameError: name '__xonsh__' is not defined
Maybe have to import builtins?
import builtins
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.