Giter Club home page Giter Club logo

xontrib-pipeliner's Issues

Does not work with bashisms loaded

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.

Pipeline that takes full stream

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.

Piping to ppl does not return on Mac

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               |
+------------------+----------------------+

@( ) inconsistent

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.

Add options

Options:

  • Skip exceptions
  • Skip empty lines in input
  • Skip empty lines in output
  • Show errors without exceptions
  • Show statistics (input lines cnt, output lines cnt, changed lines cnt, skipped lines cnt)

OSX: ppl โ€” NameError: name '__xonsh__' is not defined

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.