Metadata-Version: 2.4
Name: cm-time
Version: 1.0.2
Summary: A simple context manager that measures time using perf_counter()
Author: 34j
License-Expression: CC0-1.0
Project-URL: Bug Tracker, https://github.com/34j/cm-time/issues
Project-URL: Changelog, https://github.com/34j/cm-time/blob/main/CHANGELOG.md
Project-URL: documentation, https://cm-time.readthedocs.io
Project-URL: repository, https://github.com/34j/cm-time
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# cm-time

<p align="center">
  <a href="https://github.com/34j/cm-time/actions/workflows/ci.yml?query=branch%3Amain">
    <img src="https://img.shields.io/github/actions/workflow/status/34j/cm-time/ci.yml?branch=main&label=CI&logo=github&style=flat-square" alt="CI Status">
  </a>
  <a href="https://cm-time.readthedocs.io">
    <img src="https://img.shields.io/readthedocs/cm-time.svg?logo=read-the-docs&logoColor=fff&style=flat-square" alt="Documentation Status">
  </a>
  <a href="https://codecov.io/gh/34j/cm-time">
    <img src="https://img.shields.io/codecov/c/github/34j/cm-time.svg?logo=codecov&logoColor=fff&style=flat-square" alt="Test coverage percentage">
  </a>
</p>

A simple context manager and decorator for measuring execution time with `perf_counter()`.

**Documentation**: <https://cm-time.readthedocs.io>

**Source Code**: <https://github.com/34j/cm-time>

## Installation

```shell
pip install cm-time
```

## Usage

```python
from cm_time import timer

with timer() as t:
    pass

print(t.elapsed)
```

Output:

```text
Elapsed time: 0.000
0.0
```

```python
from cm_time import timer_wrapped


@timer_wrapped()
def foo():
    pass
```

Output:

```text
foo: Elapsed time: 0.000
```
