chore: refactor models.py into modular package structure#960
Open
KvngMikey wants to merge 1 commit intocashubtc:mainfrom
Open
chore: refactor models.py into modular package structure#960KvngMikey wants to merge 1 commit intocashubtc:mainfrom
KvngMikey wants to merge 1 commit intocashubtc:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #960 +/- ##
==========================================
+ Coverage 74.90% 74.99% +0.08%
==========================================
Files 99 109 +10
Lines 11685 11727 +42
==========================================
+ Hits 8753 8795 +42
Misses 2932 2932 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull request overview
Refactors cashu/core/models.py into a cashu/core/models/ package, splitting API request/response models into focused modules and centralizing re-exports via a package __init__.py.
Changes:
- Replaced the monolithic
cashu/core/models.pywith a modularcashu/core/models/package (info/keys/mint/melt/swap/etc.). - Added a barrel-export
cashu/core/models/__init__.pyfor API models. - Updated a few import sites to pull core types directly from
cashu.core.base.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/fuzz/test_fuzz_mint_api_deprecated.py | Switches imports for shared base models from cashu.core.models to cashu.core.base. |
| tests/fuzz/test_fuzz_mint_api.py | Switches imports for shared base models from cashu.core.models to cashu.core.base. |
| cashu/mint/auth/server.py | Consolidates base-type imports from cashu.core.base and removes cashu.core.models import. |
| cashu/core/models/init.py | Barrel-exports API request/response models from the new submodules. |
| cashu/core/models/blind_auth.py | New dedicated module for blind-auth API request/response models. |
| cashu/core/models/check.py | New dedicated module for check-state API request/response models (incl. deprecated). |
| cashu/core/models/info.py | New dedicated module for mint info API models (incl. deprecated preprocessing). |
| cashu/core/models/keys.py | New dedicated module for keys/keysets API response models (incl. deprecated). |
| cashu/core/models/melt.py | New dedicated module for melt API request/response models (incl. deprecated). |
| cashu/core/models/melt_quote.py | New dedicated module for melt-quote API models and conversion helper. |
| cashu/core/models/mint.py | New dedicated module for mint API request/response models (incl. deprecated). |
| cashu/core/models/mint_quote.py | New dedicated module for mint-quote API models and conversion helper. |
| cashu/core/models/restore.py | New dedicated module for restore API request/response models (incl. deprecated). |
| cashu/core/models/swap.py | New dedicated module for swap API request/response models (incl. deprecated). |
| cashu/core/models.py | Removes the prior monolithic module in favor of the package structure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5fb8e8f to
2fe17ec
Compare
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.
Fixes #951
Summary
Refactors
cashu/core/models.pyinto a module, splitting the monolithic file into focused submodules grouped by API concern.Changes
cashu/core/models.pyhas been replaced with acashu/core/models/package containing focused submodules__init__.pybarrel-exports all public classes from the submodules, so all existing import sites across the codebase continue to work without any changes and pointed back test files relying on BlindedMessage and Proof incorrectly exported frommodelsfile to the correctbasefile.