PyExecTime
PyExecTime is a python module which can be used to find the execution time of a complete or partial python code.
Version
The current version of this module is 0.0.5.
Check it by below command,
python -m pyexectime.version
Installation
You can use pip to install the module or you clone the repository from github and install it manually.
pip install pyexectime
or
git clone https://github.com/antaripchatterjee/PyExecTime.git
cd PyExecTime
python setup.py install
Usage and Application
You can use the module in two different ways.
1. Using contextlib manager PyExecTime
# % API Reference % #
class PyExecTime():
def __init__(self, file=sys.stdout):
...
def __exit__(self, exc_type, exc_val, exc_tb):
...
def __enter__(self):
...
Follow the below code to understand the usage of the contextlib manager class PyExecTime.
from pyexectime.inspector import PyExecTime
with PyExecTime():
for i in range(10000):
print(i, end = ' ')
The above code will generate the below output.
0 1 2 3 ....
....
....
.... 9998 9999
[Sat Mar 6 12:41:44 2021 PyExecTime(main.py) <3:5>] -> Execution took 0.000039 seconds
2. Using decorator function py_exec_time
# % API Reference % #
def py_exec_time(file=sys.stdout):
def wrapper(fn):
@wraps(fn)
def inner(*argv, **kwargv):
...
return inner
return wrapper
The same objective can be done using a following code
from pyexectime.inspector import py_exec_time
@py_exec_time()
def write_number(r):
for i in range(r):
print(i, end = ' ')
write_number(10000)
And the output will be,
0 1 2 3 ....
....
....
.... 9998 9999
[Sat Mar 6 12:41:44 2021 PyExecTime(main.py) <@write_number:8>] -> Execution took 0.000035 seconds
License
The module has been licensed under MIT license.
Development
Currently this python module is in BETA stage but it can be used safely.
Metadata
Release files for PyExecTime 0.0.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 |
|---|---|---|---|---|
| PyExecTime-0.0.5.tar.gz | 4.4 kB | Without provenance | Details for PyExecTime-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyExecTime-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for PyExecTime-0.0.5-py3-none-any.whl |
Total release size: 9.1 kB
Release files / PyExecTime-0.0.5.tar.gz
| Download URL | PyExecTime-0.0.5.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0777c29e585c353ef96081c3c0e123852ee449dee5ac3ce699d00b4b256e7fbe
|
|
BLAKE2b-256 checksum How to use checksums |
8c2a0c620989544496c587933119de7e2410471198c68bad834d443033dc0f56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/54.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
|
Release files / PyExecTime-0.0.5-py3-none-any.whl
| Download URL | PyExecTime-0.0.5-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e38811a03eb1ca267d8c30852a8c8d3ad91b4d523771de1f35238e4494ff1a62
|
|
BLAKE2b-256 checksum How to use checksums |
8a4c5a860720c2d06cf939199138d93593d6a0b56f5d959ca8fe7a6b5264c44b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/54.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
|
Security for PyExecTime 0.0.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.