Sometimes you need sophisticated line-by-line profiling for optimizing your Python code. Other times, you just want a quick and basic memory profile chart.
There are plenty of tools for the former use-case, e.g. py-spy or vprof. But not many (or any) tools for the latter use-case.
profile-this is a stupid simple memory profiler for people who just want a basic memory profiling plot without writing one from scratch.
Links
Example
Install it like this:
pip install profile-this
Do this:
from random import randint
from profile_this import ProfileThis
def func(n=10_000_000):
return sum([randint(0, i + 1) for i in range(n)])
profiler = ProfileThis()
profiler.start()
func()
profiler.stop()
profiler.plot(
title="Profile for func", path="docs/func.png"
)
Or this:
with ProfileThis() as profiler:
func()
profiler.plot(
title="Profile for func",
path="docs/func.png",
)
Or this:
from profile_this import profilethis
@profilethis(title="Profile for func", path="docs/func.png")
def func(n=10_000_000):
return sum([randint(0, i + 1) for i in range(n)])
func()
To get this:
Metadata
Release files for profile-this 0.1.10
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 |
|---|---|---|---|---|
| profile_this-0.1.10.tar.gz | 3.6 kB | Without provenance | Details for profile_this-0.1.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| profile_this-0.1.10-py3-none-any.whl | Python 3 | none | any | Details for profile_this-0.1.10-py3-none-any.whl |
Total release size: 7.9 kB
Release files / profile_this-0.1.10.tar.gz
| Download URL | profile_this-0.1.10.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9db0c7d80741f1999b11bab2aa1616b86f590c18a29c8f1c94ce3b5b4f485dc4
|
|
BLAKE2b-256 checksum How to use checksums |
9042212c15ef692efbc472ab32a7bbeba858240172109571524a8d8105f8fa3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.3 Darwin/22.6.0
|
Release files / profile_this-0.1.10-py3-none-any.whl
| Download URL | profile_this-0.1.10-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
add75006f131651dd157b97bb32aedcc9c0efbb188673a4cfc938ddcc94c87c1
|
|
BLAKE2b-256 checksum How to use checksums |
1526cae4baef9be924a9e9b2afb501f10ee0d0ec7c4974409e91ae18ed9ae5e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.3 Darwin/22.6.0
|
Security for profile-this 0.1.10
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.