Open agriyakhetarpal opened 6 days ago
Thanks for opening the issue. I think pipx run --spec pyodide-build pyodide
isn't that bad as it is pretty common to have a package name and CLI name different IMO. But we'll need to fix
ImportError: cannot import name '__file__' from '__main__' (unknown location). Did you mean: '__name__'?
anyways.
Description
We do support a
[project.entry-points."pipx.run"]
entry point, but it apparently doesn't work that well right now. I guess this is coming from our layered CLI.Steps to reproduce
The
pipx run pyodide build
command picks up the Pyodide sdist on PyPI:Tap to show logs
``` PIP STDOUT ---------- Collecting pyodide Using cached pyodide-0.0.2.tar.gz (19 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' PIP STDERR ---------- error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [21 lines of output] Traceback (most recent call last): File "/Users/agriyakhetarpal/.local/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
If I run
pipx run --spec pyodide-build pyodide --help
(orpyodide xbuildenv --help
orpyodide build --help
, I get this trace:Tap to show logs
``` ❯ pipx run --spec pyodide-build pyodide --help Traceback (most recent call last): File "which is coming from the fact that
from __main__ import __file__ as INVOKED_PATH_STR
won't work and we might need to replace this with something likesys.argv[0]
to replicate (I've seen this error withpipx
before).If I run
they don't work either, because we use
pyodide-cli
as a dependency to provide our CLI logic.and
pipx install pyodide-build
doesn't work until we add--include-deps
so that it installspyodide-cli
:Tap to show logs
``` ❯ pipx install pyodide-build Note: Dependent package 'pyodide-cli' contains 1 apps - pyodide Note: Dependent package 'markdown-it-py' contains 1 apps - markdown-it Note: Dependent package 'pygments' contains 1 apps - pygmentize Note: Dependent package 'typer' contains 1 apps - typer Note: Dependent package 'wheel' contains 1 apps - wheel Note: Dependent package 'build' contains 1 apps - pyproject-build Note: Dependent package 'cmake' contains 3 apps - cmake - cpack - ctest Note: Dependent package 'charset-normalizer' contains 1 apps - normalizer Note: Dependent package 'unearth' contains 1 apps - unearth Note: Dependent package 'httpx' contains 1 apps - httpx Note: Dependent package 'virtualenv' contains 1 apps - virtualenv No apps associated with package pyodide-build. Try again with '--include-deps' to include apps of dependent packages, which are listed above. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead. ```
and newer tools like
uvx
don't seem to work either, such asuvx --from pyodide-build --with pyodide-cli pyodide
(which reports an unsatisfiable requirement at the installation step). I haven't checked if there is a feature that lets us add[tool.uvx.run]
inpyproject.toml
so far.Expected behaviour
We should be able to, at least, run
pipx run pyodide build
, similar topipx run build
. I think it might be possible to make this all work by letting go of https://github.com/pyodide/pyodide-cli/ completely without any breaking changes (since no one else besides us is probably using the[project.entry-points."pyodide.cli"]
entry point, but I'll let others decide on what should be done and whether this effort in specific is justifiable or if we should look for other ways to makepipx
/uvx
work.