Skip to main content

Python utility for compairing functions and other callable objects.

Project description

What is measurer?

Measurer is easy to use python package for examining and comparing callable objects.

Installing

This package distributes by Python Packaging Index, aka PyPI, so you can install measurer using pip:

py -m pip install function_measurer

Quick start

Let's examine using of this package on a little example:

from measurer import setTesting

@setTesting(2, 2)
def summ(a: int, b: int): 
    return a + b

We have function and we want to test it. We use decorator setTesting for it. Arguments given to setTesting passes to summ.

Let's save this file with name sample.py. After that we open powerShell or cmd and enter this command into the shell:

py -m measurer sample.py 3 memory

And we get this:

--------------------------------------------------------
| Tests.|Functions.|Iteration 1|Iteration 2|Iteration 3|
--------------------------------------------------------
|runtime|      summ|        0.0|        0.0|        0.0|
--------------------------------------------------------

First column is tests those we have given to our package. In this case we have given only one test. That is runtime. When we give runtime test tester runs testing functions and prints their runtimes. The next column shows functions we have tested. Other columns show the results of the testing.

Detailed description of using.

The first argument in our example is the path to a file that you want to test. The second is the amount of times the functions will be tested. The third argument is test that we want to do with our functions. We can also pass more than one test to this argument and will get a table with results of those tests.

Test Description
runtime Measures the runtime of function.
memory Measures the occupied memory.

Also you can write all data into configuration file. If you named the file config.cfg you can just add --config argument when you are starting module. In other way you must add name of configure file after this argument. This is an example of this file:

[MEASURER_DATA]
module = sample.py
iters = 3
tests = runtime, memory

If you did not understand something try to use -h option. If you found some mistakes in this docs, please make a pull request with correcting of found mistake.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

function_measurer-0.3.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

function_measurer-0.3.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file function_measurer-0.3.2.tar.gz.

File metadata

  • Download URL: function_measurer-0.3.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.6

File hashes

Hashes for function_measurer-0.3.2.tar.gz
Algorithm Hash digest
SHA256 10d0fa140ac1f2f0a8d9f5b34bf0e4c3ea5d3a87e5c787d11ac4af1eefca43b4
MD5 c1781415db7210cfa734273918896c9b
BLAKE2b-256 bce0b4a9234c55a2cdcc0b9aa17194a885228478b51317de5512ac2534d828bd

See more details on using hashes here.

File details

Details for the file function_measurer-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: function_measurer-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.6

File hashes

Hashes for function_measurer-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 751ef230c38cb00e7ee6e8b9bee24de8d5e057aeb05334304d74c080a8258dab
MD5 ccf9a2755e9b557097fde8a6614a6b14
BLAKE2b-256 9700111a155a4447f4e49427640e9b106265b66740e895b33d90263769123c95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page