Skip to content

feat: Update the project to modern Python and tooling#37

Merged
dbrattli merged 3 commits intomasterfrom
modern-python
Nov 16, 2025
Merged

feat: Update the project to modern Python and tooling#37
dbrattli merged 3 commits intomasterfrom
modern-python

Conversation

@dbrattli
Copy link
Copy Markdown
Owner

@dbrattli dbrattli commented Nov 16, 2025

feat!: Modernize OSlash to Python 3.12+ with strict type checking

This PR completes the OSlash modernization plan, bringing the codebase to Python 3.12+ with modern tooling and strict type safety.

🎯 Major Changes

Type System Modernization (Phase 3)

  • PEP 695 type parameters throughout all 22 source files
  • ✅ Replaced all TypeVar declarations with modern [T] syntax
  • ✅ Added from __future__ import annotations to all modules
  • 0 pyright errors in strict mode (was ~54 errors)
  • ✅ Minimized Any usage with justification comments
  • ✅ Fixed all type inference issues in core library

Build System & Package Management (Phase 1)

  • ✅ Migrated to uv for package management
  • ✅ Modern pyproject.toml with PEP 621 metadata
  • ✅ Configured release-please for automated versioning
  • ✅ Added uv.lock for reproducible builds
  • ❌ Removed legacy files: setup.py, setup.cfg, versioneer.py (68k lines!), MANIFEST.in, .flake8, .pylintrc, requirements.txt

Code Quality Tooling (Phase 2)

  • Ruff for linting & formatting (120 char line length)
  • Pyright strict mode with comprehensive rules
  • Pre-commit hooks configured (ruff, pyright, standard checks)
  • ✅ Fixed pyright config warning (removed invalid reportAny setting)

Code Improvements

  • ✅ Fixed test type annotations - removed all unnecessary # type: ignore comments
  • ✅ Added Callable type hints to lambda expressions in tests
  • ✅ Removed module-level aliases that lost type information
  • ✅ Fixed Observable.just to be proper @classmethod
  • ✅ Fixed oslash/do.py with proper type annotations (54 errors → 0)
  • ✅ Fixed oslash/list.py head() method with cast
  • ✅ Added missing exports (do, guard, let)

CI/CD (Phase 5)

  • ✅ Created modern .github/workflows/ci.yml
  • ✅ Created .github/workflows/release-please.yml
  • ✅ Multi-OS testing (Linux, macOS, Windows)
  • ✅ Python 3.12, 3.13, 3.14 support
  • ✅ Pre-commit runs in CI

Documentation (Phase 6)

  • ✅ Created comprehensive CLAUDE.md development guide
  • ✅ Updated README.md with Python 3.12+ requirement and type safety info

📊 Results

  • 165 tests passing with 86% code coverage
  • 0 pyright errors in main codebase (oslash/)
  • 0 warnings from tooling
  • Pre-commit hooks working without hanging
  • Net change: -68k lines (versioneer removal) + comprehensive type safety

🔧 Breaking Changes

For Users

  • ⚠️ Python 3.12+ required (was 3.8+)
  • ✅ Public API unchanged (monads work the same way)
  • ✅ Better type inference and IDE support

For Contributors

  • Must use uv for development
  • Pre-commit hooks enforced
  • Strict type checking required
  • Conventional commits for releases

📝 Files Changed

Deleted (7): setup.py, setup.cfg, versioneer.py, MANIFEST.in, .flake8, .pylintrc, requirements.txt

Created (6): .pre-commit-config.yaml, release-please-config.json, .release-please-manifest.json, .github/workflows/ci.yml, .github/workflows/release-please.yml, CLAUDE.md

Modified (~35): All source files updated with PEP 695 syntax, test files with proper types, configuration files modernized

🎓 Educational Impact

This modernization showcases Python 3.12+ best practices:

  • Modern type parameter syntax
  • Strict type checking workflows
  • Protocol-based design patterns
  • Modern Python tooling ecosystem

Perfect for learning functional programming with state-of-the-art Python!


BREAKING CHANGE: Requires Python 3.12+. This is an educational project showcasing modern Python features. For Python 3.8+ support, use version 0.6.0.

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.

1 participant