
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
pyprog-abubakaransari
Advanced tools
🎯 Create elegant and customizable progress bars with ease! PyProg is a lightweight library for beautiful, flexible progress bars.
Install from PyPI:
pip install pyprog-abubakaransari
PyProg provides utilities for both terminal and notebook progress visuals. It contains these modules:
PyProg.progress_bar
ModuleThis module includes powerful classes and utilities to handle different styles of terminal progress bars:
ProgressBar
(Class)A flexible class for custom and advanced progress bar handling.
from PyProg.progress_bar import ProgressBar, time
pb = ProgressBar(txt_lf='Progress {percent:.0f}%: ')
total = 100
for i in range(total + 1):
pb.update(i / total, i, total)
time.sleep(0.1) # Simulate work
print() # Ensure a newline after completion
simple()
(Function)A lightweight wrapper generator — just like tqdm
.
from PyProg.progress_bar import simple, time
from PyProg.utils import gradient_colors
iterable = range(101)
for i in simple(iterable, txt_lf='Progress {percent:.0f}%: ',
colors = gradient_colors('#00ff00', '#0000ff', 20),
paint = 'bar-by-bar'):
time.sleep(0.1) # Simulate work
args
dictionary or keyword argumentsnested_bar()
(Function)Enables parent-child progress bar setups — helpful for managing parallel or dependent tasks.
from PyProg.progress_bar import ProgressBar, nested_bar, time
def task1(bar):
for i in range(100):
time.sleep(0.01)
bar.update(i / 99, i + 1, 100)
def task2(bar):
for i in range(50):
time.sleep(0.01)
bar.update(i / 49, i + 1, 50)
main = ProgressBar({'line': 2})
childs = {
"Task1": [task1, {"txt_lf": "Task1 {percent:.0f}%"}],
"Task2": [task2, {"txt_lf": "Task2 {percent:.0f}%"}]
}
nested_bar(main, childs, auto_arrangement=True)
nested_bar
If auto_arrangement=False
, you must explicitly set the line
for all bars.
Never assign the same line
number to multiple bars unless intentionally overlapping.
To reserve vertical space:
line = n
line = n + 1
PyProg.spinner
ModuleThis module provides dynamic, colored, and customizable terminal spinners.
Spinner
(Class)Create and manage animated terminal spinners.
from PyProg.spinner import Spinner
import time
spn = Spinner({"text": "Loading", "interval": 0.1})
spn.start()
time.sleep(3) # Simulate work
spn.stop()
Colors can cycle dynamically by using lists like ['red', 'blue', 'green']
.
You can use the spinner in a with
block:
from PyProg.spinner import Spinner
import time
with Spinner({"text": "Please wait..."}) as spn:
time.sleep(3)
spinning_work()
(Function)Runs a spinner during execution of a custom task.
from PyProg.spinner import spinning_work
import time
def task(spn):
time.sleep(3)
return "Done!"
spinner, result = spinning_work({"text": "Working..."}, work=task)
run_spinner_with_bar()
(Function)🌀 Combines a spinner with a progress bar, updating the spinner text live with bar content.
from PyProg.spinner import run_spinner_with_bar
import time
def work(pb, spn):
for i in range(101):
pb.update(i/100, i, 100)
spn.text = "Working: " + pb.bar_str.replace('\r', '')
time.sleep(0.05)
run_spinner_with_bar({}, {}, work)
Method | Description |
---|---|
start() | Begin spinner animation |
stop() | Stop spinner and show final message |
pause() | Pause spinner (non-terminating) |
resume() | Resume paused spinner |
hide() | Temporarily hide spinner output |
show() | Re-show spinner if hidden |
Awesome! Here's the continued documentation for the PyProg.ntbk_progbar
module, picking up from your fun and expressive intro 😄:
PyProg.ntbk_progbar
ModuleMost powerful module in notebook environments! Hack-to-the-core system here! 💥
But it is so powerful because it allows you to customize progress bars via CSS — fully HTML-rendered, styleable, and beautiful 🤩.
If we were to calculate a score for customization, it would be literally ∞
...
(unless someone doesn’t know even the "C" of CSS 😜 — but hey, that’s not our fault 😎).
It provides these utilities:
NotebookProgressBar
(Class)HTML/CSS-based progress bar made for Jupyter/Colab environments. Custom colors, gradients, labels, tokens, animations — you name it!
from PyProg.ntbk_progbar import NotebookProgressBar
from PyProg.utils import gradient_colors
import time
pb = NotebookProgressBar({
'txt_lf': "Neon Progress {iters} | {percent:.0f}%",
'txt_rt': "| ETA {eta} | Elapsed {elapsed}",
'colors': gradient_colors('#00ff00', '#0000ff', 10) + gradient_colors('#0000ff', '#00ff00', 10),
'paint': 'bar-by-bar',
'length': 30,
'text_color': ['#efa', '#afe']
})
total = 100
for i in range(total + 1):
pb.update(i / total, current_iter=i, total_iter=total)
time.sleep(0.03)
print("Progress Complete!")
Key | Type | Description |
---|---|---|
txt_lf | str | Text on the left (supports tokens like {percent} , {iters} ) |
txt_rt | str | Text on the right (ETA, speed etc) |
bar | str or list | Character(s) to build the bar |
space | str | Character for unfilled part |
paint | "bar" / "bar-by-bar" / "progress-bar" | Paint strategy |
colors | list[str] | List of CSS colors (or hex codes) |
bar_style | str | Inline CSS for each bar block |
space_style | str | CSS for empty segments |
progressbar_style | str | Style for wrapper container |
add_css | str | Inject your own custom CSS rules |
text_color | str or list | Colors for text (left and right) |
tokens | dict | Custom tokens like {spinner} , {file} etc |
freq | float | Min time between updates (smoothing) |
🎯 You can use it in context managers, attach HTML inline outputs, or integrate into live dashboards.
simple()
(Function)A quick plug-and-play generator for notebooks!
from PyProg.ntbk_progbar import simple
import time
for i in simple(range(100), txt_lf="Doing... {percent:.0f}%"):
time.sleep(0.05)
It auto-detects len()
of the iterable or uses total
from arguments. Internally uses NotebookProgressBar
.
nested_bar()
(Function)Manage multiple subtasks with individual progress bars — all under one master bar.
from PyProg.ntbk_progbar import NotebookProgressBar, nested_bar
import time
def task1(pb):
for i in range(100):
pb.update(i / 99, i+1, 100)
time.sleep(0.01)
def task2(pb):
for i in range(50):
pb.update(i / 49, i+1, 50)
time.sleep(0.01)
main = NotebookProgressBar({'txt_lf': "Overall Progress {percent:.0f}%"})
tasks = {
"Task 1": [task1, {"txt_lf": "Task 1: {percent:.0f}%"}],
"Task 2": [task2, {"txt_lf": "Task 2: {percent:.0f}%"}],
}
nested_bar(main, tasks)
🎨 Animated Gradients:
from PyProg.utils import gradient_colors
colors = gradient_colors("#ff0000", "#0000ff", 15)
🔌 Add Custom Tokens:
NotebookProgressBar({
'txt_lf': "📁 File: {filename} - {percent:.0f}%",
'tokens': {
'filename': lambda self: 'data.csv'
}
})
🧩 Inline HTML:
bar = NotebookProgressBar({...})
some_html = f"<div>{bar.get_inline_html()}</div>"
PyProg.ntbk_spinner
Module⚙️ Spinner-as-a-Show — not just a spinning icon, but a complete animated display component with CSS + live-updated bar inside!
In notebooks, visual feedback during longer tasks really helps. This module takes it further by allowing:
NotebookProgressBar
NotebookDivSpinner
(Class)Create a stylish spinner that can also display dynamic text or even embed inline progress bars 😎.
from PyProg.ntbk_spinner import NotebookDivSpinner
import time
spn = NotebookDivSpinner({
"text": "Processing",
"fg_text": ["#00ff00", "#00ccff"],
"bg_text": ["transparent", "#222"],
"clr_interval": [0.5, 0.5]
})
spn.start()
time.sleep(3)
spn.stop()
Key | Type | Description |
---|---|---|
text | str | Initial text to show |
final_text | str | Text shown after stop() |
fg_text | str or list | Foreground (text) color(s) |
bg_text | str or list | Background color(s) |
clr_interval | list[float] | Time (s) between color changes |
refresh | float | Delay between animation frame updates |
speed | float | Speed of rotation (larger = slower) |
spin_side | str | "left" or "right" of text |
spinner | dict | Spinner customization (see below) |
add_css | str | Inject raw CSS for style animation |
id | str | Optional unique ID (auto generated) |
spinner
→ Sub-dict for spinner customizationKey | Type | Description |
---|---|---|
spinner_html | str | Custom HTML (like SVG or emoji) inside the spinner |
spinner_css | dict or str | Style for spinner block |
container_css | dict or str | Style for spinner + text container |
text_css | dict or str | Style for the changing text |
final_css | str | Final message style |
animation | dict | {animation_name: css_keyframes} |
Method | Description |
---|---|
.start() | Begin animation and rendering |
.stop() | End spinner and show final message |
.hide() / .show() | Hide or reveal the spinner |
.pause() / .resume() | Stop animation loop or resume it |
.set_text("New...") | Live update the text next to spinner |
run_spin_with_bar()
(Function)Attach a spinner ☸ and embed a progress bar 📈 directly into it as live updating text!
from PyProg.ntbk_spinner import run_spin_with_bar
import time
def work(pb, spn):
for i in range(101):
pb.update(i/100, i, 100)
spn.set_text(pb.get_inline_html()) # Embed bar into spinner text
time.sleep(0.025)
run_spin_with_bar({}, {}, work)
Param | Description |
---|---|
spinner_args | Dict for spinner customization |
bar_args | Dict for progress bar styling |
work | A function of (pb, spn) where progress and text are updated |
(pb, spn) # ProgressBar instance, Spinner instance
You can use them later if needed!
You can embed inline progress bar segments inside the spinner like this:
spn.set_text(pb.get_inline_html())
Or display custom values or tokenized stats if you set bar_args['txt_lf']
.
FAQs
Progress bars and spinners for terminal and notebooks
We found that pyprog-abubakaransari demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.