Skip to content

Conversation

fjahr
Copy link
Contributor

@fjahr fjahr commented Apr 6, 2022

The outputs provided by the Python version should be exactly the same as the ones from the shell version.

There is small improvement here: Previously only the dependency of flake9 was checked, now all dependencies are checked before running.

I also tried to mostly follow the recommendations here but happy to make more changes if there is still room for improvement.

@jonatack
Copy link
Member

jonatack commented Apr 7, 2022

Concept/approach ACK

@laanwj
Copy link
Member

laanwj commented Apr 7, 2022

I think it's slightly weird that pyzmq is required for linting. I understand why this is though, avoiding that would require a stub library and isn't in scope here.

@laanwj laanwj mentioned this pull request Apr 7, 2022
25 tasks
Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

LGTM

import sys

DEPS = ['flake8', 'mypy', 'pyzmq']
MYPY_CACHE_DIR = f"{os.getenv('BASE_ROOT_DIR', '')}/test/.mypy_cache"
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated: If run outside the CI runner, this will likely result in /test/.mypy_cache, which may not be wanted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I noticed this as well but it is the existing behavior. I used getenv with the empty fallback because I wanted to potentially change it to a better one but forgot to think about it. What would you suggest as a better fallback?

@fanquake
Copy link
Member

fanquake commented Apr 7, 2022

I was half hoping we could just call the flake8 api directly, and check our files, rather than just moving to wrapping subprocess invocations of flake8 in python instead of bash. Maybe something for the future.

@laanwj
Copy link
Member

laanwj commented Apr 8, 2022

I was half hoping we could just call the flake8 api directly, and check our files, rather than just moving to wrapping subprocess invocations of flake8 in python instead of bash. Maybe something for the future.

This sounds neat for a follow-up, but personally at least I think as a first step calling out to tools like flake8 is fine. The biggest issue with subprocess is shell ambiguity (so avoid shell=True), and basic system commands that may differ.

@fjahr fjahr force-pushed the 202204-lint-py-py branch from 65e36e1 to 28e7af4 Compare April 17, 2022 11:51
@fjahr
Copy link
Contributor Author

fjahr commented Apr 17, 2022

I think it's slightly weird that pyzmq is required for linting. I understand why this is though, avoiding that would require a stub library and isn't in scope here.

I am slightly unsure if you would like me to make a change or not, but I think not. Otherwise, let me know :)

I was thinking about this quite a bit when initially putting it on the list but after seeing the errors produced when pyzmq is missing I thought it would be better to make this explicit because otherwise it might lead to people wasting time debugging in the wrong direction.

@fjahr
Copy link
Contributor Author

fjahr commented Apr 17, 2022

Addressed review comments.

@fjahr fjahr force-pushed the 202204-lint-py-py branch from 28e7af4 to 47b66ac Compare April 17, 2022 22:55
@laanwj
Copy link
Member

laanwj commented Apr 18, 2022

Tested ACK 47b66ac

@laanwj laanwj merged commit 57a73d7 into bitcoin:master Apr 18, 2022
maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Apr 19, 2022
…n.py`

e245c5c doc: Fix a link to `test/lint/lint-python.py` (Hennadii Stepanov)

Pull request description:

  This PR is a follow up to bitcoin/bitcoin#24794.

  Closes #588.

Top commit has no ACKs.

Tree-SHA512: 9305705082c5e8f0c093506b4931a13b50e33e8315f6758ee525bc7f6d840b517af5d1092cee4bcc1bfc553d629b771f1893f27d0f514639c2da295bb604877a
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 19, 2022
e245c5c doc: Fix a link to `test/lint/lint-python.py` (Hennadii Stepanov)

Pull request description:

  This PR is a follow up to bitcoin#24794.

  Closes bitcoin-core/gui#588.

Top commit has no ACKs.

Tree-SHA512: 9305705082c5e8f0c093506b4931a13b50e33e8315f6758ee525bc7f6d840b517af5d1092cee4bcc1bfc553d629b771f1893f27d0f514639c2da295bb604877a
@bitcoin bitcoin locked and limited conversation to collaborators Apr 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants