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

Enable Pylint warning unused-import #4518

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

vachram97
Copy link

@vachram97 vachram97 commented Mar 18, 2024

Contributes to #1295 (unused-import)

Changes made in this Pull Request:

  • unused-import check was enabled for pylint
  • unnecessary imports were removed
  • 2 imports were shadowed since they are internal for library part

PR Checklist

  • Tests?
    some tests are skipped on local machine
  • Docs?
    no changes are needed to docs
  • CHANGELOG updated?
    as no new functionality/bug fixes were introduced, there is nothing to add to changelog
  • Issue raised/referenced?

Developers certificate of origin


📚 Documentation preview 📚: https://mdanalysis--4518.org.readthedocs.build/en/4518/

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.

Copy link

github-actions bot commented Mar 18, 2024

Linter Bot Results:

Hi @vachram97! Thanks for making this PR. We linted your code and found the following:

Some issues were found with the formatting of your code.

Code Location Outcome
main package ⚠️ Possible failure
testsuite ⚠️ Possible failure

Please have a look at the darker-main-code and darker-test-code steps here for more details: https://github.com/MDAnalysis/mdanalysis/actions/runs/9375246198/job/25812975007


Please note: The black linter is purely informational, you can safely ignore these outcomes if there are no flake8 failures!

Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.15%. Comparing base (347a0c0) to head (e28a2a9).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4518      +/-   ##
===========================================
- Coverage    93.59%   93.15%   -0.44%     
===========================================
  Files          168       12     -156     
  Lines        21104     1067   -20037     
  Branches      3919        0    -3919     
===========================================
- Hits         19752      994   -18758     
+ Misses         894       73     -821     
+ Partials       458        0     -458     

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

Copy link
Member

@RMeli RMeli left a comment

Choose a reason for hiding this comment

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

Hi @vachram97, thanks for your contribution. The linters failure appears to be un-related to this PR.

LGTM, but given the size of the changes, we will need a few more eyes on this.

Note to self: once this is squashed-merged, the commit will need to be added to .git-blame-ignore-revs.

Copy link
Member

@RMeli RMeli left a comment

Choose a reason for hiding this comment

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

Please add yourself in the AUTHORS file. And I would still add an entry in the CHANGELOG.

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Very quickly review, apologies please take the brief comments as me only having a few minutes to review and not a reflection on the quality of the work (thank you so much for taking this task!) - @RMeli feel free to discard my review once the big things have been addressed (parmed mostly)

@@ -117,7 +117,6 @@
.. autoexception:: ApplicationError

"""
Copy link
Member

Choose a reason for hiding this comment

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

We have no tests for this module - I would suggest not touching imports here

@@ -61,8 +61,7 @@
Path,
PSAPair,
PSAnalysis,
)

)
Copy link
Member

Choose a reason for hiding this comment

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

here and everywhere else this is done, please don't remove this extra blank line - it's there for pep8 reasons

WaterOrientationalRelaxation,
AngularDistribution,
MeanSquareDisplacement,
SurvivalProbability,
)

)
Copy link
Member

Choose a reason for hiding this comment

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

as above


from . import base
from .timestep import Timestep
Copy link
Member

Choose a reason for hiding this comment

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

If I remember correctly, this is an intentional import that isn't used - we import Timestep here to not break the API since we used to have Timestep defined here (if I remember correctly? it's been a while since that happened - the plan was to remove in 3.0)

Copy link
Member

Choose a reason for hiding this comment

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

To be clear to @vachram97 : do not remove the import

@@ -21,7 +21,6 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
import warnings
from ..converters.ParmEdParser import ParmEdParser, squash_identical
Copy link
Member

Choose a reason for hiding this comment

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

This is an intentional import, the class moved but we're keeping the import here for backwards compatibility

Copy link
Member

Choose a reason for hiding this comment

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

To be clear to @vachram97 : do not remove the import


# Local imports
from . import tables
from .guessers import (
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if these are imported as part of the expected API, someone else would have to double check

Copy link
Member

Choose a reason for hiding this comment

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

topology.tables seems to be expected to be present as part of the API https://docs.mdanalysis.org/stable/documentation_pages/topology/tables.html ; we can change it for 3.0 but for this PR, these imports need to stay

I am not 100% sure about guessers — usage in https://docs.mdanalysis.org/stable/documentation_pages/topology/guessers.html seems ambiguous or indicative that it's not required. I also don't see examples in the User Guide under Guessing using mda.topology.guess_*() @lilyminium do you happen to know if we are promising anywhere that mda.topology.guess_*() exists? Could we remove these imports? I'd be in favor of removing them right now if they are not in the API.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we promise this as an official recommendation of how to use it, although people may still be using the guesser functions and they are publically available. In addition, with #3753 these functions will go away anyway (as they'll come under the DefaultGuesser class) so I am in favour of removing them here.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

So then please do the following @vachram97

  • Keep from . import tables
  • Remove from .guessers import ( ... )

@orbeckst
Copy link
Member

@RMeli can you please shepherd this PR? Thank you!

@orbeckst orbeckst mentioned this pull request Mar 26, 2024
38 tasks
@orbeckst
Copy link
Member

@vachram97 I edited your issue text so that we don't accidentally close the parent issue #1295 .

@orbeckst
Copy link
Member

@vachram97 do you still have time to work on this PR? If so, please respond to the reviews.

@orbeckst orbeckst added the close? Evaluate if issue/PR is stale and can be closed. label May 31, 2024
@orbeckst
Copy link
Member

I merged and accidentally removed a new import in transformations.py. I added it back in 4cbe32c and hopefully that's now ok.

@vachram97
Copy link
Author

I have updated the PR with all comments were addressed as requested and last version MDAnalysis/develop was merged into PR.

Tests fail on the testsuite/MDAnalysisTests/parallelism/test_multiprocessing.py test with time limit error and seems to be not related to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants