Skip to content

Commit 85e202e

Browse files
committed
release: bump version and update changelog for v0.2.0
1 parent 6c5a755 commit 85e202e

5 files changed

Lines changed: 57 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Added - Phase 2 Performance Optimizations
10+
## [0.2.0] - 2025-12-21
11+
12+
This release delivers significant performance improvements, usability enhancements, and infrastructure upgrades while maintaining stdlib-only purity and exact contract compliance.
13+
14+
### Contract Compliance
15+
- **Meissel-Lehmer π(x) backend**: ENABLE_LEHMER_PI now enabled by default
16+
- Sublinear O(x^(2/3)) prime counting for large x
17+
- Exact Legendre formula implementation with memoization
18+
- Dedicated lehmer.py module with comprehensive tests
19+
- **Forecast refinement levels**: Extended support for refinement_level parameter
20+
- Level 2: Higher-order PNT terms for <0.2% error at n=10^8
21+
- Level 3: Implemented and tested for ultra-precise forecasting
22+
- Maintains backward compatibility (Level 1 default)
23+
24+
### Performance
1125
- **Log caching**: LRU cache (maxsize=2048) for log_n() and log_log_n() functions
1226
- 25-35% reduction in simulation time for N≥10^6
1327
- Cache hit rate >95% in typical workloads
@@ -16,28 +30,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1630
- Maintains determinism: same seed yields identical sequence
1731
- 12 new tests validating equivalence and memory efficiency
1832
- **Dynamic β annealing**: Added `anneal_tau` parameter to simulate()
19-
- Formula: β_eff(n) = beta * (1 - exp(-n / anneal_tau)) * (beta_decay)^n
2033
- Reduces early transient variance, improves convergence stability
2134
- 14 new tests validating annealing behavior
2235
- **CDF gap sampling**: Replaced random.choices() with CDF + binary search
23-
- Performance improvement: O(k) → O(log k) per sample
36+
- Performance improvement: O(k) → O(log k) per sample (~7-8× faster)
2437
- Maintains exact probability distribution semantics
2538
- 17 new tests validating sampling correctness
2639

40+
### Usability
41+
- **Command-line interface**: Added `python -m lulzprime` CLI
42+
- Commands: resolve, pi, simulate
43+
- Support for --seed, --anneal-tau, --generator flags
44+
- Streaming output for low-memory workflows
45+
- **JSON export**: New simulation export functionality
46+
- simulation_to_json() and simulation_to_json_string() helpers
47+
- CLI --json flag for exporting results to file
48+
- Includes metadata (n_steps, seed, anneal_tau, timestamps)
49+
50+
### Infrastructure
51+
- **GitHub Actions CI**: Automated testing on push/PR
52+
- Matrix testing: Python 3.10, 3.11
53+
- Runs full test suite (258 passing tests)
54+
- Mypy type checking integrated into workflow
55+
- **mypy strict type checking**: Comprehensive type annotations
56+
- Enabled strict mode (disallow_untyped_defs, warn_return_any)
57+
- Fixed 17 typing errors across 5 modules
58+
- Python 3.10+ type hints throughout codebase
59+
2760
### Changed
2861
- simulate() signature now includes: as_generator (bool), anneal_tau (float | None)
2962
- Gap sampling implementation: bisect-based for O(log k) performance
30-
- Total tests: 169 → 225 (56 new tests)
63+
- Total tests: 169 → 258 (89 new tests)
64+
- ENABLE_LEHMER_PI default changed from False to True
3165

32-
### Performance
66+
### Performance Metrics
3367
- Simulations: 20-60% faster overall
3468
- Memory: 75% reduction with generator mode (180 MB → 45 MB for N=10^6)
3569
- Gap sampling: ~7-8× faster per sample for typical distributions
70+
- Forecast accuracy: <0.2% error at n=10^8 with refinement_level=2
3671

3772
### Notes
38-
- All optimizations maintain stdlib-only purity (no external dependencies)
39-
- Phase 2 (Performance) complete, Phase 3 (Usability) starting
40-
- Tier C statistical contracts maintained throughout
73+
- All features maintain stdlib-only purity (no external dependencies)
74+
- Backward compatible: All v0.1.2 code runs unchanged on v0.2.0
75+
- Phase 2 (Performance), Phase 3 (Usability), Phase 4 (Infrastructure) complete
4176

