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

Feature request: inspect interactively after pipx run script.py like python -i script.py #1456

Open
ftnext opened this issue Jun 18, 2024 · 0 comments · May be fixed by #1457
Open

Feature request: inspect interactively after pipx run script.py like python -i script.py #1456

ftnext opened this issue Jun 18, 2024 · 0 comments · May be fixed by #1457
Labels
enhancement New feature or request

Comments

@ftnext
Copy link

ftnext commented Jun 18, 2024

Thank you very much for your awesome work.
pipx is a great tool for me to run python scripts with inline script metadata (PEP 723).

How would this feature be useful?

I'd like to inspect interactively after pipx run script.py like python -i.
https://docs.python.org/3/using/cmdline.html#cmdoption-i

% pipx run --inspect script.py
>>>

% pipx run --inspect --no-cache script.py
>>>

Describe the solution you'd like

I will send pull request.

Describe alternatives you've considered

I read the source code(1) and tried to set the environment variable PYTHONINSPECT as a workaround.
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONINSPECT
It often works fine, but when pipx creates a virtual environment(2), it causes for pipx for hanging.

(1): https://github.com/pypa/pipx/blob/1.6.0/src/pipx/util.py#L377-L390
(2): https://github.com/pypa/pipx/blob/1.6.0/src/pipx/venv.py#L163-L167

% PYTHONINSPECT=1 pipx run script.py  # this works
>>>

% PYTHONINSPECT=1 pipx run --no-cache script.py  # Hang
creating virtual environment

(FYI) References
I wrote my blog (Sorry, these are Japanese)

@ftnext ftnext linked a pull request Jun 18, 2024 that will close this issue
1 task
@chrysle chrysle added the enhancement New feature or request label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants