simple_python_profiler
An early look at a simple Python profiler, written in Python. Get started by typing pip install simple_python_profiler.
Description
A profiler that times every function call and reports back the top 100 slowest functions.
logs every function call means it's non-sampling, hence resource-intensive. If that's unsuitable, check out something like py-spy.
Usage:
# your-script.py
from simple_python_profiler import Profiler
if __name__ == '__main__':
with Profiler():
run_your_code()
This will decorate all your top-level functions in your modules. System (built-in) and pip-installed packages (those that go in dist-packages) are excluded.
Since the default behaviour is to not include nested functions, you can profile your nested functions too as follows:
from simple_python_profiler import profile_recursive
# your-module.py
def top_level_function():
@profile_recursive
def inner_function():
print('in inner fn')
This recursive feature relies on the codetransformer dependency. However, it has a few bugs in recent versions of Python. If you encounter runtime exceptions with simple_python_profiler, use the second, non-recursive decorator:
from simple_python_profiler import profile
# your-module.py
def top_level_function():
@profile
def inner_function():
print('in inner fn')
Releasing on PyPI
pipenv shellflit buildflit publish
Enter password when prompted.
TODO
- option to include system packages
Released under the MIT licence. See file named LICENCE for details.
Metadata
Release files for simple_python_profiler 0.2
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 | |
|---|---|---|---|---|
| simple_python_profiler-0.2.tar.gz | 7.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_python_profiler-0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / simple_python_profiler-0.2.tar.gz
| Download URL | simple_python_profiler-0.2.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
969eaa0af8ad4bf1fac4ce0880f50e8ce00b82898d2510dc9e030f27c3220d09
|
|
BLAKE2b-256 checksum How to use checksums |
deed8676340fff77e2535a1062690a361dfc6520af713cbc45cc34d27e9a4bb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Release files / simple_python_profiler-0.2-py2.py3-none-any.whl
| Download URL | simple_python_profiler-0.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ce38f672d92acafb54f74024f1b713ddfee2f13fe59e42ebc45394c538d37f55
|
|
BLAKE2b-256 checksum How to use checksums |
0d82d2556b2c19a708f2957fef128e00296c2d3fc8c6e33bc62a0b86bf673f74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Security for simple_python_profiler 0.2
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.