Skip to content

Commit

Permalink
chore: update repo
Browse files Browse the repository at this point in the history
  • Loading branch information
NotPeopling2day committed Nov 10, 2023
1 parent eff527f commit b91b919
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ version-resolver:

template: |
## Changes
$CHANGES
Special thanks to: $CONTRIBUTORS
34 changes: 34 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
8 changes: 4 additions & 4 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ 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
python-version: "3.10"

- name: Install Dependencies
run: pip install .[dev]
run: pip install commitizen

- name: Check commit history
run: cz check --rev-range $(git rev-list --all --reverse | head -1)..HEAD
2 changes: 2 additions & 0 deletions .github/workflows/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
update-draft:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ 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
python-version: "3.10"

- name: Install Dependencies
run: pip install commitizen
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ 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
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[release]
- name: Build
run: python setup.py sdist bdist_wheel

Expand Down
38 changes: 24 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@ 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
python-version: "3.10"

- name: Install Dependencies
run: |
Expand All @@ -22,22 +29,25 @@ 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
python-version: "3.10"

- name: Install Dependencies
run: |
Expand All @@ -53,13 +63,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
python-version: [3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, "3.10", "3.11"]

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 }}

Expand All @@ -79,12 +89,12 @@ jobs:
# fail-fast: true
#
# 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
# python-version: "3.10"
#
# - name: Install Dependencies
# run: pip install .[test]
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: check-yaml

Expand All @@ -10,18 +10,18 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.11.0
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
rev: v1.6.1
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ A pull request represents the start of a discussion, and doesn't necessarily nee
If you are opening a work-in-progress pull request to verify that it passes CI tests, please consider
[marking it as a draft](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests).

Join the Ethereum Python [Discord](https://discord.gg/PcEJ54yX) if you have any questions.
Join the ApeWorX [Discord](https://discord.gg/apeworx) if you have any questions.
15 changes: 14 additions & 1 deletion ape_frame/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ape.exceptions import ProviderError, ProviderNotConnectedError
from ape.exceptions import AccountsError, ProviderError, ProviderNotConnectedError


class FrameNotConnectedError(ProviderNotConnectedError):
Expand All @@ -9,3 +9,16 @@ class FrameProviderError(ProviderError):
"""
An error raised by the Frame provider plugin.
"""


class FrameAccountException(AccountsError):
"""
An error that occurs in the ape Frame plugin.
"""


class FrameSigningError(FrameAccountException):
"""
An error that occurs when signing a message or transaction
using the Frame plugin.
"""
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ force_grid_wrap = 0
include_trailing_comma = true
multi_line_output = 3
use_parentheses = true

[tool.mdformat]
number = true
20 changes: 13 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
extras_require = {
"test": [ # `test` GitHub Action jobs uses this
"pytest>=6.0", # Core testing package
"pytest-xdist", # multi-process runner
"pytest-xdist", # Multi-process runner
"pytest-cov", # Coverage analyzer plugin
"hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer
],
"lint": [
"black>=22.10.0", # auto-formatter and linter
"mypy>=0.982", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"flake8>=5.0.4", # Style linter
"isort>=5.10.1", # Import sorting linter
"black>=23.11.0,<24", # Auto-formatter and linter
"mypy>=1.6.1,<2", # Static type analyzer
"types-requests", # Needed due to mypy typeshed
"types-setuptools", # Needed due to mypy typeshed
"types-PyYAML", # Needed due to mypy typeshed
"flake8>=6.1.0,<7", # Style linter
"isort>=5.10.1,<6", # Import sorting linter
"mdformat>=0.7.17", # 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
Expand Down Expand Up @@ -65,7 +70,7 @@
packages=find_packages(exclude=["tests", "tests.*"]),
package_data={"ape_frame": ["py.typed"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
Expand All @@ -75,5 +80,6 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)
13 changes: 13 additions & 0 deletions tests/test_accounts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tempfile
from pathlib import Path

from ape_frame.accounts import AccountContainer, FrameAccount


class TestAccountContainer:
def test_account_container(self):
with tempfile.TemporaryDirectory() as temp_dir:
data_path = Path(temp_dir)
container = AccountContainer(data_folder=data_path, account_type=FrameAccount)
for acct in container.accounts:
assert type(acct) is FrameAccount

0 comments on commit b91b919

Please sign in to comment.