Hence the name: bn - BottleNeck. And you know keys B and N are very comfortable to type quickly in a row.
Usage:
bn('loop')
for item in generator:
bn('rabbit')
# code of rabbit
bn('turtle')
# code of turtle
bn('loop')
if bn.total > 1.0:
logging.info(bn)
Result:
TOTAL=22.2632, turtle=20.6403, rabbit=1.6209, loop=0.0020
#
# This config is default in bn>=0.1.5:
# Bn(total_key='TOTAL', format='{key}={seconds:.4f}', sep=', ')
# OR:
22.2632 TOTAL
20.6403 turtle
1.6209 rabbit
0.0020 loop
#
# This config is default in bn<=0.1.4:
# Bn(total_key='TOTAL', format='{seconds:>10.4f} {key}', sep='\n')
Install:
pip install bn
Scope:
# Global "bn" is useful to profile cross-module without passing "bn" explicitly.
from bn import bn
bn.format = custom_format
# Scoped "Bn" is useful to have multiple independent profilers.
from bn import Bn
def action():
bn = Bn(format=custom_format)
Metadata
Release files for bn 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bn-0.1.5.tar.gz | 2.1 kB | Without provenance | Details for bn-0.1.5.tar.gz |
Release files / bn-0.1.5.tar.gz
| Download URL | bn-0.1.5.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61c3f499d2aa0a1a109494f4307e419f7bce3340aa517358ea35a64eaf01b14f
|
|
BLAKE2b-256 checksum How to use checksums |
5508719260370a3072880a02f773566a6e0ba725a4db25caac91cb89565552c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for bn 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.