Skip to main content

pyshuf2

PyPI version License PyPI downloads

An inexact clone of GNU shuf. Free, implemented in Python.

Install

pyshuf2 can be installed via pip:

pip install pyshuf2

If you are installing the development version, just clone the repo & run this inside the cloned directory:

pip install -e .

This will also allow you to edit the program and then re-run it without reinstalling.

Usage

Same as shuf, but the script is invoked with pyshuf2. Read the GNU manual for shuf for more details.

"Cookbook"

Generate a random number from 0 to 99

 $ pyshuf2 -i 0-99 -n 1
 73

Pick a random word from the dictionary (dictionary location may vary)

 $ pyshuf2 --input-file /usr/share/dict/words -n 1
 irreflectiveness

Shuffle the first 10 words from the dictionary

 $ head /usr/share/dict/words | pyshuf2
 aardvark
 aalii
 Aaron
 a
 aa
 Aani
 aam
 aardwolf
 A
 aal

Use input from the command line

 pyshuf2: error: argument -e/--echo: ignored explicit argument 'cho'
 $ pyshuf2 --echo one two three four five
 four
 two
 three
 one
 five

Features implemented

--e, --echo
-i, --input-range
-n, --head-count
-o, --output-file

Features not implemented

--random-source
-r, --repeat
-z, --zero-terminated

Features added that are not present in GNU shuf

--input-file	specify an input file to read from

This is a Fork

Please note that this is a fork of jakekara/pyshuf.

Release files for pyshuf2 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyshuf2 2.1.0
File Size Uploaded
pyshuf2-2.1.0.tar.gz 15.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyshuf2 2.1.0
File Interpreter ABI Platform
pyshuf2-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.0 kB

Release files / pyshuf2-2.1.0.tar.gz

Download URL pyshuf2-2.1.0.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4f691a63cffbdd7cbd191fb699441765344955a1e50f0ff32afb6964650c3f6f
BLAKE2b-256 checksum
How to use checksums
eb312f77c15fe1ab36cfa6d30907a661d0b50b40aca49a6d3517abf0936d53f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / pyshuf2-2.1.0-py3-none-any.whl

Download URL pyshuf2-2.1.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6ce708442ca87153e708d4d631b47e1bd83ca57acb4a334664340aef63f0fd4
BLAKE2b-256 checksum
How to use checksums
fc8372ca78569efc8a19d5fef5f81fc2e33d4d695b9ab727a98d754c481f9e34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page