Access the performance of a given function and create plot.
Project description
📒 Description
This module permit to evaluate the performance of a given function and create Plotly bar plot. Check the documentation at https://filouplains.github.io/perfassess/.
🗄 Dependencies
To run this software, you will need python ≥ 3.11
and this next module:
numpy ≥ 1.26.0
plotly ≥ 5.19.0
pyyaml ≥ 6.0.1
⚙️ Installation
🥹 EZ way
Recommended method:
$ pipx install perfassess
If you do not have pipx installed, check out the documentation at https://pipx.pypa.io/stable/installation/. Else, classical installation method:
$ pip install perfassess
😩 From source
👬 Cloning the repository
You can clone the repository using HTTPS
:
$ git clone https://github.com/FilouPlains/perfassess.git
or using SSH
:
$ git clone git@github.com:FilouPlains/perfassess.git
Then go to the 📁 perfassess/
directory:
$ cd perfassess
All next commands are assuming that you are in the 📁 perfassess/
directory. This directory will be name as 📁 ./
.
🐍📦 Installing with pip
Simply launch this command in the 📁 ./
directory:
$ python3 -m pip install .
You are now able to launch the program!
⌨️ Using command line
✏️ General note
By doing:
$ perfassess --help
You will get the help to use the command line interface. Here are the used legends:
int
: Integer.str
: String.[type|value]
: Type of the input required, follow by the default value. So if this optional arguments is not used, “value” will be chosen.
⚠️ If you use
pickle
, the command line interface will not work!
📄 Normal use
To use th program, launch:
$ perfassess -s script.py \\
-f function_name \\
-o output_directory/ \\
-a argument.yml
You can actually directly test the program in the repository root (📁 perfassess/
) using:
$ perfassess -s src/perfassess/testor.py \\
-f testor \\
-a data/argument.yml \\
-o data/
📁 Package use
Let us say that you want to test a package, which should have this kind of tree structure:
package/
└── src/
├── __init__.py
└── script.py
In package, you can use relative paths. But with these, the “normal use” method do not work. Instead, use the next command, if you are in 📁 package/
, in order to evaluate script.py
:
$ perfassess -s src/script.py \\
-f function_name \\
-o output_directory/ \\
--package src/__init__.py \\
-a argument.yml
In addition of the previous "normal use" method, you have to indicate a __init__.py
file.
Note 📝
Packages are identify with
__init__.py
files and allow relatives import.
🗂 Subpackage use
Let us say that you want to test a subpackage, which should have this kind of tree structure:
./package/
└── src/
├── __init__.py
└── subpackage/
├── __init__.py
└── script.py
In subpackage, you can use relative paths. But with these, the “normal use” method do not work. But the “package use” also do not work. Instead, use the next command, if you are in 📁 package/
, in order to evaluate script.py
:
$ perfassess -s src/subpackage/script.py \\
-f function_name \\
-o output_directory/ \\
--package src/__init__.py \\
--subpackage src/subpackage/__init__.py \\
-a argument.yml
In addition of the previous “normal use” and “package use” method, you have to indicate two __init__.py
files. The first one is the top package __init__.py
file. The second one is the __init__.py
file of the subpackage to test.
Note 📝
Packages are identify with
__init__.py
files and allow relatives import.
🔍 Describing possible parameters
Argument | Mandatory? | Type and usage | Description |
---|---|---|---|
-s --script |
Yes | -s script.py |
The script that contain the function to test. |
-o --output |
Yes | -o output_directory/ |
The directory where the plot have to be produced. |
-f --function |
No | -f main |
The function to test. |
-a --argument |
No | -a argument.yml |
The argument to passe to the function to test*. |
--n_field |
No | -n_field 2 |
The number of field to keep**. |
--package |
No | --package package/__init__.py |
The __init__.py file of the top package to test. |
--subpackage |
No | -o package/subpackage/__init__.py |
The __init__.py file of the subpackage to test. |
-h --help |
No | Flag | Display the help and exit the program. |
-v --version |
No | Flag | Display the version and exit the program. |
- * = If you want to test a function that requires arguments, you can give to the command line interface a
argument.yml
file that contains all required arguments. If the tested function requires an argument liketoto
, you can put in the YAML file:
toto: 10
- ** = In memory usage, tested functions are going to be named something like
/home/user/Documents/program/package/script.py
. To shorten the name, use the--n_field
tag. For instance, giving 2 will let know to the program that you want to only keep the last two field, which in the end will look something like:package/script.py
.
🙇♂️ Aknowledgement
🔍 Code reviewing: Hubert Santuz
This work is licensed under a MIT License.
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
Built Distribution
Hashes for perfassess-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32286c116ebd67efb6d2335f70960ba11a0b206b8b67c0d4306b59c583cae38b |
|
MD5 | bf989d4a1fb62bbcbda00533d28106f0 |
|
BLAKE2b-256 | 5c456926613f1f5c3fb5ba9aabc01f4b873ce2f15fbbfe71d10d875fe3d42daa |