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

Use actual pyp interpreter in shebang by default #29

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Bobronium
Copy link

Current version:

~
$ pyp "'pyp is running on ' + sys.executable" --explain > explained.py

~
$ perl explained.py
Traceback (most recent call last):
  File "/Users/bobronium/explained.py", line 3, in <module>
    from pyp import pypprint
ModuleNotFoundError: No module named 'pyp'

~
$ cat explained.py
#!/usr/bin/env python3
import sys
from pyp import pypprint
assert sys.stdin.isatty() or not sys.stdin.read(), "The command doesn't process input, but input is present"
output = 'pyp is running on ' + sys.executable
if output is not None:
    pypprint(output)

With these changes:

~
$ pyp "'pyp is running on ' + sys.executable" --explain > explained.py

~
$ perl explained.py
pyp is running on /Users/bobronium/.local/pipx/venvs/pypyp/bin/python

~
$ cat explained.py
#!/Users/bobronium/.local/pipx/venvs/pypyp/bin/python
import sys
from pyp import pypprint
assert sys.stdin.isatty() or not sys.stdin.read(), "The command doesn't process input, but input is present"
output = 'pyp is running on ' + sys.executable
if output is not None:
    pypprint(output)

pyp.py Outdated Show resolved Hide resolved
@Bobronium Bobronium marked this pull request as draft July 20, 2022 22:26
@Bobronium
Copy link
Author

Sorry, I've been too lazy to clone it and test it properly. Just patched my installation to check that it's working as intended.

I'll update the tests soon and will request review when it'll be ready for one, in the meanwhile this should be a draft really.

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

Successfully merging this pull request may close these issues.

2 participants