Open jamesbraza opened 4 months ago
Also cc @eifinger if he has seen this before
Also cc @eifinger if he has seen this before
I have not seen this before. I usually use pypi-publish to publish to PyPi.
Can you replace my action with
run: curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
To make sure the bug is with rye
itself instead of eifinger/setup-rye
?
Okay actually I am having a tough time getting the manual install to work. The URL you shared gives a "301 Moved Permanently" error. I am now using:
steps:
- uses: actions/checkout@v4
- run: |
curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
echo "$HOME/.rye/env" >> $GITHUB_PATH
- run: rye sync --no-lock
But this still gives line 1: rye: command not found
in the last run
step. Do you know what I am doing wrong here?
Not sure what's going on but it does look like you're being prompted. I doubt it's a bug in the Action.
Not clear if twine is prompting you or Rye.
Okay gotchu. Can you give any tips on how to discern if twine or Rye is prompting? Sorry I am just not sure how to take the root causing further here without your or @eifinger 's help as I don't know the internals
No worries. If you run that sequence of commands locally with (1) an invalid token, and then (2) a valid token, what do you see?
Okay, I have figured it out thanks to @charliermarsh's comment:
Not sure what's going on but it does look like you're being prompted.
The fix was specifying --yes
to rye publish
, to not have Rye prompt the user:
--- - run: rye publish --token ${{ secrets.PYPI_API_TOKEN }}
+++ - run: rye publish --token ${{ secrets.PYPI_API_TOKEN }} --yes
So to follow up, there was nothing wrong with setup-rye
(cc @eifinger).
Now for a fix here, is there some way we can make this failure "nicer" towards humans? E.g. is there some way Rye can check if an input terminal is available before prompting then crashing with the current obscure error?
Yeah can definitely be improved... Do you have any idea what the prompt was?
Yeah the prompt was asking for a password encryption:
? Encrypt with passphrase (optional) ›
I guess it's worth pointing out that we aren't using a password, so maybe this prompt can be eliminated entirely
I think it's still relevant because Rye is trying to encrypt whatever plaintext secret (password or token) you provide on disk. But we should either skip that step when you're not attached to a TTY or provide a better error message with a mention of --yes
.
I follow and that sounds great. Maybe also adjust the prompt from "Encrypt with passphrase" to say what being encrypted, so perhaps "Encrypt token with passphrase" to be more explicit
Steps to Reproduce
I have a GitHub Action that looks like so with Python 3.12.4:
When I run it, the
rye publish
step fails witherror: IO error: not a terminal
Expected Result
I expected this publish job to work
Actual Result
The below error during
rye publish
:https://github.com/astral-sh/rye/issues/246 seems to have the same error
Version Info
0.37.0 via https://github.com/eifinger/setup-rye
Stacktrace
No response