diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index a10cba0..d628c2a 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -1,11 +1,12 @@ --- name: Bug report about: Report an error that you've encountered. -labels: 'bug' +labels: bug --- + ### Environment information -* `ape` and plugin versions: +- `ape` and plugin versions: ``` $ ape --version @@ -15,16 +16,16 @@ $ ape plugins list # ...copy and paste result of above command here... ``` -* Python Version: x.x.x -* OS: macOS/linux/win +- Python Version: x.x.x +- OS: macOS/linux/win ### What went wrong? Please include information like: -* what command you ran -* the code that caused the failure (see [this link](https://help.github.com/articles/basic-writing-and-formatting-syntax/) for help with formatting code) -* full output of the error you received +- what command you ran +- the code that caused the failure (see [this link](https://help.github.com/articles/basic-writing-and-formatting-syntax/) for help with formatting code) +- full output of the error you received ### How can it be fixed? diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md index 742ce66..1b56056 100644 --- a/.github/ISSUE_TEMPLATE/feature.md +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -1,15 +1,15 @@ --- name: Feature request about: Request a new feature, or an improvement to existing functionality. -labels: 'enhancement' +labels: enhancement --- ### Overview Provide a simple overview of what you wish to see added. Please include: -* What you are trying to do -* Why Ape's current functionality is inadequate to address your goal +- What you are trying to do +- Why Ape's current functionality is inadequate to address your goal ### Specification diff --git a/.github/ISSUE_TEMPLATE/work-item.md b/.github/ISSUE_TEMPLATE/work-item.md index 3aa53f5..1932055 100644 --- a/.github/ISSUE_TEMPLATE/work-item.md +++ b/.github/ISSUE_TEMPLATE/work-item.md @@ -1,14 +1,15 @@ --- name: Work item about: New work item for Ape team -labels: 'backlog' - +labels: backlog --- ### Elevator pitch: + ### Value: + ### Dependencies: + ### Design approach: + ### Task list: + -* [ ] Tasks go here -### Estimated completion date: +- [ ] Tasks go here +### Estimated completion date: ### Design review: + + Do not signoff unless: -- 1) agreed the tasks and design approach will achieve acceptance, and -- 2) the work can be completed by one person within the SLA. -Design reviewers should consider simpler approaches to achieve goals. + +- 1. agreed the tasks and design approach will achieve acceptance, and +- 2. the work can be completed by one person within the SLA. + Design reviewers should consider simpler approaches to achieve goals. (Please leave a comment to sign off) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1d93a39..544cbc6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,7 @@ ### What I did + fixes: # ### How I did it diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index c376171..1d19118 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -9,12 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a1b9019..736a2f3 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4fd8f8b..4c4f73c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,15 +2,22 @@ on: ["push", "pull_request"] name: Test +concurrency: + # Cancel older, in-progress jobs from the same PR, same workflow. + # use run_id if the job is triggered by a push to ensure + # push-triggered jobs to not get canceled. + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: linting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -20,20 +27,23 @@ jobs: - name: Run Black run: black --check . + - name: Run isort + run: isort --check-only . + - name: Run flake8 run: flake8 . - - name: Run isort - run: isort --check-only . + - name: Run mdformat + run: mdformat . --check type-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -52,10 +62,10 @@ jobs: python-version: [3.8, 3.9, "3.10"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/title.yaml b/.github/workflows/title.yaml index d283678..e52d792 100644 --- a/.github/workflows/title.yaml +++ b/.github/workflows/title.yaml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 diff --git a/.mdformat.toml b/.mdformat.toml new file mode 100644 index 0000000..01b2fb0 --- /dev/null +++ b/.mdformat.toml @@ -0,0 +1 @@ +number = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 83750e1..66ed7d6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black name: black @@ -24,8 +24,13 @@ repos: rev: v0.991 hooks: - id: mypy - additional_dependencies: [types-setuptools] + additional_dependencies: [types-setuptools, pydantic==1.10.4] +- repo: https://github.com/executablebooks/mdformat + rev: 0.7.14 + hooks: + - id: mdformat + additional_dependencies: [mdformat-gfm, mdformat-frontmatter] default_language_version: python: python3 diff --git a/README.md b/README.md index 33d9f54..d2f0349 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This guide demonstrates how to use `ape-keyring` as an account plugin and secret ## Dependencies -* [python3](https://www.python.org/downloads) version 3.8 or greater, python3-dev +- [python3](https://www.python.org/downloads) version 3.8 or greater, python3-dev ## Installation diff --git a/ape_keyring/accounts.py b/ape_keyring/accounts.py index 7457a2a..a2f074a 100644 --- a/ape_keyring/accounts.py +++ b/ape_keyring/accounts.py @@ -89,18 +89,17 @@ def sign_message(self, msg: SignableMessage) -> Optional[MessageSignature]: return None signed_msg = EthAccount.sign_message(msg, self.__key) - return MessageSignature( - v=signed_msg.v, r=to_bytes(signed_msg.r), s=to_bytes(signed_msg.s) - ) # type: ignore + return MessageSignature(v=signed_msg.v, r=to_bytes(signed_msg.r), s=to_bytes(signed_msg.s)) - def sign_transaction(self, txn: TransactionAPI) -> Optional[TransactionSignature]: + def sign_transaction(self, txn: TransactionAPI, **signer_options) -> Optional[TransactionAPI]: if not self.__autosign and not agree_to_sign(txn, "transaction"): return None signed_txn = EthAccount.sign_transaction(txn.dict(), self.__key) - return TransactionSignature( + txn.signature = TransactionSignature( v=signed_txn.v, r=to_bytes(signed_txn.r), s=to_bytes(signed_txn.s) - ) # type: ignore + ) + return txn def set_autosign(self, enabled: bool): """ diff --git a/pyproject.toml b/pyproject.toml index 4aa1461..4583f03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,7 @@ requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"] [tool.mypy] exclude = "build/" +plugins = ["pydantic.mypy"] [tool.setuptools_scm] write_to = "ape_keyring/version.py" diff --git a/setup.py b/setup.py index 7e49c5a..00e3cd1 100644 --- a/setup.py +++ b/setup.py @@ -11,10 +11,13 @@ ], "lint": [ "black>=22.10.0", # auto-formatter and linter - "mypy>=0.991", # Static type analyzer + "mypy>=0.991,<1", # Static type analyzer "types-setuptools", # Needed for mypy typeshed "flake8>=5.0.4", # Style linter "isort>=5.10.1", # Import sorting linter + "mdformat>=0.7.16", # Auto-formatter for markdown + "mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown + "mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates ], "release": [ # `release` GitHub Action job uses this "setuptools", # Installation tool @@ -54,7 +57,7 @@ include_package_data=True, install_requires=[ "click", # Use same version as eth-ape - "eth-ape>=0.5.6,<0.6", + "eth-ape>=0.6.5,<0.7", "eth-account", # Use same version as eth-ape "eth-utils", # Use same version as eth-ape "keyring>=23.9.1,<24",