Skip to content

Commit

Permalink
feat: upgrade ape
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Jun 17, 2022
1 parent 994602f commit 81e9d99
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
python-version: 3.8

- name: Install Dependencies
run: pip install .[dev]
run: |
python -m pip install --upgrade pip
pip install commitizen
- name: Check commit history
run: cz check --rev-range $(git rev-list --all --reverse | head -1)..HEAD
12 changes: 9 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:
python-version: 3.8

- name: Install Dependencies
run: pip install .[lint]
run: |
python -m pip install --upgrade pip
pip install .[lint]
- name: Run Black
run: black --check .
Expand All @@ -38,7 +40,9 @@ jobs:
python-version: 3.8

- name: Install Dependencies
run: pip install .[lint,test] # Might need test deps
run: |
python -m pip install --upgrade pip
pip install .[lint,test]
- name: Run MyPy
run: mypy .
Expand All @@ -60,7 +64,9 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: pip install .[test]
run: |
python -m pip install --upgrade pip
pip install .[test]
# - name: Run Tests
# run: pytest -m "not fuzzing" -n 0 -s --cov
Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.2.0
hooks:
- id: check-yaml

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
Expand All @@ -21,12 +16,12 @@ repos:
name: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
rev: 4.0.1
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v0.961
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-requests]
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
To get started with working on the codebase, use the following steps prepare your local environment:

```bash
# clone the github repo and navigate into the folder
git clone https://github.com/ApeWorX/ape-fantom.git
cd ape-fantom
# Clone the github repo and navigate into the folder
git clone https://github.com/ApeWorX/ape-bsc.git
cd ape-bsc

# create and load a virtual environment
# Create and load a virtual environment
python3 -m venv venv
source venv/bin/activate

# install brownie into the virtual environment
# Install ape into the virtual environment
python setup.py install

# install the developer dependencies (-e is interactive mode)
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ write_to = "ape_bsc/version.py"

[tool.black]
line-length = 100
target-version = ['py37', 'py38', 'py39']
target-version = ['py37', 'py38', 'py39', 'py310']
include = '\.pyi?$'

[tool.pytest.ini_options]
addopts = """
-n auto
-p no:ape_test
--cov-branch
--cov-report term
Expand All @@ -35,7 +34,5 @@ markers = "fuzzing: Run Hypothesis fuzz test suite"
line_length = 100
force_grid_wrap = 0
include_trailing_comma = true
known_third_party = ["ape", "ape_ethereum", "ape_geth", "ape_test", "setuptools"]
known_first_party = ["ape_bsc"]
multi_line_output = 3
use_parentheses = true
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
],
"lint": [
"black>=22.3.0,<23.0", # auto-formatter and linter
"mypy>=0.910,<1.0", # Static type analyzer
"flake8>=3.8.3,<4.0", # Style linter
"mypy>=0.961,<1.0", # Static type analyzer
"flake8>=4.0.1,<5.0", # Style linter
"isort>=5.10.1,<6.0", # Import sorting linter
],
"release": [ # `release` GitHub Action job uses this
Expand All @@ -22,7 +22,7 @@
],
"dev": [
"commitizen", # Manage commits and publishing releases
"pre-commit", # Ensure that linters are run prior to commiting
"pre-commit", # Ensure that linters are run prior to committing
"pytest-watch", # `ptw` test watcher/runner
"IPython", # Console for interacting
"ipdb", # Debugger (Must use `export PYTHONBREAKPOINT=ipdb.set_trace`)
Expand Down Expand Up @@ -54,8 +54,8 @@
include_package_data=True,
install_requires=[
"importlib-metadata ; python_version<'3.8'",
"eth-ape>=0.2.1,<0.3.0",
], # NOTE: Add 3rd party libraries here
"eth-ape>=0.3.0,<0.4.0",
],
python_requires=">=3.7.2,<3.11",
extras_require=extras_require,
py_modules=["ape_bsc"],
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from ape._cli import cli as ape_cli
from click.testing import CliRunner


@pytest.fixture
def runner():
return CliRunner()


@pytest.fixture
def cli():
return ape_cli
33 changes: 33 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
EXPECTED_OUTPUT = """
arbitrum
├── mainnet
│ ├── alchemy
│ └── geth (default)
├── testnet
│ ├── alchemy (default)
│ └── geth
└── local (default)
└── test (default)
""".strip()


def assert_rich_text(actual: str, expected: str):
"""
The output from `rich` causes a bunch of extra spaces to
appear at the end of each line. For easier testing, we remove those here.
"""
actual = f"arbitrum{actual.split('arbitrum')[-1]}"
expected = expected.strip()
lines = actual.split("\n")
new_lines = []
for line in lines:
if line:
new_lines.append(line.rstrip())

actual = "\n".join(new_lines)
assert actual == expected


def test_networks(runner, cli):
result = runner.invoke(cli, ["networks", "list"])
assert_rich_text(result.output, EXPECTED_OUTPUT)

0 comments on commit 81e9d99

Please sign in to comment.