Upgrade to Python 3.12 and latest dependencies#39
Open
omerXfaruq wants to merge 5 commits intomasterfrom
Open
Conversation
added 5 commits
November 22, 2025 21:19
Major upgrades:
- Python: 3.10 → 3.12
- FastAPI: 0.70.1 → 0.121.3
- Pydantic: 1.8.2 → 2.12.4 (v1 → v2 migration)
- SQLAlchemy: 1.4.28 → 2.0.44
- SQLModel: 0.0.4 → 0.0.27
- Uvicorn: 0.16.0 → 0.38.0
- All other dependencies upgraded to latest versions
Code changes:
- Migrated from deprecated asyncio.get_event_loop() to asyncio.run()
- Replaced @app.on_event('startup') with lifespan context manager
- Updated Pydantic v1 API to v2:
* .dict() → .model_dump()
* .from_orm() → .model_validate()
- Fixed Pydantic v2 validation issues:
* Added default None to all Optional fields
* Added ConfigDict(extra='ignore') to handle Telegram's extra fields
* Fixed type mismatches (message_id: str→int, is_bot: str→bool)
- Removed built-in modules from requirements (asyncio, typing, datetime)
- Added missing dependencies (yfinance, pytest-asyncio)
- Optimized pyngrok import to be conditional
Testing:
- Refactored test suite into organized classes (55 unit tests)
- Added comprehensive E2E test suite (16 tests)
- Fixed pre-existing test bugs
- All 71 tests passing
Documentation:
- Updated repro.md with Python 3.12 and venv instructions
- Added .gitignore for venv and common files
- Added run_locally.sh script (uses environment variables for tokens)
Infrastructure:
- Created Python 3.12 virtual environment
- Updated requirements.in and requirements.txt
- All code compatible with Python 3.12 and latest packages
- Added python-dotenv to load environment variables from .env file - Updated src/__init__.py to automatically load .env file on startup - Created .env.example as a template for users - Updated run_locally.sh with instructions about .env file - Environment variables can now be set via .env file or exported directly - .env file is already in .gitignore to prevent committing secrets
- Merged setup instructions from repro.md into README.md - Added .env configuration instructions - Added testing section - Removed redundant repro.md file - Standard practice: all setup info in README.md
This reverts commit 5287d53.
- Fixed .env file loading order: load_dotenv() must be called before importing Events (Events.TOKEN is evaluated at class definition time) - Removed all venv mentions from repro.md - Added Configuration section documenting .env file usage - Fixed NGROK_AUTH_TOKEN to NGROK_TOKEN in documentation - .env file now properly loads before Events class is evaluated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Major upgrades:
Code changes:
Testing:
Documentation:
Infrastructure: