-
Notifications
You must be signed in to change notification settings - Fork 130
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
Miscellaneous updates #901
Conversation
Hello @ZviBaratz, Thank you for updating! Cheers! There are no style issues detected in this Pull Request. 🍻 To test for issues locally, Comment last updated at 2021-02-26 10:11:22 UTC |
…a couple of rst linting issues.
…gth=99 rule specified in setup.cfg.
@oesteban @effigies I'm taking a lot of liberty introducing new development dependencies and tidying up whatever I can. There are quite a few "aesthetic" changes I'm proposing (e.g. using |
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.
Thanks much for this effort. I left a few comments, but this is very much needed.
from mriqc.utils.bids import collect_bids_data | ||
from mriqc.utils.misc import reorder_csv |
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.
from mriqc.utils.bids import collect_bids_data | |
from mriqc.utils.misc import reorder_csv | |
from .bids import collect_bids_data | |
from .misc import reorder_csv |
Why absolute imports here?
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.
Absolute imports are recommended, as they are usually more readable and tend to be better behaved (or at least give better error messages) if the import system is incorrectly configured (such as when a directory inside a package ends up on sys.path):
import mypkg.sibling from mypkg import sibling from mypkg.sibling import exampleHowever, explicit relative imports are an acceptable alternative to absolute imports, especially when dealing with complex package layouts where using absolute imports would be unnecessarily verbose:
from . import sibling from .sibling import exampleStandard library code should avoid complex package layouts and always use absolute imports.
Implicit relative imports should never be used and have been removed in Python 3.
On this advice, I've generally been moving toward absolute imports when I update code.
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.
Hmmm, that would mandate to run unit tests after installing or explicitly manipulating the PYTHONPATH, correct?
I'm not convinced it is more readable and given that the recommendation is pretty soft, I honestly would rather keep the relative imports.
On the plus side, relative imports help black not to reorder the imports wrongly, alphabetically -- which is another PEP8 recommendation.
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.
Hmmm, that would mandate to run unit tests after installing or explicitly manipulating the PYTHONPATH, correct?
If I understand correctly then no, it shouldn't require that, but in any case let me know whatever you decide, of course I have no problem changing it back if you think it's better.
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.
autodoc
might require adding sys.path.insert(0, os.path.abspath("../../"))
, but considering the documentation seems to be building successfully, it doesn't seem to be an issue.
from mriqc.workflows.anatomical import anat_qc_workflow | ||
from mriqc.workflows.functional import fmri_qc_workflow |
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.
why absolute imports?
from mriqc.workflows.anatomical import anat_qc_workflow | ||
from mriqc.workflows.functional import fmri_qc_workflow |
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.
absolute imports
|
||
def init_mriqc_wf(): | ||
"""Create a multi-subject MRIQC workflow.""" | ||
from .. import config | ||
from mriqc import config |
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.
absolute import
Co-authored-by: Oscar Esteban <code@oscaresteban.es>
Another question regarding |
Nope, those lazy imports respond to a design problem of Nipype and the Linux compilation of cPython.
So, although they are annoying to read, our tendency is going more and more towards these lazy imports. |
@oesteban Thank you! I really appreciate the clear explanation. No problem, lazy imports it is. Also, it seems I managed to break something already - |
Looking at the logs, the execution of |
I recreated the |
Let me know if there's any verdict regarding absolute imports - I think once that's resolved this PR could be merged, unless there's anything else in this "general scope" of updates that you think would best be included here. |
Hi @ZviBaratz, is there any chance this could be split into separate PRs? With 98 files touched, it's going to be hard to find time to review this in a single go. For instance, reformatted docs would be an easy PR to review in isolation. I don't know if @oesteban has been able to follow along more closely, and if so, I'm happy to let him finish this review off. |
@effigies other than separating the documentation changes from the rest of the updates (which should be trivial), isolating other changes might be somewhat challenging due to the project-wide actions made to fix linting issues and standardize code formatting. I realize this makes for a somewhat troublesome review, however, if we can get this one massive PR out of the way, in the future I promise to behave. |
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
21.0.0rc2 First official release after migrating the repository into the *NiPreps*' organization. This release updates the Docker image with up-to-date dependencies, updates *MRIQC*'s codebase to the latest *NiTransforms* and includes some minor bugfixes. Finally, this release also contains a major code style overhaul by Zvi Baratz. With thanks to @ZviBaratz, @nbeliy, @octomike, @benkay86, @verdurin, and @utooley for their contributions. * FIX: ``template_resolution`` deprecation warning (#941) * FIX: Set entity ``datatype`` in ``BIDSLayout`` queries (#942) * FIX: T2w image of MNI template unavailable in Singularity (#940) * FIX: Release process -- Docker deployment not working + Python package lacks WebAPI token (#938) * FIX: Revise building documentation at RTD after migration (#935) * FIX: Final touch-ups in the maintenance of Docker image + CI (#928) * FIX: Update unit tests (#927) * FIX: Update dependencies and repair BOLD workflow accordingly (#926) * FIX: Update dependencies and repair T1w workflow accordingly (#925) * FIX: Set ``matplotlib`` on ``Agg`` output mode (#892) * ENH: Optimize *PyBIDS*' layout initialization (#939) * ENH: Refactored long strings to a :mod:`mriqc.messages` module (#901) * ENH: Refactored :mod:`mriqc.interfaces.common` module (#901) * DOC: Various fixes to "Running mriqc" section (#897) * MAINT: Updates to ``CONTRIBUTORS.md`` file * MAINT: Revise Docker image settings & CircleCI (#937) * MAINT: Finalize transfer to ``nipreps`` organization (#936) * MAINT: Relicensing to Apache-2.0, for compliance with *NiPreps* and prior transfer to the org (#930) * MAINT: New Docker layer caching system of other *NiPreps* (#929) * MAINT: Code style overhaul (#901) * MAINT: Update ``Dockerfile`` and catch-up with *fMRIPrep*'s (#924) * STY: Run ``black`` at the top of the repo (#932)
Getting a little acquainted with the codebase and proposing a few fixes and updates.