Skip to main content

functimer

A programmatic approach to function runtime estimation.

PyPI version codecov Language grade: Python Codacy Badge Code style: black


About

This package first came about as a way to serve my needs during an Algorithms class in college.
It started as a function that stored time elapsed results in a global dictionary, where the key was a tuple of the functions name and return value. Now it's just a bit different.

Installation

  • PYPI:

        pip install functimer
    
  • Manual:

        poetry install --no-dev
        poetry build
        pip install dist/*.whl
    

How to install Poetry.

Quick Example

Comprehensive Examples in examples/

  • Python

        @timed(unit=Unit.SECOND, number=1)
        def timed_sleep(seconds):
            sleep(seconds)
    
        runtime = timed_sleep(1)
        "1.00 s"
    
  • Command Line

      $ python -m functimer "sum([1, 2, 3])"
      Average runtime of 10,000 executions: 0.15 µs
    
      $ python -m functimer "sum([1, 2, 3])" --return
      Average runtime of 10,000 executions: 0.15 µs
      sum([1, 2, 3]) -> 6
    
      $ python -m functimer "(lambda x: x+x)(10)" --return
      Average runtime of 10,000 executions: 0.14 µs
      (lambda x: x+x)(10) -> 20
    
      $ python -m functimer "functimer.util.get_unit('1.00 s')" --return
      Average runtime of 10,000 executions: 0.50 µs
      functimer.util.get_unit('1.00 s') -> Unit.SECOND
    
      $ python -m functimer "functimer.classes.Unit.from_str('s')" --return
      Average runtime of 10,000 executions: 0.25 µs
      functimer.classes.Unit.from_str('s') -> Unit.SECOND
    

Tests

Run tox in the root directory of the repo.

License

MIT

Metadata

Release files for functimer 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for functimer 1.3.1
File Size Uploaded Provenance Actions
functimer-1.3.1.tar.gz 9.2 kB Without provenance Details for functimer-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for functimer 1.3.1
File Interpreter ABI Platform Actions
functimer-1.3.1-py3-none-any.whl Python 3 none any Details for functimer-1.3.1-py3-none-any.whl

Total release size: 21.5 kB

Release files / functimer-1.3.1.tar.gz

Download URL functimer-1.3.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d803dbc470222682b9466163506b19a60dd49662dee6276176015aa4f32e1fb2
BLAKE2b-256 checksum
How to use checksums
9a0473063aa804a0606e27e6bcdf4e75a33a5e6aaf602e2ca8acf1dafa8fe135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Windows/10

Release files / functimer-1.3.1-py3-none-any.whl

Download URL functimer-1.3.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fab3fba9beaca56bde9e87f867c4761d0b300892ca5e4cea2b79a6459c7fdc7c
BLAKE2b-256 checksum
How to use checksums
4dc06f8a78a7b9dc513ceef6c434e50d747c303e7b3ddf65b629839d488a13da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Windows/10

Security for functimer 1.3.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page