diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 52b925b8c2..ec003a879d 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: 23.3.0 + rev: 23.7.0 hooks: - id: black name: black diff --git a/setup.py b/setup.py index da4c27a1f5..61f18de6d7 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ "hypothesis-jsonschema==0.19.0", # JSON Schema fuzzer extension ], "lint": [ - "black>=23.3.0,<24", # Auto-formatter and linter + "black>=23.7.0,<24", # Auto-formatter and linter "mypy>=0.991,<2", # Static type analyzer "types-PyYAML", # Needed due to mypy typeshed "types-requests", # Needed due to mypy typeshed @@ -93,7 +93,7 @@ }, include_package_data=True, install_requires=[ - "click>=8.1.3,<8.1.4", + "click>=8.1.6,<9", "ijson>=3.1.4,<4", "importlib-metadata", "ipython>=8.5.0,<9", @@ -119,11 +119,11 @@ "eth-utils>=2.0.0,<3", "hexbytes>=0.2.3,<1", "py-geth>=3.13.0,<4", - "web3[tester]>=6.5.0,<7", + "web3[tester]>=6.6.1,<7", # ** Dependencies maintained by ApeWorX ** "eip712>=0.2.1,<0.3", "ethpm-types>=0.5.3,<0.6", - "evm-trace>=0.1.0a21", + "evm-trace==0.1.0a21", ], entry_points={ "console_scripts": ["ape=ape._cli:cli"], diff --git a/src/ape/cli/arguments.py b/src/ape/cli/arguments.py index 48455e1fd3..d6306c0aff 100644 --- a/src/ape/cli/arguments.py +++ b/src/ape/cli/arguments.py @@ -4,7 +4,7 @@ import click from eth_utils import is_hex -from ape import accounts +from ape import accounts, project from ape.api import AccountAPI from ape.cli.choices import Alias from ape.cli.paramtype import AllFilePaths @@ -55,8 +55,8 @@ def _raise_bad_arg(name): resolved_contract_paths = set() for contract_path in contract_paths: # Adds missing absolute path as well as extension. - resolved_contract_path = ctx.obj.project_manager.lookup_path(contract_path) - + pm = project if ctx.obj is None else ctx.obj.project_manager + resolved_contract_path = pm.lookup_path(contract_path) if not resolved_contract_path: _raise_bad_arg(contract_path.name) diff --git a/src/ape/cli/paramtype.py b/src/ape/cli/paramtype.py index 4cdb92c65e..1997a66e25 100644 --- a/src/ape/cli/paramtype.py +++ b/src/ape/cli/paramtype.py @@ -26,10 +26,11 @@ class AllFilePaths(Path): or a list containing only the given file. """ - def convert( + def convert( # type: ignore[override] self, value: Any, param: Optional["Parameter"], ctx: Optional["Context"] ) -> List[PathLibPath]: path = super().convert(value, param, ctx) + assert isinstance(path, PathLibPath) # For mypy # NOTE: Return the path if it does not exist so it can be resolved downstream. return get_all_files_in_directory(path) if path.is_dir() else [path] diff --git a/src/ape/managers/chain.py b/src/ape/managers/chain.py index f81e5f93f6..0d0a951f5e 100644 --- a/src/ape/managers/chain.py +++ b/src/ape/managers/chain.py @@ -1370,9 +1370,9 @@ def get_creation_receipt( elif self.provider.get_code(address, block_id=mid_block): return self.get_creation_receipt(address, start_block=start_block, stop_block=mid_block) - elif start_block + 1 <= mid_block: + elif mid_block + 1 <= stop_block: return self.get_creation_receipt( - address, start_block=start_block + 1, stop_block=stop_block + address, start_block=mid_block + 1, stop_block=stop_block ) else: diff --git a/tests/functional/test_cli.py b/tests/functional/test_cli.py index 607395db39..be4e951db0 100644 --- a/tests/functional/test_cli.py +++ b/tests/functional/test_cli.py @@ -8,6 +8,7 @@ NetworkBoundCommand, PromptChoice, account_option, + contract_file_paths_argument, get_user_selected_account, network_option, verbosity_option, @@ -323,3 +324,13 @@ def test_account_prompt_name(): assert option.name == "account" option = AccountAliasPromptChoice(name="account_z") assert option.name == "account_z" + + +def test_contract_file_paths_argument(runner): + @click.command() + @contract_file_paths_argument() + def cmd(file_paths): + pass + + result = runner.invoke(cmd, ["path0", "path1"]) + assert "Contract 'path0' not found" in result.output