Tools for Python
Project description
README - pygeneral
A collection of general-purpose Python utilities.
Table of Contents
Overview
pygeneral is a set of small Python utilities that can simplify common tasks.
ProgressBaris a simple progress bar that can be used in the console.StdoutCounterprovides a straightforward way to show progress in the console, incrementally updating a single line.is_roothelps you check if the current user has root (on Linux/Unix) or administrator (on Windows) privileges.lensortsorts lines based on their distance to a match of a specified regular expression.
Installation
pip install pygeneral
Or, for development:
# (1) Clone the repository
git clone https://github.com/BartSte/pygeneral.git
cd pygeneral
pip install -e ".[dev]"
Usage
You can import the classes and functions from pygeneral as you normally would
with in a Python script. Additionally, some of the utilities are also available
as command-line tools. As is explained below.
Lensort
After installation, you will have the lensort command available:
lensort [OPTIONS] <REGEX>
Example
Suppose you have a file named input.txt:
abc = 1
x = 2
yy = 3
If you run:
lensort '=' -f input.txt
The output will be:
x = 2
yy = 3
abc = 1
Explanation:
- It sorts lines by the number of characters before the
=match. x = 2has 1 character before=.yy = 3has 2 characters before=.abc = 1has 3 characters before=.
You can also pipe content directly to lensort, for example:
cat input.txt | lensort '='
License
This project is licensed under the MIT License.
See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygeneral-1.1.2.tar.gz.
File metadata
- Download URL: pygeneral-1.1.2.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41979d6749bb1a154265d0f857ce1219edf79fa6a9cdb1d1f1f9ba04d122680c
|
|
| MD5 |
190ee9fe3b6a444e0aacafc8d77c94e9
|
|
| BLAKE2b-256 |
45771a1f7046c9a93a60b678b540524788ae54e3655692b828f4873bc1f886c2
|
Provenance
The following attestation bundles were made for pygeneral-1.1.2.tar.gz:
Publisher:
release.yml on BartSte/pygeneral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygeneral-1.1.2.tar.gz -
Subject digest:
41979d6749bb1a154265d0f857ce1219edf79fa6a9cdb1d1f1f9ba04d122680c - Sigstore transparency entry: 756868189
- Sigstore integration time:
-
Permalink:
BartSte/pygeneral@0efdcf694e379734254d3269a4ffebf12e299b25 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/BartSte
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0efdcf694e379734254d3269a4ffebf12e299b25 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pygeneral-1.1.2-py3-none-any.whl.
File metadata
- Download URL: pygeneral-1.1.2-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9648c56b55edef3fa26bbffdedaed5480864831255e21636649aedbf47351d02
|
|
| MD5 |
96800595224cadbd386882290dadc30e
|
|
| BLAKE2b-256 |
22ae9e4ee7594d36c062287195f50bec46883aa59b25be18d540bd8d67ad441a
|
Provenance
The following attestation bundles were made for pygeneral-1.1.2-py3-none-any.whl:
Publisher:
release.yml on BartSte/pygeneral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygeneral-1.1.2-py3-none-any.whl -
Subject digest:
9648c56b55edef3fa26bbffdedaed5480864831255e21636649aedbf47351d02 - Sigstore transparency entry: 756868192
- Sigstore integration time:
-
Permalink:
BartSte/pygeneral@0efdcf694e379734254d3269a4ffebf12e299b25 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/BartSte
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0efdcf694e379734254d3269a4ffebf12e299b25 -
Trigger Event:
push
-
Statement type: