Zxpy Versions Save

Shell scripts made simple 🐚

1.6.3

1 year ago

What's Changed

Full Changelog: https://github.com/tusharsadhwani/zxpy/compare/1.6.2...1.6.3

1.6.2

1 year ago

What's Changed

Full Changelog: https://github.com/tusharsadhwani/zxpy/compare/1.6.1...1.6.2

1.6.1

1 year ago
  • Fix bug in interactive mode invocation: zxpy by itself wouldn't work before this.

1.6.0

2 years ago

Added interactive mode option: zxpy -i myfile.py.

Full Changelog: https://github.com/tusharsadhwani/zxpy/compare/1.5.2...1.6.0

1.5.2

2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/tusharsadhwani/zxpy/compare/1.5.1...1.5.2

1.5.1

2 years ago
  • use read1() instead of select polling, to simplify some logic
  • remove the use of echo -n, as that is linux-specific

1.5.0

2 years ago

Adds Python3.10 support

1.4.7

2 years ago
  • Use the select module to do non-blocking reads from the shell process, instead of reading 1 byte at a time. Leads to significantly faster output for large streams, without any blocking.
  • Use process.communicate() to read stdout and stderr without causing deadlock due to buffer overflow.

1.4.6

2 years ago
  • Ensure the package actually works in Python 3.6+
  • Make sure that ~'...' raises an error if the process exits with a non-zero return code
  • Fix an edge case in supported syntax: [a, b, c] = ~'...'

1.4.5

2 years ago

Now you can pass whole commands as variables inside f-strings, without quoting.

Take this piece of code:

>>> cmd = 'uname -a'
>>> ~f'{cmd}'
/bin/sh: 1: uname -a: not found 

This is because uname -a was quoted into 'uname -a' to avoid shell injection.

To avoid this, support for :raw format_spec as added:

>>> cmd = 'uname -a'
>>> ~f'{cmd:raw}'
Linux pop-os 5.11.0 [...] x86_64 GNU/Linux

Note that this shouldn't be used with external data, or this will expose you to shell injection.