Skip to main content

Tools for Python

Project description

README - pygeneral

A collection of general-purpose Python utilities.


Table of Contents

  1. Overview
  2. Installation
  3. Command-Line Usage
  4. Python Usage
  5. Project Structure
  6. License

Overview

pygeneral is a set of small Python utilities that can simplify common tasks.

  • ProgressBar is a simple progress bar that can be used in the console.
  • StdoutCounter provides a straightforward way to show progress in the console, incrementally updating a single line.
  • is_root helps you check if the current user has root (on Linux/Unix) or administrator (on Windows) privileges.
  • lensort sorts 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 = 2 has 1 character before =.
  • yy = 3 has 2 characters before =.
  • abc = 1 has 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygeneral-1.1.2.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygeneral-1.1.2-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

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

Hashes for pygeneral-1.1.2.tar.gz
Algorithm Hash digest
SHA256 41979d6749bb1a154265d0f857ce1219edf79fa6a9cdb1d1f1f9ba04d122680c
MD5 190ee9fe3b6a444e0aacafc8d77c94e9
BLAKE2b-256 45771a1f7046c9a93a60b678b540524788ae54e3655692b828f4873bc1f886c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygeneral-1.1.2.tar.gz:

Publisher: release.yml on BartSte/pygeneral

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pygeneral-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9648c56b55edef3fa26bbffdedaed5480864831255e21636649aedbf47351d02
MD5 96800595224cadbd386882290dadc30e
BLAKE2b-256 22ae9e4ee7594d36c062287195f50bec46883aa59b25be18d540bd8d67ad441a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygeneral-1.1.2-py3-none-any.whl:

Publisher: release.yml on BartSte/pygeneral

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page