-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bumped to web3v6 * [feat] gitignore * update all web3py breaking changes * add venv and dist * [feat] added poetry * [feat] added linters etc * [feat] added workflows * [feat] added workflows * [chore] ensured version match * [chore] ensured version match * [feat] implemented tbump * Bump to 0.1.1 * [feat] implemented tbump * [feat] implemented cd * [feat] fixed failing linters * [feat] fixed failing linters * Update README.md * Update README.md * Update README.md --------- Co-authored-by: 8baller <[email protected]> Co-authored-by: gerg <[email protected]> Co-authored-by: gerg <[email protected]>
- Loading branch information
1 parent
dd97230
commit 94ba55e
Showing
11 changed files
with
2,740 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Code Quality | ||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [ master, main ] | ||
pull_request: | ||
branches: [ master, main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10",] | ||
poetry-version: ["1.3.2"] | ||
os: [ubuntu-20.04,] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: ${{ matrix.poetry-version }} | ||
virtualenvs-create: true | ||
installer-parallel: true | ||
- name: Install | ||
run: | | ||
poetry install | ||
- name: Format | ||
run: | | ||
make fmt | ||
- name: Lint | ||
run: | | ||
make lint | ||
- name: Tests | ||
run: | | ||
make test | ||
- name: Lock | ||
run: | | ||
poetry lock | ||
- name: Ensure lockfile is up to date | ||
run: | | ||
git diff --exit-code | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Publish package on main branch if it's tagged with 'v*' | ||
|
||
name: release & publish workflow | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push events but only for the master branch | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "release" | ||
release: | ||
name: Create Release | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
matrix: | ||
python-versions: [3.8] | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Get version from tag | ||
id: tag_name | ||
run: | | ||
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} | ||
shell: bash | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-versions }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
- name: Build wheels and source tarball | ||
run: >- | ||
poetry build | ||
- name: create github release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
body: ${{ steps.changelog_reader.outputs.changes }} | ||
files: dist/*.whl | ||
draft: false | ||
prerelease: false | ||
|
||
- name: publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
skip_existing: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,49 @@ | ||
# multicaller | ||
|
||
Helper for using multicall to aggregate onchain data calls into a single RPC call. | ||
## Features | ||
* Uses multicall3, allowing for failing calls on a per-call basis | ||
* Iteratively breaks up a call bundle if it's too large for the endpoint | ||
* Uses native web3py contract functions rather than requiring users to [write the function ABI for each call](https://github.com/banteg/multicall.py/blob/9117c552c6ae85acec8452961db0aac51119070b/examples/daistats.py#L77) | ||
|
||
|
||
## Dev | ||
|
||
### Format | ||
|
||
```bash | ||
make fmt | ||
``` | ||
|
||
### Lint | ||
|
||
```bash | ||
make lint | ||
``` | ||
|
||
### Test | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
#### Run all tests | ||
|
||
```bash | ||
make all | ||
``` | ||
|
||
### Releasing | ||
|
||
We can use `tbump` to automatically bump our versions in preparation of a release. | ||
|
||
```bash | ||
new_version=0.1.1 | ||
git checkout -b v$new_version | ||
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD) | ||
tbump new_version | ||
``` | ||
|
||
The release workflow will then detect that a branch with a `v` prefix exists and create a release from it. | ||
|
||
Additionally, the package will be published to PyPI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
clean: | ||
find . | grep -E "(__pycache__|\.pyc|\.pyo$$)" | xargs rm -rf | ||
|
||
fmt: | ||
poetry run isort . | ||
poetry run black . | ||
poetry run autopep8 . --recursive --in-place -a | ||
poetry run autoflake8 . --recursive --remove-unused-variables --in-place | ||
|
||
lint: | ||
poetry run flake8 . --max-line-length=150 | ||
|
||
test: | ||
poetry run pytest tests | ||
|
||
all: fmt lint test clean |
Oops, something went wrong.