Skip to content

Commit

Permalink
refactor!: a collection of breaking changes [APE-1417] (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Dec 10, 2023
1 parent 82a9f9e commit f720add
Show file tree
Hide file tree
Showing 30 changed files with 1,235 additions and 1,455 deletions.
6 changes: 3 additions & 3 deletions docs/userguides/clis.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ Alternatively, you can call the [get_user_selected_account()](../methoddocs/cli.

```python
import click
from ape.cli import get_user_selected_account
from ape.cli import select_account


@click.command()
def cmd():
account = get_user_selected_account("Select an account to use")
click.echo(f"You selected {account.address}.")
account = select_account("Select an account to use")
click.echo(f"You selected {account.address}.")
```

Similarly, there are a couple custom arguments for aliases alone that are useful when making CLIs for account creation.
Expand Down
4 changes: 2 additions & 2 deletions src/ape/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import importlib_metadata as metadata
import yaml

from ape.cli import Abort, ape_cli_context
from ape.exceptions import ApeException, handle_ape_exception
from ape.cli import ape_cli_context
from ape.exceptions import Abort, ApeException, handle_ape_exception
from ape.logging import logger
from ape.plugins import clean_plugin_name

Expand Down
10 changes: 1 addition & 9 deletions src/ape/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@
create_network_type,
)
from .projects import DependencyAPI, ProjectAPI
from .providers import (
BlockAPI,
ProviderAPI,
SubprocessProvider,
TestProviderAPI,
UpstreamProvider,
Web3Provider,
)
from .providers import BlockAPI, ProviderAPI, SubprocessProvider, TestProviderAPI, UpstreamProvider
from .query import QueryAPI, QueryType
from .transactions import ReceiptAPI, TransactionAPI

Expand Down Expand Up @@ -58,5 +51,4 @@
"TestProviderAPI",
"TransactionAPI",
"UpstreamProvider",
"Web3Provider",
]
5 changes: 1 addition & 4 deletions src/ape/api/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,10 @@ def encode_contract_blueprint( # type: ignore[empty-body]
:class:`~ape.ape.transactions.TransactionAPI`
"""

def serialize_transaction(self, transaction: "TransactionAPI") -> bytes:
def serialize_transaction(self) -> bytes:
"""
Serialize a transaction to bytes.
Args:
transaction (:class:`~ape.api.transactions.TransactionAPI`): The transaction to encode.
Returns:
bytes
"""
Expand Down
10 changes: 0 additions & 10 deletions src/ape/api/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ def cached_manifest(self) -> Optional[PackageManifest]:

manifest = self._cached_manifest
if manifest.contract_types and not self.contracts:
# Extract contract types from cached manifest.
# This helps migrate to >= 0.6.3.
# TODO: Remove once Ape 0.7 is released.
for contract_type in manifest.contract_types.values():
if not contract_type.name:
continue

path = self._cache_folder / f"{contract_type.name}.json"
path.write_text(contract_type.model_dump_json())

# Rely on individual cache files.
self._contracts = manifest.contract_types
manifest.contract_types = {}
Expand Down
Loading

0 comments on commit f720add

Please sign in to comment.