qsv-duct
Python wrapper you may use to call qsv commands using duct.py for composability.
This library is compatible with qsv v0.128.0. Not all commands are available (see src/qsv/__init__.py for available commands).
Make sure you have qsv installed on your system first and can access it anywhere as a PATH command.
To install this library run:
pip install qsv-duct
Basic example
We have a file fruits.csv with the following contents:
fruit,price
apple,2.50
banana,3.00
strawberry,1.50
Let's count the total number of non-header rows in fruits.csv using qsv.count:
import qsv
qsv.count("fruits.csv", run=True)
The following output gets printed to stdout:
3
Reading output to a variable
You may want to save the output value to a variable and use it in your code. Use the read parameter instead of run. For example:
non_header_row_count = qsv.count("fruits.csv", read=True)
print(non_header_row_count)
Piping commands
Since this library uses duct.py, you may access the command as an Expression type by not passing read and run.
For example, let's say we want to get the first two rows of fruits.csv with qsv.slice. Normally we would use run to run the command:
qsv.slice("fruits.csv", length=2, run=True)
fruit,price
apple,2.50
banana,3.00
If we want to display this output in a pretty format, we can pipe qsv.slice into qsv.table:
qsv.slice("fruits.csv", length=2).pipe(qsv.table()).run()
fruit price
apple 2.50
banana 3.00
If you use the duct.py library you can also pipe qsv commands with other bash-related commands using the duct library's cmd function. For example:
import qsv
from duct import cmd
cmd("cat", "fruits.csv").pipe(qsv.table()).run()
fruit price
apple 2.50
banana 3.00
strawberry 1.50
Testing
You can run the tests with the pytest package:
pytest
Metadata
Release files for qsv-duct 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qsv_duct-0.0.2.tar.gz | 5.4 kB | Without provenance | Details for qsv_duct-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qsv_duct-0.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for qsv_duct-0.0.2-py2.py3-none-any.whl |
Total release size: 13.6 kB
Release files / qsv_duct-0.0.2.tar.gz
| Download URL | qsv_duct-0.0.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b92c46c637164e8c65fe2c6900414b494f8a648429d249951bde42e4bf339967
|
|
BLAKE2b-256 checksum How to use checksums |
56108a6d585228045a067245978fee72a6e127602103e40942fba3c4ff3cc3f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / qsv_duct-0.0.2-py2.py3-none-any.whl
| Download URL | qsv_duct-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d482715e099ac2b32041a72c19974f792c58cbb90eeafc8c853a6fd41ea08285
|
|
BLAKE2b-256 checksum How to use checksums |
b65d92534603eb69c6fb6e1c409730e72f0f59fce7b1e1a44345f77d0b3e64d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for qsv-duct 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.