This repository was archived by the owner on Dec 10, 2025. It is now read-only.
feat: repo improvement suggestions #68
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What 💻
This PR tries to make some improvement suggestions to this project based on Python Best Practices for a New Project in 2021 and my Python experience with this blog article.
There is only one additional dev dependencies introduced pre-commit, it can be installed into Git Hooks and run automatically before any
git commitlocally. Its configuration file is.pre-commit-config.yaml, and I have configured some hooks such as notrailing-whitespaceand add new line at the end of file. Other hooks areisort,flake8,black,mypy. These hooks are installed bypre-commitat a separate location on the machine and will not interfere with dependency of this repo.isortgroups imports into 3 categories, packages imported from Python own library, external library (web3) and other local imports. Within each category, it sorts imports in alphabetical order.flake8is a linter, it can detect things like unused imports, variables; variable use before its creation and etcblackis a formattermypyis a static type checker for PythonCurrently, within
.pre-commit-config.yaml, it does not check any files, you can learn more about the exclude regex here. With refactor going on, we can change the exclude part and check those files slowly.I would also like to explain some changes in this commit:
validate.ymlwill be usingpre-committo do a comprehensive check. refpyproject.tomlhas configs forisortandblack. (NOTE: I personally prefers line length 99, as nowadays computer screen is quite wide, but if you don't like it, I can change it to the default 88)setup.cfghas configs forflake8andmypy, mypy config refWhy ✋
When I first start to use this repo, I noticed the
Anytype is returned everywhere, mainly because of #63 , it made the developing experience very bad. Then I dig deeper, and noticed many unused imports, wrong type hints, and some wrong typing issue that could be caught with a linter. I would like to propose my Python practice to this repo. The better this repo is, the smoother my developing experience will be.Evidence 📷
Include screenshots, screen recordings, or
consoleoutput here demonstrating that your changes work as intendedNotes 📝
Sorry for this long PR, basically I would like to try my best to make this repo better, I finally found an open-source project that I feel I can contribute a lot.
CONTRIBUTING.mdwith a notes onpre-commithook installation and usage.zksync2/account,zksync2/core,zksync/manage_contracts,zksync/signerandzksync/transaction. I am thinking of using existing test cases to check the correctness of the refactoring and add more test cases accordingly.