🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

barre

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

barre

Minimal progress bar

1.1.0
PyPI
Maintainers
1

barre

PyPI version CI License: MIT

A lightweight progress bar. One line, zero config, zero dependencies.

Demo

Install

pip install barre

Usage

Simple and intuitive:

from barre import b
from time import sleep

# Simple iteration
for x in b(range(100)):
    sleep(0.1)  # your work here

# With any iterable
items = ["item1", "item2", "item3"]
for x in b(items):
    process(x)

Output:

[||||||||||||||||||||                    ] 50/100

Real-world Examples

Processing Files

from barre import b
import os

# Process all images in a directory
image_files = [f for f in os.listdir("images/") if f.endswith((".jpg", ".png"))]
for file in b(image_files):
    with open(f"images/{file}", "rb") as img:
        # Your image processing here
        pass

API Requests

from barre import b
import requests

# Download multiple URLs with progress
urls = [
    "https://api.example.com/data1",
    "https://api.example.com/data2",
    "https://api.example.com/data3",
]
responses = []
for url in b(urls):
    response = requests.get(url)
    responses.append(response.json())

Data Processing

from barre import b
import pandas as pd

# Process chunks of a large DataFrame
df = pd.read_csv("large_file.csv")
chunk_size = 1000
chunks = [df[i:i+chunk_size] for i in range(0, len(df), chunk_size)]
results = []
for chunk in b(chunks):
    result = chunk.groupby('category').sum()
    results.append(result)

Long Computations

from barre import b
import numpy as np

# Heavy computations with visual feedback
matrices = []
for i in b(range(100)):
    matrix = np.random.rand(100, 100)
    result = np.linalg.eig(matrix)
    matrices.append(result)

Training ML Models

from barre import b

# Training epochs with progress
epochs = 100
for epoch in b(range(epochs)):
    model.train_epoch()
    loss = model.evaluate()

Features

  • Minimal: Single file (<1KB)
  • Fast: Zero dependencies
  • Simple: No configuration needed
  • Clean: Professional ASCII output
  • Universal: Works with any iterable

License

MIT

Made with pragmatism in France 🇫🇷

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts