Closed jynolen closed 1 month ago
This is ugly but works
def try_ignore_except(func, *args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as e:
pass
def get_remote_versions() -> list[Version]:
result: CompletedProcess[bytes] = subprocess.run(
["pyenv", "install", "--list"], check=True, capture_output=True
)
output: str = result.stdout.decode("utf-8")
matched_versions: Iterator[Match[str]] = re.finditer(PYTHON_VERSION_REGEX, output)
return list(filter(lambda x: x is not None, [ try_ignore_except(Version.parse, v.group(1)) for v in matched_versions ]))
Hi, I have pushed a possible fix to this branch: https://github.com/tjquillan/poetry-plugin-pyenv/tree/pep440_fix
I am not sure the best way to go about testing this but I believe one possible way would be something like:
pipx inject poetry git+https://github.com/tjquillan/poetry-plugin-pyenv.git@pep440_fix
or possibly (I haven't tested this one)
poetry self add git+https://github.com/tjquillan/poetry-plugin-pyenv.git@pep440_fix
I'll tell you ;)
Le mer. 21 août 2024, 04:39, Thomas Quillan @.***> a écrit :
Hi, I have pushed a possible fix to this branch: https://github.com/tjquillan/poetry-plugin-pyenv/tree/pep440_fix
I am not sure the best way to go about testing this but I believe one possible way would be something like: pipx inject poetry git+ @._fix or possibly (I haven't tested this one) poetry self add git+ @._fix
— Reply to this email directly, view it on GitHub https://github.com/tjquillan/poetry-plugin-pyenv/issues/4#issuecomment-2300361963, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALKX2NT6O53XW7FAZT3LNLZSP4WLAVCNFSM6AAAAABM2EFSS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBQGM3DCOJWGM . You are receiving this because you authored the thread.Message ID: @.***>
@tjquillan I had the same issue trying to use the plugin.
Your fix appears to work, but there's an issue w/ the install command where there is whitespace before the version number and it causes pyenv to error out.
I made a quick fix for this: https://github.com/tjquillan/poetry-plugin-pyenv/pull/5
It appears to work correctly now:
That sounds great, thanks for testing! I have merged your PR and will work on drafting a release with these fixes since it appears to be working for you.
Hello,
I came with a bug affecting the plugin just after installation I got this weird error running poetry
Invalid PEP 440 version: '3.13.0rc1t'
After digging a bit more and putting traceback at the right place (see traceback), it seems that is comes from the parsing of remote versions
$ pyenv install --list
Having a try catch arround line63 could be great.
Thanks