Skip to content

Commit

Permalink
Merge branch 'main' into chore/perf-perfs
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Dec 5, 2024
2 parents 4c67827 + 0e21544 commit c7ae5aa
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 13 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docs

on:
push:
branches: [main]
release:
types: [released]
pull_request:
types: [opened, synchronize]

jobs:
docs:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Ape Docs
uses: apeworx/sphinx-ape@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ pre-commit install

Committing will now automatically run the local hooks and ensure that your commit passes all lint checks.

## Running the docs locally

First, make sure you have the docs-related tooling installed:

```bash
pip install -e .'[doc]'
```

Then, run the following from the root project directory:

```bash
sphinx-ape build .
```

For the best viewing experience, use a local server:

```bash
sphinx-ape serve .
```

Then, open your browser to `127.0.0.1:1337` and click the `ape` directory link.

You can also use the `--open` flag to automatically open the docs:

```bash
sphinx-ape serve . --open
```

## Pull Requests

Pull requests are welcomed! Please adhere to the following:
Expand Down
12 changes: 9 additions & 3 deletions ape_foundry/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
from web3.exceptions import ContractLogicError as Web3ContractLogicError
from web3.exceptions import ExtraDataLengthError
from web3.gas_strategies.rpc import rpc_gas_price_strategy
from web3.middleware import geth_poa_middleware

try:
from web3.middleware import ExtraDataToPOAMiddleware # type: ignore
except ImportError:
from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware # type: ignore
from web3.middleware.validation import MAX_EXTRADATA_LENGTH
from yarl import URL

Expand Down Expand Up @@ -400,7 +404,7 @@ def check_poa(block_id) -> bool:

# Handle if using PoA
if any(map(check_poa, (0, "latest"))):
self._web3.middleware_onion.inject(geth_poa_middleware, layer=0)
self._web3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)

def _start(self):
if self.is_connected:
Expand Down Expand Up @@ -786,7 +790,9 @@ def connect(self):
logger.error(
f"Upstream provider '{upstream_provider.name}' missing Geth PoA middleware."
)
upstream_provider.web3.middleware_onion.inject(geth_poa_middleware, layer=0)
upstream_provider.web3.middleware_onion.inject(
ExtraDataToPOAMiddleware, layer=0
)
upstream_genesis_block_hash = upstream_provider.get_block(0).hash
else:
raise FoundryProviderError(f"Unable to get genesis block: {err}.") from err
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions = ["sphinx_ape"]
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. dynamic-toc-tree::
2 changes: 2 additions & 0 deletions docs/userguides/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../../README.md
```
18 changes: 8 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
"mdformat-pyproject>=0.0.2", # Allows configuring in pyproject.toml
],
"doc": [
"Sphinx>=6.1.3,<7", # Documentation generator
"sphinx_rtd_theme>=1.2.0,<2", # Readthedocs.org theme
"towncrier>=19.2.0, <20", # Generate release notes
"sphinx-ape",
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
Expand Down Expand Up @@ -76,13 +74,13 @@
url="https://github.com/ApeWorX/ape-foundry",
include_package_data=True,
install_requires=[
"eth-ape>=0.8.12,<0.9",
"ethpm-types", # Use same version as eth-ape
"eth-pydantic-types", # Use same version as eth-ape
"evm-trace", # Use same version as ape
"web3", # Use same version as ape
"yarl", # Use same version as ape
"hexbytes", # Use same version as ape
"eth-ape>=0.8.21,<0.9",
"ethpm-types>=0.6.19,<0.7",
"eth_pydantic_types>=0.1.3,<0.2",
"evm-trace>=0.2.3,<0.3",
"web3>=6.20.1,<8",
"yarl>=1.9.2,<2",
"hexbytes>=0.3.1,<2",
],
python_requires=">=3.9,<4",
extras_require=extras_require,
Expand Down

0 comments on commit c7ae5aa

Please sign in to comment.