4277
## [0.1.2] - 2025-12-20
4378

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ LULZprime is a Python library for efficient prime number resolution using analyt
4141

4242
See `docs/PAPER_ALIGNMENT_STATUS.md` for complete performance analysis and validation results.
4343

44-
### Enable Meissel Backend
44+
### Meissel-Lehmer Backend
4545

46-
The Meissel-Lehmer backend provides O(x^(2/3)) sublinear complexity for large indices. It's opt-in by default:
46+
The Meissel-Lehmer backend provides O(x^(2/3)) sublinear complexity for large indices. **Enabled by default in v0.2.0.**
4747

4848
```python
49-
# In your code, before using lulzprime
50-
import lulzprime.config as config
51-
config.ENABLE_LEHMER_PI = True # Enable Meissel backend
52-
53-
# Now use lulzprime normally
49+
# Enabled automatically - no configuration needed
5450
import lulzprime
5551
result = lulzprime.resolve(500_000) # Fast with Meissel backend
52+
53+
# Optional: Disable if needed for backward compatibility
54+
import lulzprime.config as config
55+
config.ENABLE_LEHMER_PI = False # Revert to segmented sieve
5656
```
5757

58-
**Why opt-in?** Extensive validation complete (169/169 tests pass), but defaults preserve backward compatibility. Enablement is safe and reversible (one-line change).
58+
**Default change:** v0.2.0 enables ENABLE_LEHMER_PI=True by default. Extensive validation complete (258 tests pass). Safe and reversible.
5959

6060
**Rollback:** Simply set `ENABLE_LEHMER_PI = False` to revert to segmented sieve.
6161

@@ -238,7 +238,7 @@ This reframes primes from a brute-force enumeration problem into a navigable spa
238238

239239
## Maintenance Status
240240

241-
**Current Status:** Completed reference implementation (v0.1.2)
241+
**Current Status:** Completed reference implementation (v0.2.0)
242242

243243
LULZprime is a **finished artifact**. The implementation has achieved full paper alignment and is production-ready for indices up to 500k.
244244

@@ -254,7 +254,7 @@ LULZprime is a **finished artifact**. The implementation has achieved full paper
254254
- API will not change (backward compatibility preserved)
255255
- No new features planned (scope is deliberately limited)
256256
- All 258 tests continue to pass
257-
- Defaults remain unchanged (ENABLE_LEHMER_PI = False)
257+
- Meissel-Lehmer backend enabled by default (ENABLE_LEHMER_PI = True)
258258

259259
**Future work (out of scope):**
260260
- C/Rust port for paper-exceedance performance (10-50× gains possible)
@@ -341,7 +341,7 @@ https://roblemumin.com/library.html
341341

342342
---
343343

344-
**Status**: v0.1.2 (v0.2.0 in development) - Full paper alignment achieved ✓
344+
**Status**: v0.2.0 - Full paper alignment achieved ✓
345345

346346
**Test Coverage**: 258 passing (225 core + 15 CLI + 18 JSON export)
347347
**Validation**: resolve(500k) measured at 73.044s with Meissel backend

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "lulzprime"
7-
version = "0.1.2"
7+
version = "0.2.0"
88
description = "Prime resolution and navigation library based on OMPC"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/lulzprime/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- between_many(ranges) -> list[list[int]]: Batch range queries
2121
"""
2222

23-
__version__ = "0.1.2"
23+
__version__ = "0.2.0"
2424

2525
# Public API exports
2626
from .batch import between_many, resolve_many

tests/test_json_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_simulation_to_json_basic(self):
4747

4848
# Check meta
4949
assert json_data["meta"]["library"] == "lulzprime"
50-
assert json_data["meta"]["version"] == "0.1.2"
50+
assert json_data["meta"]["version"] == "0.2.0"
5151
assert json_data["meta"]["timestamp"] is None
5252

5353
def test_json_serializable(self):

0 commit comments

Comments
 (0)