Skip to content

Commit f9d6dd5

Browse files
committed
Bump version to 2.0.0
Breaking change: __init__.py renamed to ksuid.py (import path unchanged). New features: lowercase base36, secure tokens, __slots__, Python 3.9+. See CHANGELOG.md for full details. https://claude.ai/code/session_01PVPVUNWhpxVa3xbDDBnwp2
1 parent 297848e commit f9d6dd5

File tree

2 files changed

+44
-13
lines changed

2 files changed

+44
-13
lines changed

CHANGELOG.md

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,45 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.0] - 2026-02-06
9+
10+
### Added
11+
- Lowercase base36 encoding (`0-9a-z`, 31 characters) for case-insensitive contexts
12+
- `KSUID.to_base36()` / `KSUID.from_base36()` instance and class methods
13+
- `generate_lowercase()` — sortable KSUID as lowercase base36 string
14+
- `generate_token()` — secure 160-bit random token (no timestamp), base62
15+
- `generate_token_lowercase()` — secure 160-bit random token, base36
16+
- `from_base36()` module-level convenience function
17+
- `__slots__` on KSUID class for memory efficiency
18+
- Thread-safety tests (concurrent generation across 4 threads)
19+
- CI matrix: Python 3.9, 3.10, 3.11, 3.12, 3.13, 3.14
20+
- CLI `--count` upper bound (1,000,000) to prevent memory exhaustion
21+
- Edge-case tests: zero-value round-trip, max-timestamp round-trip, base62 overflow
22+
23+
### Fixed
24+
- `_base62_decode` raised uncontrolled `OverflowError` on crafted input exceeding 20-byte max; now raises `ValueError`
25+
- `_base62_encode` returned single-char `"0"` for all-zero input instead of 27-char padded string
26+
- `__eq__` returned `False` instead of `NotImplemented` for non-KSUID types
27+
- `PrefixedKSUID.create` allowed underscores in prefixes but `parse` couldn't round-trip them
28+
- CI workflow referenced nonexistent `python -m ksuid.cli` module path
29+
- KSUID epoch comment said "January 1, 2014" but value is May 13, 2014
30+
- Flaky smoke test using 1ms sleep for 1-second resolution timestamps
31+
- Unicode emoji in print statements caused `UnicodeEncodeError` on Windows (cp1252)
32+
- `_validate_count` raised `ValueError` instead of `ArgumentTypeError` for non-numeric input
33+
34+
### Changed
35+
- **BREAKING**: Renamed `__init__.py` to `ksuid.py` (fixes Windows imports; `from ksuid import ...` still works)
36+
- Minimum Python version lowered from 3.13 to 3.9
37+
- `_base62_decode` uses O(1) dict lookup instead of O(n) `str.index()`
38+
- `create_api_key()` / `create_session_id()` now use `generate_token()` (no timestamp leakage)
39+
- Upgraded `actions/setup-python` from v4 to v5
40+
- Removed `sys.path.insert` hacks from all files
41+
- Applied `black` formatting across entire codebase
42+
43+
### Security
44+
- `generate_token()` / `generate_token_lowercase()` use `secrets.token_bytes` for 160-bit entropy with no embedded timestamp
45+
- Added security warnings to `create_api_key()` / `create_session_id()` docstrings
46+
847
## [1.0.0] - 2025-07-02
948

1049
### Added
@@ -16,23 +55,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1655
- Zero external dependencies
1756
- Command-line interface (CLI) with generate, inspect, compare, and benchmark commands
1857
- Stripe-style prefixed ID examples and utilities
19-
- Comprehensive test suite with 268 test cases
20-
- Performance benchmarks (459,856+ KSUIDs/second with Python 3.13)
58+
- Comprehensive test suite
59+
- Performance benchmarks
2160
- Complete API documentation and usage examples
22-
- Production-ready Flask API examples
23-
- Database integration examples (SQLite)
24-
- Industry adoption documentation and best practices
25-
26-
### Performance
27-
- Generation: 459,856 KSUIDs/second
28-
- String parsing: 136,803 parses/second
29-
- Bytes parsing: 821,620 parses/second
30-
- Comparisons: 4.7M comparisons/second
3161

3262
### Compatibility
3363
- Python 3.13+ support
3464
- Cross-platform compatibility (Windows, macOS, Linux)
3565
- Thread-safe concurrent generation
3666
- Hashable for use in sets and dictionaries
3767

38-
[1.0.0]: https://github.com/tototheo/ksuid-python/releases/tag/v1.0.0
68+
[2.0.0]: https://github.com/tonyzorin/ksuid-python/compare/v1.0.0...v2.0.0
69+
[1.0.0]: https://github.com/tonyzorin/ksuid-python/releases/tag/v1.0.0

ksuid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from datetime import datetime, timezone
2626
from typing import Optional
2727

28-
__version__ = "1.0.0"
28+
__version__ = "2.0.0"
2929
__all__ = [
3030
"KSUID",
3131
"generate",

0 commit comments

Comments
 (0)