Skip to content

Add typing to storage/*/migrator.py and storage/sqlite_*/backend.py#7293

Merged
danielhollas merged 12 commits into
aiidateam:mainfrom
danielhollas:typing/migrator
Apr 2, 2026
Merged

Add typing to storage/*/migrator.py and storage/sqlite_*/backend.py#7293
danielhollas merged 12 commits into
aiidateam:mainfrom
danielhollas:typing/migrator

Conversation

@danielhollas
Copy link
Copy Markdown
Collaborator

Motivated by #7177

@danielhollas danielhollas requested a review from GeigerJ2 March 13, 2026 12:33
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 95.76271% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.86%. Comparing base (15454cd) to head (c52f252).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/storage/psql_dos/migrator.py 88.00% 3 Missing ⚠️
src/aiida/storage/sqlite_temp/backend.py 95.46% 1 Missing ⚠️
src/aiida/storage/sqlite_zip/backend.py 96.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7293      +/-   ##
==========================================
+ Coverage   79.85%   79.86%   +0.02%     
==========================================
  Files         566      566              
  Lines       43947    43962      +15     
==========================================
+ Hits        35088    35105      +17     
+ Misses       8859     8857       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danielhollas danielhollas changed the title Add typing to storage/*/migrator.py Add typing to storage/*/migrator.py and storage/sqlite_*/backend.py Mar 17, 2026
@danielhollas
Copy link
Copy Markdown
Collaborator Author

@GeigerJ2 I found another typing branch that I had locally adding typing the SQlite backend.py modules so I pushed it here. Please have a look. Don't worry, there's plenty of modules left to work on :-D

Comment thread src/aiida/repository/backend/sandbox.py Outdated
Comment thread src/aiida/storage/sqlite_zip/backend.py
Comment thread src/aiida/storage/sqlite_zip/backend.py

def maintain(self, dry_run: bool = False, live: bool = True, **kwargs) -> None:
def maintain(self, full: bool = False, dry_run: bool = False, **kwargs: Any) -> None:
pass
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should raise NotImplemented error? But probably for another PR

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, out of scope for this PR :)

Comment thread src/aiida/storage/sqlite_zip/backend.py
Comment thread src/aiida/repository/backend/sandbox.py Outdated

def maintain(self, dry_run: bool = False, live: bool = True, **kwargs) -> None:
def maintain(self, full: bool = False, dry_run: bool = False, **kwargs: Any) -> None:
pass
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, out of scope for this PR :)

Comment thread src/aiida/storage/sqlite_zip/backend.py
Comment thread src/aiida/storage/psql_dos/migrator.py Outdated
Comment thread src/aiida/storage/sqlite_zip/backend.py Outdated
Comment thread src/aiida/storage/sqlite_zip/backend.py
@GeigerJ2
Copy link
Copy Markdown
Collaborator

Thanks, @danielhollas! Will approve once CI has passed :)

Comment thread src/aiida/storage/sqlite_zip/backend.py Outdated
@danielhollas danielhollas requested a review from GeigerJ2 March 27, 2026 02:12
Copy link
Copy Markdown
Collaborator

@GeigerJ2 GeigerJ2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks, as always @danielhollas 🚀

return {'objects': {'count': len(list(self.list_objects()))}}

def maintain(self, dry_run: bool = False, live: bool = True, **kwargs) -> None:
def maintain(self, full: bool = False, dry_run: bool = False, **kwargs: Any) -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is a repository backend (SandboxShaRepositoryBackend), but the signature uses the storage backend convention (full, dry_run). Other repository backends like DiskObjectStoreRepositoryBackend use (dry_run, live). Both are no-ops here so it doesn't matter, but it's a bit inconsistent.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed it. The type checker did not complain about this because the maintain method is not defined in the AbstractRepositoryBackend base class. So we I think we could either remove it from here, or add it the AbstractRepositoryBackend to enforce consistency. But that's for another PR.

@danielhollas danielhollas enabled auto-merge (squash) April 2, 2026 12:47
@danielhollas danielhollas merged commit a48ea7d into aiidateam:main Apr 2, 2026
36 of 38 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