Skip to content
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

FIX: Namespace packaging #42

Merged
merged 13 commits into from
Jul 14, 2023
Merged

FIX: Namespace packaging #42

merged 13 commits into from
Jul 14, 2023

Conversation

effigies
Copy link
Contributor

Fixes #40.

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +2.41 🎉

Comparison is base (4206420) 84.80% compared to head (38a93d3) 87.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
+ Coverage   84.80%   87.21%   +2.41%     
==========================================
  Files          14       14              
  Lines         704      704              
==========================================
+ Hits          597      614      +17     
+ Misses        107       90      -17     
Impacted Files Coverage Δ
bids/ext/reports/cli.py 36.95% <100.00%> (+36.95%) ⬆️
bids/ext/reports/tests/test_parameters.py 100.00% <100.00%> (ø)
bids/ext/reports/tests/test_parsing.py 100.00% <100.00%> (ø)
bids/ext/reports/tests/test_report.py 100.00% <100.00%> (ø)
bids/ext/reports/tests/test_templates.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines -46 to -49
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
hooks:
- id: mypy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My guess is this previously worked by accident. Here's what you get now:

$ mypy --explicit-package-bases bids/ext/reports
bids/ext/reports/templates/demos/python/demo.py:5: error: Module "bids" has no attribute "BIDSLayout"  [attr-defined]
bids/ext/reports/templates/demos/python/demo.py:10: error: Function is missing a return type annotation  [no-untyped-def]
bids/ext/reports/templates/demos/python/demo.py:14: error: Function is missing a type annotation  [no-untyped-def]
bids/ext/reports/templates/demos/python/demo.py:21: error: Function is missing a type annotation  [no-untyped-def]
bids/ext/reports/templates/demos/python/demo.py:39: error: Function is missing a return type annotation  [no-untyped-def]
bids/ext/reports/templates/demos/python/demo.py:39: note: Use "-> None" if function does not return a value
bids/ext/reports/utils.py:11: error: Cannot find implementation or library stub for module named "bids.layout"  [import]
bids/ext/reports/parameters.py:9: error: Cannot find implementation or library stub for module named "num2words"  [import]
bids/ext/reports/parameters.py:15: error: Cannot find implementation or library stub for module named "bids.layout"  [import]
bids/ext/reports/parameters.py:56: error: Argument 1 to "append" of "list" has incompatible type "None"; expected "int"  [arg-type]
bids/ext/reports/parameters.py:71: error: Argument 1 to "get_nb_vols" has incompatible type "List[Nifti1Image]"; expected "List[Optional[Nifti1Image]]"  [arg-type]
bids/ext/reports/parameters.py:71: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
bids/ext/reports/parameters.py:71: note: Consider using "Sequence" instead, which is covariant
bids/ext/reports/parameters.py:80: error: Argument 1 to "get_nb_vols" has incompatible type "List[Nifti1Image]"; expected "List[Optional[Nifti1Image]]"  [arg-type]
bids/ext/reports/parameters.py:80: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
bids/ext/reports/parameters.py:80: note: Consider using "Sequence" instead, which is covariant
bids/ext/reports/parsing.py:14: error: Cannot find implementation or library stub for module named "bids.layout"  [import]
bids/ext/reports/parsing.py:107: error: Module has no attribute "func_info"  [attr-defined]
bids/ext/reports/parsing.py:143: error: Module has no attribute "anat_info"  [attr-defined]
bids/ext/reports/parsing.py:174: error: Incompatible types in assignment (expression has type "int", variable has type "str")  [assignment]
bids/ext/reports/parsing.py:185: error: Module has no attribute "dwi_info"  [attr-defined]
bids/ext/reports/parsing.py:228: error: Module has no attribute "fmap_info"  [attr-defined]
bids/ext/reports/parsing.py:253: error: Module has no attribute "meg_info"  [attr-defined]
bids/ext/reports/parsing.py:362: error: Incompatible return value type (got "Optional[FileBasedImage]", expected "Optional[Nifti1Image]")  [return-value]
bids/ext/reports/report.py:14: error: Cannot find implementation or library stub for module named "bids.layout"  [import]
bids/ext/reports/cli.py:15: error: Cannot find implementation or library stub for module named "bids.layout"  [import]
bids/ext/reports/cli.py:15: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 21 errors in 6 files (checked 10 source files)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be re-added later, but fixing these issues feels out-of-scope for this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

totally outside of the scope indeed

@effigies effigies requested a review from Remi-Gau July 13, 2023 14:15
@Remi-Gau
Copy link
Contributor

@effigies
you are a gem

will look more in detail so that I better understand what I messed up.

Comment on lines +9 to +10
packages = ["bids"]
only-include = ["bids/ext/reports"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For your reference, this was the main issue: https://hatch.pypa.io/latest/config/build/#explicit-selection

Everything else just followed from fixing tests

Copy link
Contributor

@Remi-Gau Remi-Gau left a comment

Choose a reason for hiding this comment

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

thanks again

@Remi-Gau Remi-Gau merged commit 2e49ec4 into main Jul 14, 2023
17 checks passed
@Remi-Gau Remi-Gau deleted the fix/packaging branch July 14, 2023 00:34
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.

packaging as sub-package seems not to be properly done
2 participants