Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
PyProg is an Open-Source library for creating progress indicators (e.g. progress bars). It helps you create customizable progress indicators. This library is for Python.
PyProg is compatible with both Python 3 and Python 2, and will also work on Qt Console.
Latest Release: pip install pyprog
Latest Development Release: pip install git+https://github.com/Bill13579/pyprog.git@develop
After you have installed PyProg, you can test if it has been successfully installed by running import pyprog
in python. If PyProg was installed successfully, it should show no errors.
To create a basic progress bar, follow these steps:
import pyprog
ProgressBar
object: prog = pyprog.ProgressBar("", "")
prog.update()
prog.set_stat(<status>)
to set the status and then use prog.update()
to actually show the changeprog.end()
to make the Progress Bar lastExample Code with Fake For loop:
import pyprog
from time import sleep
# Create a PyProg ProgressBar Object
prog = pyprog.ProgressBar(":-) ", " OK!")
# Show the initial status
prog.update()
# Fake for loop
for i in range(0, 100):
# Sleep for a while (This is just to slow down the for loop so that it won't end in an instant)
sleep(0.1)
# Update status
prog.set_stat(i + 1)
# Show (Update) the current status
prog.update()
# Make the Progress Bar final
prog.end()
Output:
Initial State:
:-) Progress: 0% -------------------------------------------------- OK!
When progress is 50:
:-) Progress: 50% #########################------------------------- OK!
Final State:
:-) Progress: 100% ################################################## OK!
The first two parameters in prog = pyprog.ProgressBar("", "")
is for telling PyProg what to put before and after the progress indicator.
Example:
:-) Progress: 0% -------------------------------------------------- OK!
^ ^ ^
Prefix Bar Suffix
You can also add more options to make it look good.
Adding options complete_symbol="█", not_complete_symbol="-"
will change the original output to:
Initial State:
:-) Progress: 0% -------------------------------------------------- OK!
When progress is 50:
:-) Progress: 50% █████████████████████████------------------------- OK!
Final State:
:-) Progress: 100% ██████████████████████████████████████████████████ OK!
PyProg can also auto calculate the current percentage. You just need to tell PyProg the total number of things you need to process.
Change the line prog = pyprog.ProgressBar("", "")
to prog = pyprog.ProgressBar("", "", <Total Number of things>)
, and PyProg will calculate the percentage for you based on the status that you give it.
To use it in our simple progress bar code, if we have 37 tasks to do, we can change this:
# Create a PyProg ProgressBar Object
prog = pyprog.ProgressBar(":-) ", " OK!")
to this:
# Create a PyProg ProgressBar Object
prog = pyprog.ProgressBar(":-) ", " OK!", 37)
And also change the fake for loop from for i in range(0, 100):
to for i in range(0, 37):
, and it will auto calculate the percentage and show it to the user.
To create a basic progress indicator (fraction), follow these steps:
import pyprog
ProgressIndicatorFraction
object: prog = pyprog.ProgressIndicatorFraction("", "", <Total number of things>)
(Replace "" with the total number of tasks or things you need to process)prog.update()
prog.set_stat(<status>)
to set the status and then use prog.update()
to actually show the changeprog.end()
to make the Progress Indicator (Fraction) lastExample Code with Fake For loop (We are using 56 as the total in this example):
import pyprog
from time import sleep
# Create a PyProg ProgressIndicatorFraction Object
prog = pyprog.ProgressIndicatorFraction(":-) ", " OK!", 56)
# Show the initial status
prog.update()
# Fake for loop
for i in range(0, 56):
# Sleep for a while (This is just to slow down the for loop so that it won't end in an instant)
sleep(0.1)
# Update status
prog.set_stat(i + 1)
# Show (Update) the current status
prog.update()
# Make the Progress Indicator (Fraction) final
prog.end()
Output:
Initial State:
:-) 0/56 OK!
When half done:
:-) 28/56 OK!
Final State:
:-) 56/56 OK!
The prefix of everything.
The suffix of everything.
This is the option that tells PyProg how many things or tasks you need to process. We used it in the Auto calculate the percentage section.
This tells PyProg how long should the bar should be.
Initial status to show on the bar.
How many decimals should the percent have.
The complete symbol will be shown in the complete part of the bar. We used it in the Pretty Progress Bar section.
Example Position of complete symbol: Progress: 59% #############################---------------------
The not complete symbol will be shown in the not yet complete part of the bar. We used it in the Pretty Progress Bar section.
Example Position of complete symbol: Progress: 59% #############################---------------------
Where the progress explanation (prefix) and the progress text should be shown.
Possible Values:
ProgressBar.PROGRESS_LOC_START or 0 - Show both at the start
ProgressBar.PROGRESS_LOC_MIDDLE or 1 - Show both at the middle of the bar
ProgressBar.PROGRESS_LOC_END or 2 - Show both at the end
ProgressBar.PROGRESS_LOC_EXP_START_PROGRESS_MID or 3 - Show explanation (prefix) at the start and the progress text at the middle of the bar
ProgressBar.PROGRESS_LOC_EXP_END_PROGRESS_MID or 4 - Show explanation (prefix) at the end and the progress text at the middle of the bar
PROGRESS_LOC_START:
Progress: 32% ################----------------------------------
PROGRESS_LOC_MIDDLE:
################ Progress: 32% ------------------
PROGRESS_LOC_END:
################---------------------------------- Progress: 32%
PROGRESS_LOC_EXP_START_PROGRESS_MID:
Progress: ################----- 32% -----------------------
PROGRESS_LOC_EXP_END_PROGRESS_MID:
################----- 32% ----------------------- Progress:
Format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters:
"+p" -> Current percent
"+c" -> Current status
This is the progress explanation (prefix).
Example position of progress explanation: Progress: 32% ################----------------------------------
Examples:
"Progress: "
"Current Progress: "
The prefix of the bar.
The suffix of the bar.
The prefix of everything.
The suffix of everything.
This is the option that tells PyProg how many things or tasks you need to process.
Initial status to show on the indicator.
Available on: PyProg 1.0.0 ~
Params: current
Set the current progress.
Available on: PyProg 1.1.0-0 ~
Params: current
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon.
Set the current progress and update the progress bar.
Available on: PyProg 1.1.0-0 ~
Params: progress
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon.
Increase the progress by the given amount.
Available on: PyProg 1.0.0 ~
Params: (none)
Update the progress bar so that it shows the current progress.
Note: Also call this to initiate the bar.
Available on: PyProg 1.0.0 ~
Params: (none)
End the progress bar.
Available on: PyProg 1.1.0-0 ~
Params: msg
Note: This function is currently only available on the ProgressBar. Support for ProgressIndicatorFraction will come soon.
End the progress bar with a message.
Available on: PyProg 1.0.0 ~
Params: prefix
Set the prefix
Available on: PyProg 1.0.0 ~
Params: suffix
Set the suffix
Available on: PyProg 1.0.0 ~
Params: total
Set the total
Available on: PyProg 1.0.0 ~
Params: bar_length
Set the length of the bar
Available on: PyProg 1.0.0 ~
Params: decimals
Set the number of decimals for the percent
Available on: PyProg 1.0.0 ~
Params: symbols
Set the complete symbol and the not complete symbol. symbols
has to be a tuple: (complete symbol, not complete symbol)
Available on: PyProg 1.0.0 ~
Params: progress_loc
Set the progress explanation (prefix) and the progress text location. See the progress_loc parameter section for the possible values.
Available on: PyProg 1.0.0 ~
Params: progress_explain
Set the progress explanation (prefix).
Examples:
"Progress: "
"Current Progress: "
Available on: PyProg 1.0.0 ~
Params: prefix, suffix
Set the wrap bar text (the prefix and the suffix of the bar).
Available on: PyProg 1.0.0 ~
Params: progress_format
Set the format for the progress text. PyProg replaces special characters with actual values. Here is a list of special characters:
"+p" -> Current percent
"+c" -> Current status
Available on: PyProg 1.0.0 ~
Params: current
Set the current progress.
Available on: PyProg 1.0.0 ~
Params: (none)
Update the progress indicator so that it shows the current progress. Note: Also call this to initiate the indicator.
Available on: PyProg 1.0.0 ~
Params: (none)
End the progress indicator.
Available on: PyProg 1.0.0 ~
Params: prefix
Set the prefix
Available on: PyProg 1.0.0 ~
Params: suffix
Set the suffix
Available on: PyProg 1.0.0 ~
Params: total
Set the total
FAQs
A library for creating super customizable progress indicators.
We found that pyprog 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.