ape icon indicating copy to clipboard operation
ape copied to clipboard

Allow folders inside the script folder to be scripts

Open PatrickAlphaC opened this issue 1 year ago • 5 comments

Overview

Inside your scripts folder, create a new folder called new_folder, and add a script called run_script.py in there. Running tree . you should see something like:

.
├── README.md
├── ape-config.yaml
├── contracts
├── scripts
   ├── new_folder
      └── run_script.py

In that, add the code:

def main():
  print("What's up")

Then try to run that script:

ape run scripts/new_folder/run_script.py

And it won't print What's up

PatrickAlphaC avatar Jul 31 '22 19:07 PatrickAlphaC

Does it have a failure?

Also, can you try adding __init__.py files inside both directories?

fubuloubu avatar Aug 01 '22 01:08 fubuloubu

Yes and Yes

Error: No such command 'scripts/new_folder/run_script.py'.

Or

Error: No such command 'run_script'.

PatrickAlphaC avatar Aug 04 '22 18:08 PatrickAlphaC

Can confirm this. Root cause is it doesn't walk the full directory right now in https://github.com/ApeWorX/ape/blob/main/src/ape_run/_cli.py#L115

fubuloubu avatar Aug 04 '22 22:08 fubuloubu

@PatrickAlphaC is https://github.com/ApeWorX/ape/issues/804 a duplicate?

NotPeopling2day avatar Aug 08 '22 13:08 NotPeopling2day

@NotPeopling2day yep. I'm idiot.

PatrickAlphaC avatar Aug 13 '22 02:08 PatrickAlphaC

Closing as duplicate

antazoey avatar Sep 27 '22 17:09 antazoey