-
Notifications
You must be signed in to change notification settings - Fork 25
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
micropipenv._poetry2pipfile_lock() overrides python version specified by poetry.lock and pyproject.toml without warning #187
Comments
/kind bug |
Hi @wjhrdy, thanks for poetry-related reports. They sound reasonable. 👍🏻
We should fully reproduce the environment that poetry noted to create a reproducible environment. The fix should propagate the Python version from poetry files and not use the system Python version. |
How do you plan to achieve that? I mean, micropipenv does not manage Python environments although it runs almost always in them. A warning saying something like "Dependencies definition has been prepared for Python X.Y but you are using X.Z" sounds reasonable. What else can micropipenv do? |
If I understood metadata stated in the
We could propagate this information if stated - otherwise default to system python and print the warning as suggested. The version spec is probably another thing to deal with. I'm not familiar with poetry that much so more input is welcome. |
What do you mean by propagating it? Right now, micropipevn uses I'm afraid there is nothing we can do about it. We cannot search for another alternative Python interpreter when micropipenv runs in a virtual environment. In that case, printing a warning is all we can do and it might make sense. When running outside a virtual environment, we can actually try to find the correct Python version specified in the configuration and then use |
OK, I think we have a communication noise here - by propagating, I meant reading Python version from poetry files and adding it to Pipfile.lock format in |
Thanks for the clarification. Now it makes perfect sense and I'll take a look at it. |
I looking at it. If
but I believe that |
I don't think so - Pipenv does not support version range specification on Python interpreter version. We could stick with the lowest Python interpreter version that is used in poetry as that is used as a base for python version range specification if I understand poetry behaviour correctly - e.g. if someone starts a project on Python 3.7, poetry injects I'm unsure if poetry supports something like |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with /lifecycle rotten |
Rotten issues close after 30d of inactivity. /close |
@sesheta: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/remove-lifecycle rotten |
@fridex: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I've tested that Python versions like ">=3.7,<=3.10.2" or "^3.7,<=3.10.2" or even "~2.7 || ^3.4" are supported by poetry and poetry just moves that information from pyproject.toml to poetry.lock. Specification for Pipfile says that the Python version has to be something like "X.Y" and/or python_full_version something like "X.Y.Z" so we have to find a way how to distill one exact Python version from the possible specifications allowed in poetry. I don't want to reimplement the wheel so I'm thinking about regex like: In the other hand, if we want to implement #189 we need better handling of the version ranges. But the code to handle this in We can implement something simple and show a warning if we are not able to parse the version specifier but what is simple and reasonable at the same time? What else we can do? We can just show a warning to users saying that they are responsible for checking the Python version in poetry.lock because we are not able to parse it here and ignore that information as we currently do 🤔 |
+1 for a simple solution with a warning, especially at the beginning. I'm wondering if we could reuse logic from packaging. Recent pip versions vendor it, but I'm unsure if all the versions of pip that micropipenv is compatible with would provide desired functionality. With some effort, we could eventually translate caret, tilde, and wildcard requirements Poetry has to Python's packaging compatible representation. However, this will definitely require some effort to create such a parser (maybe some parts could be reused from Poetry). A fully compatible solution might turn to be complex. |
any update in this? |
Not really. I'm still not sure how to implement this. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with /lifecycle stale |
/lifecycle frozen |
@fridex could you have a look at this, or is it better to reassign it? thx! |
Let's reassign it. Thx! |
Describe the bug
This line disregards the python version that might be specified in the
poetry.lock -> [metadata] -> python-version
without warning.This line disregards the python version that might be specified in the
pyproject.toml ->[tool.poetry.dependencies] -> python
without warning.It might be expected behavior to use the system python version over the specified version, but we might want a warning anyway.
The text was updated successfully, but these errors were encountered: