-
Notifications
You must be signed in to change notification settings - Fork 234
Fix script to autogenerate module re-imports and __all__ attributes #7091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This script was not working ever since we moved to the src/aiida layout. :-( This also includes: - fixes for Python 3.14 (deprecations from ast module) - preservation of `from __future__` imports - fixes for compatibility with ruff
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7091 +/- ##
==========================================
- Coverage 79.61% 79.61% -0.00%
==========================================
Files 566 566
Lines 43536 43533 -3
==========================================
- Hits 34657 34654 -3
Misses 8879 8879 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| auto_content = ( | ||
| ['', '# AUTO-GENERATED'] | ||
| + ['', '# fmt: off', ''] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was necessary to remove the extra empty lines to appease ruff
| continue | ||
|
|
||
| names = [n.s for n in all_token.value.elts] | ||
| names = [n.value for n in all_token.value.elts] # type: ignore[attr-defined] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the script through mypy to make sure I haven't screwed up.
| bad_all.setdefault('__all__ is not list/tuple', []).append(str(path.relative_to(folder_path))) | ||
| continue | ||
|
|
||
| if not all(isinstance(el, ast.Str) for el in all_token.value.elts): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ast.Str has been removed in Python 3.14
| 'DUMP_PROGRESS_BAR_FORMAT', | ||
| 'ORM_TYPE_TO_REGISTRY', | ||
| 'REGISTRY_TO_ORM_TYPE', | ||
| 'DumpMode', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DumpMode is defined in _dumping.config, not here
| 'ProgressReporterAbstract', | ||
| 'RemoteOperationError', | ||
| 'StashMode', | ||
| 'StorageBackupError', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This once new
Fixes #7090