-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add requirements.txt and update .gitignore for Python #5475
Conversation
requirements.txt
Outdated
@@ -0,0 +1 @@ | |||
protobuff~=3.20 |
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.
This says protobuff
with two f's - is this right or a typo?
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.
Good catch, thanks
I'm not into Python. I'd appreciate to hear from someone who is, @exploide maybe? Thank you! |
Ok, I see multiple issues here.
So I see two solutions: Fix the incompatibility in the script to make it work with latest protobuf. Or if this requires too much effort for the moment, include the version constraint in the |
Good catch, I was moving too fast and made that typo. Fixed just now. I would strongly suggest adding this requirements.txt file with whatever versions are required to make it work right now. Then, you can upgrade dependencies in the future if that's a desire. I also just added all the other dependencies to the |
Thank you for the review @exploide! I'm not sure what is best to do here. @RecRanger argues for this approach further in #5474. @RecRanger Thank you for the fix and additions. When fixing an error in a commit within a pending PR, we normally amend the commit and force-push - not add another commit. We also prefix commit titles with subsystem name whenever relevant (would be "requirements.txt: " starting with the second commit here). In this case, though, I suggest merging all 3 commits into one. We can do that at PR merge time by using GitHub's "squash and merge" feature, although this will make GitHub appear as the committer in git history. |
@RecRanger Where does the dependency on |
I personally always use Squash-and-Merge when working in semi-anon/informal teams (e.g., open source projects) to make reverting changes easier. Will do better next time though! I got the library list with a
Indirect dependencies should not be listed. Libraries are assumed to have valid |
From #5474
In principle, I would always recommend to make a software compatible with the latest version of a dependency. For example, it might happen that a vulnerability becomes known for the older version or that there is an unpleasant bug. Furthermore, if someone decides to package this for a Linux distribution, they will fail because they cannot ship an older version of a Python package than the latest one already packaged for the distribution.
But in this case, I agree. I don't have any experience with protobuf file generation and if it is a huge pain, then we should not enforce it for the moment. (But welcome it when someone likes to do the upgrade.)
There are different points of view on this topic. Personally, I don't like pinning version numbers as long as there is no process of keeping them up to date. Otherwise you will soon have a I already tried to explain that a combined global Since the file is only useful for the scripts in
Indeed, pycrypto is a dependency. However, it is insecure and deprecated and should no longer be used. There is pycryptodome as a drop-in replacement. Is has the same API. So please list this as a requirement instead. I will conduct a separate PR soon, which also adapts the error message within the scripts. Sorry for this lengthy answer. Just wanted to make my points clear. Whether to include a |
Thank you guys for the discussion. I had actually thought of us adding a
This may actually be a good idea. It could possibly stay available in a distro package that includes our scripts, but does not automatically get the Python modules pre-installed as the distro package dependencies. What do you think, @RecRanger? |
Projects should work out of the box. This PR is how you make it work out-of-the-box. Ideas for AFTER this bare-minimum PR is merged
There is no perfect solution for balancing security, functionality, and developer experience. This is the most basic solution. Let's upgrade incrementally from a bare-minimum. |
I've just merged @exploide's #5478 (obviously triggered by your work here @RecRanger, thanks!) so now we need to revise the changes here accordingly. |
Fix protobuf typo in requirements.txt Add other python dependencies for various scripts Update gitignore for Python files Switch pycrypto dep to pycryptodome in requirements.txt
Revised the "pycrypto" to "pycryptodome" dependency. Also squashed the commits. |
Thanks, but now the commit message records change history within this PR, which is temporary and irrelevant for our git history. So if it's just one commit, it should say just "Add requirements.txt and update .gitignore for Python" (or this could be 2 commits). |
__pycache__/ | ||
*.pyo | ||
*.pyd | ||
**/venv/ |
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.
Why two asterisks in **/venv/
?
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.
I think this doesn't really matter. It's redundant in this case but shouldn't harm either. https://stackoverflow.com/questions/41761128/are-leading-asterisks-redundant-in-gitignore-path-matching-syntax
Could be simplified to venv/
and maybe add .venv/
as well as it is another common virtualenv name.
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.
Two asterisks means that it can be nested any depth. May be redundant, but it definitely works.
Soooo like, is someone gonna merge this PR? As much as I'd love critique on my git technique and gitignore setup, I'm actually just here because the 100 contributors that came before me didn't setup the gitignore for 1 out of 2 languages used in this repo. |
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.
The commit message is still off, but the changes look good. Thanks!
OK, I did a squash-and-merge on this to set a commit message that matches the final changes. Thank you! |
Fixes #5474