Skip to content

Modernise onetimepass for Python 3.8+ - #35

Merged
tadeck merged 1 commit into
masterfrom
claude/repo-analysis-9j2dla
Jun 21, 2026
Merged

Modernise onetimepass for Python 3.8+#35
tadeck merged 1 commit into
masterfrom
claude/repo-analysis-9j2dla

Conversation

@tadeck

@tadeck tadeck commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Modernises the library to a clean Python 3.8+ release (v2.0.0). The HOTP/TOTP cryptography is unchanged; the public API behaviour is the same, aside from the constant-time hardening which is transparent to callers.

Changes

Core (onetimepass/__init__.py)

  • Removed the six dependency; the library now targets Python 3.8+ only.
  • Added PEP 484 type hints to all public functions and the helper.
  • Token validation (valid_hotp/valid_totp) now uses hmac.compare_digest on zero-padded strings (constant-time) instead of ==.
  • Bumped version metadata to 2.0.0.

Packaging

  • Replaced setup.py with a PEP 621 pyproject.toml (requires-python >=3.8, refreshed classifiers for 3.8–3.13, no runtime dependencies).

Requirements / tests

  • Dropped six from production requirements; swapped timecop for freezegun in the test suite.

CI / docs

  • Deleted .travis.yml; added a GitHub Actions workflow with a Python 3.8–3.13 matrix running unit tests + doctests.
  • Updated README badge (Travis → GitHub Actions) and changelog; bumped docs version.

Verification

  • python -m unittest tests → 20 passed.
  • python -m doctest onetimepass/__init__.py → passed.
  • No six/timecop references remain in source; package imports cleanly (reports version 2.0.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AzdBWLnyXWnN89YYbPxpwb


Generated by Claude Code

- Remove the six dependency; the library now targets Python 3.8+ only
- Add PEP 484 type hints to the public API
- Use constant-time comparison (hmac.compare_digest) when validating tokens
- Replace setup.py with a PEP 621 pyproject.toml (bump to 2.0.0)
- Swap timecop for freezegun in the test suite
- Replace Travis CI with a GitHub Actions matrix (Python 3.8-3.13)
- Update README badge/changelog and docs version

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AzdBWLnyXWnN89YYbPxpwb
@tadeck
tadeck merged commit 02ca80f into master Jun 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants