Skip to content

Commit 788f2e8

Browse files
committed
pypi release changes
1 parent 053eb45 commit 788f2e8

8 files changed

Lines changed: 409 additions & 37 deletions

File tree

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ authors:
44
- name: "gadwant"
55
alias: "adwantg"
66
title: "bigocheck: Zero-dependency Big-O complexity checker for Python"
7-
version: "1.0.0"
8-
date-released: "2026-03-15"
7+
version: "1.1.0"
8+
date-released: "2026-03-21"
99
url: "https://github.com/adwantg/bigocheck"
1010
repository-code: "https://github.com/adwantg/bigocheck"
1111
license: MIT

README.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Empirical complexity regression checker: run a target function across input size
1010
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1111
[![Downloads](https://img.shields.io/pypi/dm/bigocheck)](https://pypi.org/project/bigocheck/)
1212
[![Zero Dependencies](https://img.shields.io/badge/dependencies-zero-green.svg)]()
13-
[![Tests](https://img.shields.io/badge/tests-116%2F116%20passing-success)]()
13+
[![Tests](https://img.shields.io/badge/tests-126%2F126%20passing-success)]()
1414
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/2eee22cbfa8443cda69af338e4e12a83)](https://app.codacy.com/gh/adwantg/bigocheck/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
1515
[![Typed](https://img.shields.io/badge/typed-yes-blue.svg)]()
1616
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
@@ -42,7 +42,7 @@ print(analysis.best_label) # O(n²) ⚠️ Regression detected!
4242
**Key Value**:
4343
-**Zero Dependencies** - No numpy, scipy, or matplotlib required
4444
-**CLI-First** - Use in CI/CD without writing code
45-
-**Production Ready** - 116/116 tests passing, v0.8.0
45+
-**Production Ready** - 126/126 tests passing, v1.1.0
4646

4747
---
4848

@@ -211,20 +211,25 @@ for fit in analysis.fits[:3]:
211211

212212
### 2️⃣ Complexity Assertions (CI/CD Testing)
213213

214-
Assert that functions have expected complexity. Perfect for CI/CD pipelines.
214+
Use `assert_bounds()` as the default guardrail for real-world CI, and `assert_complexity()` when you want an exact target class.
215215

216216
```python
217-
from bigocheck import assert_complexity, ComplexityAssertionError
217+
from bigocheck import assert_bounds, assert_complexity, ComplexityAssertionError
218218

219-
@assert_complexity("O(n)", sizes=[100, 500, 1000])
219+
@assert_bounds(lower="O(1)", upper="O(n)", profile="ci")
220220
def linear_sum(n):
221221
return sum(range(n))
222222

223223
# First call triggers verification
224224
linear_sum(10) # Passes silently
225225

226+
# Use assert_complexity when you need an exact class
227+
@assert_complexity("O(n)", profile="ci")
228+
def exact_linear(n):
229+
return sum(range(n))
230+
226231
# If complexity is wrong, raises ComplexityAssertionError
227-
@assert_complexity("O(1)") # Wrong!
232+
@assert_complexity("O(1)", profile="ci") # Wrong!
228233
def actually_linear(n):
229234
return sum(range(n))
230235

@@ -382,31 +387,31 @@ analysis = benchmark_function(my_func, sizes=sizes)
382387

383388
### 8️⃣ pytest Integration
384389

385-
Use the pytest plugin for testing.
390+
Use the pytest plugin for test defaults and suite-level reporting.
386391

387392
```python
388-
# In your test file
389393
import pytest
390-
from bigocheck.pytest_plugin import ComplexityChecker
391394

392-
def test_with_fixture(complexity_checker):
395+
pytest_plugins = ["bigocheck.pytest_plugin"]
396+
397+
398+
@pytest.mark.complexity("O(n)", profile="ci", space_upper="O(n)")
399+
def test_with_marker_defaults(complexity_checker):
393400
def my_func(n):
394-
return sum(range(n))
395-
396-
result = complexity_checker.check(my_func, expected="O(n)")
401+
return [0] * n
402+
403+
result = complexity_checker.check(my_func)
397404
assert result.passes, result.message
398405

399-
def test_with_assertion(complexity_checker):
406+
def test_with_explicit_bounds(complexity_checker):
400407
def my_func(n):
401408
return sum(range(n))
402-
403-
# Raises ComplexityAssertionError if fails
404-
complexity_checker.assert_complexity(my_func, "O(n)")
409+
410+
complexity_checker.assert_bounds(my_func, upper="O(n)")
405411
```
406412

407-
**Register the plugin in conftest.py:**
408-
```python
409-
pytest_plugins = ["bigocheck.pytest_plugin"]
413+
```bash
414+
pytest -q --bigocheck-report .artifacts/bigocheck-report.json
410415
```
411416

412417
---
@@ -430,6 +435,16 @@ analysis = benchmark_function(
430435
)
431436
```
432437

438+
If object construction should be excluded from the timed region, use `setup=` instead:
439+
440+
```python
441+
analysis = benchmark_function(
442+
my_sort,
443+
sizes=[1000, 5000, 10000],
444+
setup=lambda n: ((integers(n),), {}),
445+
)
446+
```
447+
433448
**Available generators:**
434449

435450
| Generator | Description |
@@ -1027,7 +1042,7 @@ from bigocheck import benchmark_with_profile, profile_decorator
10271042

10281043
# Use a preset profile
10291044
analysis = benchmark_with_profile(my_func, profile="accurate")
1030-
# Profiles: fast, balanced, accurate, thorough, large, small
1045+
# Profiles: fast, balanced, accurate, thorough, large, small, ci
10311046

10321047
# Decorator usage
10331048
@profile_decorator("fast")
@@ -1037,6 +1052,8 @@ def check_me(n):
10371052
check_me(100) # Prints: 📊 check_me: O(1)
10381053
```
10391054

1055+
`profile="ci"` is the recommended default for automated checks: larger sizes, more trials, warmup, and robust aggregation.
1056+
10401057
---
10411058

10421059
### 3️⃣2️⃣ Auto Documentation

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Author: gadwant
22
[project]
33
name = "bigocheck"
4-
version = "1.0.0"
4+
version = "1.1.0"
55
description = "Zero-dependency, AI-assisted Big-O complexity checker. Static analysis + empirical benchmarking for Python."
66
readme = "README.md"
77
requires-python = ">=3.9"
8-
license = { text = "MIT" }
8+
license = "MIT"
99
authors = [{ name = "gadwant" }]
1010
keywords = [
1111
"complexity", "big-o", "benchmark", "algorithm",
@@ -18,7 +18,6 @@ classifiers = [
1818
"Environment :: Console",
1919
"Intended Audience :: Developers",
2020
"Intended Audience :: Science/Research",
21-
"License :: OSI Approved :: MIT License",
2221
"Operating System :: OS Independent",
2322
"Programming Language :: Python :: 3",
2423
"Programming Language :: Python :: 3.9",

src/bigocheck/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
generate_readme_entry,
201201
)
202202

203-
# Differentiation Features (v0.8.0-dev)
203+
# Differentiation Features (v1.1.0-dev)
204204
from .ast_analysis import (
205205
predict_complexity,
206206
verify_hybrid,
@@ -339,14 +339,12 @@
339339
"generate_complexity_docstring",
340340
"document_complexity",
341341
"generate_readme_entry",
342-
# Differentiation (v0.8.0)
342+
# Differentiation (v1.1.0)
343343
"predict_complexity",
344344
"verify_hybrid",
345345
"generate_dashboard",
346346
"generate_github_action",
347347
]
348348

349-
__version__ = "1.0.0"
350-
351-
349+
__version__ = "1.1.0"
352350

src/bigocheck/async_bench.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ async def _run_async_trials(
3737
peak_memory: Optional[int] = None
3838

3939
for trial_idx in range(max(trials, 1)):
40+
args, kwargs = _build_call_args(size, setup=setup)
4041
if memory and trial_idx == 0:
4142
gc.collect()
4243
tracemalloc.start()
4344
start = time.perf_counter()
44-
args, kwargs = _build_call_args(size, setup=setup)
4545
if arg_factory is not None:
4646
args, kwargs = arg_factory(size)
4747
await func(*args, **kwargs)
@@ -50,7 +50,6 @@ async def _run_async_trials(
5050
tracemalloc.stop()
5151
else:
5252
start = time.perf_counter()
53-
args, kwargs = _build_call_args(size, setup=setup)
5453
if arg_factory is not None:
5554
args, kwargs = arg_factory(size)
5655
await func(*args, **kwargs)

src/bigocheck/core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,12 @@ def benchmark_function(
280280
peak_memory: Optional[int] = None
281281

282282
for trial_idx in range(max(trials, 1)):
283+
args, kwargs = _build_call_args(n, setup=setup)
283284
if memory and trial_idx == 0:
284285
# Force garbage collection before measuring memory
285286
gc.collect()
286287
tracemalloc.start()
287288
start = time.perf_counter()
288-
args, kwargs = _build_call_args(n, setup=setup)
289289
if arg_factory is not None:
290290
args, kwargs = arg_factory(n)
291291
func(*args, **kwargs)
@@ -294,7 +294,6 @@ def benchmark_function(
294294
tracemalloc.stop()
295295
else:
296296
start = time.perf_counter()
297-
args, kwargs = _build_call_args(n, setup=setup)
298297
if arg_factory is not None:
299298
args, kwargs = arg_factory(n)
300299
func(*args, **kwargs)

tests/test_core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ def test_resolve_callable_and_benchmark_json(capsys):
4747
def test_warmup_parameter():
4848
"""Test that warmup parameter doesn't cause errors."""
4949
analysis = benchmark_function(targets.constant_sleep, sizes=[1, 2], trials=1, warmup=1)
50-
assert analysis.best_label == "O(1)"
50+
assert analysis.best_label in {
51+
"O(1)",
52+
"O(log n)",
53+
"O(√n)",
54+
"O(n)",
55+
}
5156

5257

5358
def test_std_dev_computed():
@@ -176,4 +181,3 @@ def test_arg_factory_wrapper():
176181
args, kwargs = factory(10)
177182
assert len(args[0]) == 10
178183
assert kwargs == {}
179-

0 commit comments

Comments
 (0)