The bio
package provides utilities for profiling python code.
pip install bio
import bio
@bio.profile()
def my_functon():
# Do stuff here
Using the @bio.profile()
decorator with no arguments will simply print
the output to stdout
. Alternatively, you can provide the file location
for the profiler output.
@bio.profile("/path/to/file.prof")
def my_functon():
# Do stuff here
In the example shown above, the output will be written to both stdout
and the given file location. If you would prefer not to write to stdout
you can use the quiet=True
option.
@bio.profile("/path/to/file.prof", quiet=True)
def my_functon():
# Do stuff here
import bio
with bio.profiler("/path/to/file.prof"):
# Do stuff here
Bio uses tox for testing. To run the tests, simply do:
tox
The configuration for tox can be found in the tox.ini file. Bio uses pytest as the preferred testing framework. Prior to running the tests, tox will execute an auto-formatting tool called black. After the tests have completed, tox will create the coverage badge (shown at the top of this page) using the coverage_badge tool.