Infinite recursion when installed via pipx
fwcd opened this issue · 0 comments
fwcd commented
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
.