-
-
Notifications
You must be signed in to change notification settings - Fork 614
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
Log which python version was used during compile #828
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @graingert,
Thanks for the contribution. Personally i don't like this idea. A requirements.txt
most likely commited to source control, also many developers has different interpreters (for example minor version may be different or OS), so this will cause changes to this header in requirements.txt
every time pip-compile
has been called by different developer. IMO it might be incovenient.
how about logging the |
@auvipy looks like it's been approved by mistake? It's not even working. |
I'm sorry, i'm not following. What do you mean by that? |
well you need to create a requirements.txt for each combination of markers - I'd like to see that the correct ones were used |
eg {'implementation_name': '',
'implementation_version': '0',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '5.0.0-15-generic',
'platform_system': 'Linux',
'platform_version': '#16-Ubuntu SMP Mon May 6 17:41:33 UTC 2019',
'python_full_version': '2.7.15+',
'python_version': '2.7',
'sys_platform': 'linux2'} |
I also mean pep 508 |
Why do we even need this? |
It's very easy to run pip-compile from the wrong environment |
Environment is not the same thing with Python version. There are bunch of other tools to learn and manage environment you're in. |
Which is desirable because all these differences are exposed to requirement selection, and could cause a different requirements.txt to be produced |
So you're saying that every repo using pip-tools should have different requirement files for every minor Python version? |
I agree with @atugushev - this will generate undesirable file churn and I'd guarantee users will complain about this. |
The timestamp is the OS release date not the current time |
Agh, did not catch that. 🤦♂ Still, the different environment factors between users will cause header churn. |
But those are the environment factors that packages can use to change their
requirements
…On Tue, 28 May 2019, 21:21 Ryan P Kilby, ***@***.***> wrote:
The timestamp is the OS release date not the current time
Agh, did not catch that. 🤦♂
Still, the different environment factors between users will cause header
churn.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#828?email_source=notifications&email_token=AADFATEXBAUET4HW6SX5S3DPXWH6JA5CNFSM4HQBJHPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWNKL6A#issuecomment-496674296>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADFATBQ2KVTDUP4AOMVVM3PXWH6JANCNFSM4HQBJHPA>
.
|
I'm not really following. Are you saying that a package would parse the header comment of a requirements.txt file to then change its requirements? This sounds like a feature that supports an atypical use case that in turn harms more general usage. Maybe you could write this information to a separate file? e.g., instead of parsing the header comment, you do:
Then parse the corresponding environment info file. At the very least, I'd argue this feature should be made available via a CLI argument. |
No |
I'm trying to find a way to rephrase, maybe it would be better to see an example? https://www.python.org/dev/peps/pep-0508/#examples |
I see what @graingert is trying to achieve here, and I agree with the intention. As an example, if you do a So the intention of adding in the But @atugushev, @rpkilby and @ulgens all raised valid concerns about this. It's true that for a lot of cases, the Should we go for an option to include/exclude that information from the header? Does someone have an idea to expose the cross-environment risk to users, while not imposing overhead for the majority that isn't at risk? |
Another example happens when modules end up in the standard library. It happened to me with the typing module which was selectively required by some package for Py<3.5. It was especially confusing because it manifested in some strange pip error due to it not wanting to silently pull in packages when the hashes option is used. But I'm not sure it's really a problem. We generate a requirements.txt and then that's used to make an environment under the specific version of Python we use to deploy our code. If that environment can't be created because someone updated requirements.txt from the wrong Python version then our testing would catch that very quickly. Unless I'm missing something this seems like a workflow and testing problem not specific to pip-tools. |
@atugushev Please review again and request changes if you really think is bad. IMHO, the change is benefic as it only produces a more detailed comment and if python version changes it is a good enough version to gather attention of user. IMHO, updating dependencies should always be done with a controlled version of python, so this help doing that in a consistent way, while w/o risk of breaking. If nobody complains I will look into merging this after few days. |
It might be better to make a requirements file that's compatible with all python versions and all platforms using conditional deps, like poetry does |
Thank you, that is what I was saying 2 years ago 🙂 |
I have nothing against a multi-python version lock file being produced but I am also realistic. I do find a small improvement merged today far more useful than an ideal one that never ends up being merged. That mentioned feature is clearly not easy to achieve and if we looks at how long even simple PRs progress,... As you probably seen, I decided to sacrifice a little bit of my weekend to help with open PRs. I am happy to see others replying and I hope that this may motivate them to resume helping that awesome project. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
fd72771
to
cbee456
Compare
Codecov Report
@@ Coverage Diff @@
## master #828 +/- ##
=======================================
Coverage 99.67% 99.67%
=======================================
Files 34 34
Lines 3042 3044 +2
Branches 327 327
=======================================
+ Hits 3032 3034 +2
Misses 5 5
Partials 5 5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ssbarnea!
Thanks for pinging. I'm still not fan of the idea, see my first comment #828 (review). But I intentionally didn't request changes so that this could be merged if people do like the feature.
@atugushev as it did get lots of supporters I merged it. In its current implementation it does only log major python version so the worry about variance in outcome is much lower. Based on my experience with multiple versions of python, it is really bad idea to compile requirements using different versions of python. I had to lock python version when doing this in multiple projects just to avoid the issue you mentioned. It it proves to be problematic we can tune it to make it optional. |
Changelog-friendly one-liner: log which python version to use/was used
Contributor checklist
Fixes: #827