refactor: migrate Мирэа client to pymirea (PyPI)#10
Open
silverhans wants to merge 1 commit intomainfrom
Open
Conversation
Вместо in-tree копии Мирэа-клиента (~4.6K LoC дублирующих silverhans/pymirea) подключаем pymirea как зависимость. Все backend/services/mirea_*.py + backend/services/crypto.py + backend/utils/upstreams.py + backend/utils/circuit_breaker.py становятся тонкими re-export шимами к pymirea — никаких изменений в consumer-коде (все 'from backend.services.mirea_X' продолжают работать). Backend/main.py вызывает pymirea.configure(Config(...)) на старте с runtime-значениями versiti. Это критично для шимов — они используют модульный proxy к settings через pymirea._settings. Profit: - -4.6K LoC дублирующего Мирэа-кода - Bug-fix в скрейпере идёт в одно место (pymirea), обе кодовые базы получают его через 'pip upgrade pymirea' - Публичный OSS-пакет продолжает жить независимо от versiti/oplexx pymirea v0.1.2 уже на PyPI: https://pypi.org/project/pymirea/0.1.2/
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.
Summary
pymirea>=0.1.2с PyPIbackend/services/mirea_*.py+crypto.py+utils/upstreams.py+utils/circuit_breaker.pyстановятся тонкими re-export шимами кpymirea.<module>from backend.services.mirea_X import ...продолжают работатьbackend/main.pyвызываетpymirea.configure(Config(...))на стартеMotivation
Раньше: identical Мирэа-скрейпер жил в двух местах (versiti + Oplexx), дрейф ~2% был только в import-префиксах. Bug-fix требовал двух коммитов в двух репах.
Теперь: один канонический пакет на PyPI, обе кодовые базы через
pip install. Scraper развивается в silverhans/pymirea.Changes
backend/services/mirea_api.pybackend/services/mirea_acs.pybackend/services/mirea_auth.pybackend/services/mirea_tokens.pybackend/services/mirea_grades.pybackend/services/mirea_esports.pybackend/services/crypto.pybackend/utils/upstreams.pybackend/utils/circuit_breaker.pybackend/main.pypymirea.configure()backend/requirements.txtpymirea>=0.1.2−4665 LoC / +44 LoC
Test plan
pip install -r backend/requirements.txtв чистой venv проходитpython -m backend.mainподнимается без ошибокcurl /api/health→ 200Follow-ups
from pymirea import ...в consumer-файлах и удалить шимы — косметика, не блокирующаяRelated