Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ jobs:
python-version: '3.8'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: pip install black
run: pip install pre-commit==3.5.0
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3-5-0|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Check code format
run: make check-code-format
run: pre-commit run
commits:
name: Check commits
runs-on: ubuntu-latest
Expand All @@ -43,7 +47,7 @@ jobs:
echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js
- name: Validate
run: |
git fetch
git fetch
npx commitlint \
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \
--to ${{ github.event.pull_request.head.sha }} \
Expand Down Expand Up @@ -71,4 +75,4 @@ jobs:
npx commitlint \
--from HEAD~${{ github.event.pull_request.commits }} \
--to HEAD \
--verbose
--verbose
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,7 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

!examples/*/*/build
# VS Code
.vscode/

!examples/*/*/build
69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
default_language_version:
python: python3.8

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
exclude: |
(?x)^(
.* |
tests/.*|
scripts/.*|
zksync2/.*|
.github/.*
)$
- id: end-of-file-fixer
exclude: |
(?x)^(
.* |
tests/.*|
scripts/.*|
zksync2/.*|
.github/.*
)$

- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
exclude: |
(?x)^(
tests/.*|
scripts/.*|
zksync2/.*
)$

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
exclude: |
(?x)^(
tests/.*|
scripts/.*|
zksync2/.*
)$

- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
exclude: |
(?x)^(
tests/.*|
scripts/.*|
zksync2/.*
)$

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.0
hooks:
- id: mypy
exclude: |
(?x)^(
tests/.*|
scripts/.*|
zksync2/.*
)$
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ dynamic = ["dependencies", "license", "optional-dependencies"]
[project.urls]
"Homepage" = "https://github.com/zksync-sdk/zksync2-python"
"Bug Tracker" = "https://github.com/zksync-sdk/zksync2-python/issues"

[tool.black]
line-length = 99
target-version = ['py311']
include = '\.pyi?$'

[tool.isort]
profile = "black"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web3>=6.10.0
eth-tester
black
pre-commit==3.5.0
14 changes: 11 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ zksync2.manage_contracts.contract_abi =
# extras = test
# commands = mypy .
#
# [mypy]
# show_error_codes = True
# no_implicit_optional = True

[flake8]
max-line-length = 99

[mypy]
disallow_untyped_defs = True
no_implicit_optional = True
check_untyped_defs = True
warn_return_any = True
warn_unused_ignores = True
show_error_codes = True
#
# [mypy-setuptools.*]
# ignore_missing_imports = True
Expand Down