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

profile| Runs pylint against external code, generating profile-heatmaps #3498

Merged

Conversation

doublethefish
Copy link
Contributor

@doublethefish doublethefish commented Apr 20, 2020

Steps

  • [-] Add yourself to CONTRIBUTORS if you are a new contributor.
  • [-] Add a ChangeLog entry describing what your PR does.
  • [-] If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

Runs pylint against numpy and supports adding other external repos for testing.

Will generate a .svg in the .tox/prof. Here's an example:
https://pylint.s3.amazonaws.com/doublethefish/pylint/output.svg

Other considerations:

  • Use https gitub uri so we do not need credentials
  • Shallow clone so we don't pull more data than we need
  • Ensure we skip external profiling unless explicitly wanted

Type of Changes

Type
🔨 Refactoring

Related Issue

@coveralls
Copy link

coveralls commented Apr 20, 2020

Coverage Status

Coverage remained the same at 90.836% when pulling 899156a on doublethefish:profile/pylint_against_numpy into 3d712f2 on PyCQA:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 90.454% when pulling a1ad60e on doublethefish:profile/pylint_against_numpy into 67d0572 on PyCQA:master.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Nice addition to the code base. I think we could also clone the local pylint repository at a fixed commit (maybe the 2.4.0 tag). This way we can launch this test without having access to the internet. Most pylint developpers should also have astroid in pylint/astroid/ (we advice to clone it in the pylint directory), so that would make another repository to test on without the need to download anything.

tests/profile/test_profile_against_externals.py Outdated Show resolved Hide resolved
@doublethefish
Copy link
Contributor Author

Hey @AWhetter @PCManticore are you able to review this or shall I close the PR?

Copy link
Contributor

@AWhetter AWhetter left a comment

Choose a reason for hiding this comment

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

Apologies for taking so long to get around to this. I love the change! It'll make profiling much easier.
I've made a couple of suggested changes. Let me know what you think.

tests/profile/test_profile_against_externals.py Outdated Show resolved Hide resolved
tests/profile/test_profile_against_externals.py Outdated Show resolved Hide resolved
@doublethefish doublethefish force-pushed the profile/pylint_against_numpy branch 2 times, most recently from fc12676 to 7c73649 Compare September 1, 2020 07:22
@Pierre-Sassoulas Pierre-Sassoulas self-assigned this Sep 24, 2020
@brycepg
Copy link
Contributor

brycepg commented Oct 20, 2020

Hey could you re-up the svg? I was hoping to get an overview before I dig in

@doublethefish
Copy link
Contributor Author

Aha traction on all this stuff! Great stuff. Also thanks @brycepg for manually sorting out the other PR, it has been quite frustrating getting all these PRs sorted, and I lost motivation to contribute.

The file is long gone I'm afraid, but here's an example run against test_pylint_runners: svg. Having kept the other one up for months, I'm not going to be able to keep this one up longer than a couple of weeks.

That example was easy to gen on this branch (well my sept 1st rebased version anyway, I CBA to rebase again right the now). On this branch run:

python -Wi -m pytest --exitfirst \
                         --profile-svg \
                         tests/test_pylint_runners.py

If you want to run the numpy version (which wasn't working for me in 2.5), in your linux shell-like, run:

PYTEST_PROFILE_EXTERNAL=1 \
                        python -Wi -m pytest --exitfirst \
                         --profile-svg \
                         tests/profile/test_profile_against_externals.py

I would strongly recommend you run the command locally as since Pylint 2.5 (IIRC) something changed in astroid that caused a run against numpy to break, at least, that was the state of it last month.

I am super interested to find out if running pylint against numpy works again and what caused the regression (sadface) in the astroid code.

Finally, if this goes in, I may revisit some of my other patches looking at the mult-proc threading code performance which seems bottlenecked by astroid repeating work.

@doublethefish
Copy link
Contributor Author

For the sake of clarity. My current understanding is that running pylint against numpy is broken due to some regression in astroid/pylint and this PR shouldn't go in until that regression is fixed.

Obviously, if this PR had gone in in April the regression would have likely been caught at point of merge.

* Use https gitub uri so we do not need creditials
* Shallow clone so we don't pull more data than we need
* Ensure we skip external profiling unless explicitly wanted
@doublethefish
Copy link
Contributor Author

Whilst logging bug #3913 I spent a bit of time looking at where the regression came in, and it is on the dev branch only (👍)

@Pierre-Sassoulas Pierre-Sassoulas merged commit 0847265 into pylint-dev:master Nov 27, 2020
@Pierre-Sassoulas
Copy link
Member

Sorry for the long delay, I did not see that you made the changes requested by @AWhetter ! Great merge request !

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.

5 participants