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

Infinite recursion when installed via pipx #51

Open
fwcd opened this issue Jul 22, 2024 · 0 comments
Open

Infinite recursion when installed via pipx #51

fwcd opened this issue Jul 22, 2024 · 0 comments

Comments

@fwcd
Copy link

fwcd commented Jul 22, 2024

Running pipx install stemgen and then stemgen seems to cause infinite recursion:

Traceback (most recent call last):
  File "/Users/<user>/.local/bin/stemgen", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/<user>/Library/Application Support/pipx/venvs/stemgen/lib/python3.12/site-packages/cli/stemgen/__init__.py", line 12, in main
    stemgen.main()
  File "/Users/<user>/Library/Application Support/pipx/venvs/stemgen/lib/python3.12/site-packages/cli/stemgen/__init__.py", line 12, in main
    stemgen.main()
  File "/Users/<user>/Library/Application Support/pipx/venvs/stemgen/lib/python3.12/site-packages/cli/stemgen/__init__.py", line 12, in main
    stemgen.main()
  File "/Users/<user>/Library/Application Support/pipx/venvs/stemgen/lib/python3.12/site-packages/cli/stemgen/__init__.py", line 12, in main
    stemgen.main()
  [Previous line repeated 995 more times]
RecursionError: maximum recursion depth exceeded

This seems to be an issue with the sys.path logic: The script seems to run from the cli/stemgen directory, but outside the repository, so it cannot find the actual stemgen.py script.

My recommendation would be to put everything under a top-level package named stemgen (so it can be installed properly), move the script implementations into the package, e.g. under stemgen.cli, and then point your entry points in setup.cfg to those functions. The top-level scripts in the repo (stemgen.py et al.) could then be simple wrappers that import the package (stemgen.cli.something) and call their main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant