Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting system fails for CLI-based scripts when a package named scripts is installed #2012

Open
antazoey opened this issue Apr 16, 2024 · 1 comment
Labels
category: bug Something isn't working

Comments

@antazoey
Copy link
Member

antazoey commented Apr 16, 2024

Environment information

  • OS: macOS
  • Python Version: 3.10
  • ape and plugin versions:

no plugins.

$ ape --version

0.7.16.dev4+ge91bc152d.d20240416
  • Contents of your ape-config.yaml (NOTE: do not post anything private like RPC urls or secrets!):

no config

What went wrong?

When python package scripts is installed (or any python package named scripts), ape cannot run CLI (clickbased scripts, the ones that define acli`.

steps to repro:

  1. make a cli script (repro.py):
import click

@click.command()
def cli():
    print("Won't see this.")
  1. install any python package named scripts (note: there is one on pypi, but i dont know what it is so be careful lol)
pip install scripts
  1. try running the cli script:
ape run repro

fails like:

ERROR: Exception while parsing script: scripts/repro.py
        ImportError: No module named scripts.repro
        (Use `--verbosity DEBUG` to see full stack-trace)
ERROR: Exception while parsing script: scripts/repro.py
        ImportError: No module named scripts.repro
Usage: ape run [OPTIONS] COMMAND [ARGS]...
Try 'ape run -h' for help.

Error: No such command 'repro'.

How can it be fixed?

I don't know yet

More info

this is currently blocking us from upgrading web3.py for some reason, because py-evm is mistakenly exporting their scripts folder as a python package. I have told the about it and I think they'll fix it, but it highlighted this bug independently in ape.

it might be a clue that the main based scripts still work!

also would like to investigate why the log appears twice

@antazoey antazoey added the category: bug Something isn't working label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant