-
Notifications
You must be signed in to change notification settings - Fork 110
RHAIENG-304, RHAIENG-785: remove all requirements.txt
and Pipfile.lock
#2182
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
RHAIENG-304, RHAIENG-785: remove all requirements.txt
and Pipfile.lock
#2182
Conversation
WalkthroughRemoved content from multiple Pipfile and requirements.txt manifests across runtimes, jupyter, rstudio, and codeserver directories; affected files are now empty or deleted, removing all previously declared package sources, package pins, and python_version constraints. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (18)
📒 Files selected for processing (21)
💤 Files with no reviewable changes (21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (35)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@jiridanek: The following tests failed, say
Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
Tried
and then compared what changed using #!/usr/bin/env python3
import pathlib
import subprocess
import re
from packaging.version import parse as parse_version
def get_staged_requirements_files():
"""Returns a list of staged files ending with requirements.txt."""
try:
# cmd = ["git", "diff", "--name-only", "--cached"]
cmd = ["git", "diff", "--name-only"]
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
return [
line for line in result.stdout.strip().split("\n")
if 'requirements.txt' in line and line.strip()
]
except subprocess.CalledProcessError:
return []
def get_file_content(revision_and_path):
"""Gets file content from a specific git revision (e.g., 'HEAD:path/file' or ':path/file')."""
try:
cmd = ["git", "show", revision_and_path]
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
return result.stdout
except subprocess.CalledProcessError:
return "" # File might be new, so it won't exist in HEAD
def parse_requirements(content: str) -> dict:
"""Parses requirements content into a dict of {package_name: version_string}."""
packages = {}
# This regex captures 'package-name==version' and ignores markers/hashes
regex = re.compile(r"^\s*([a-zA-Z0-9_.-]+)==([^;\s]+)")
for line in content.strip().split("\n"):
match = regex.match(line)
if match:
package_name = match.group(1).lower()
version_str = match.group(2)
packages[package_name] = version_str
return packages
def main():
"""Main function to find and compare staged requirements files."""
staged_files = get_staged_requirements_files()
if not staged_files:
print("No staged requirements.txt files found.")
return
for filepath in staged_files:
print(f"--- Comparing: {filepath} ---")
# Fetch content for 'before' (from HEAD) and 'after' (from index/staging)
before_content = get_file_content(f"HEAD:{filepath}")
# after_content = get_file_content(f":{filepath}")
after_content = pathlib.Path(filepath).read_text()
before_packages = parse_requirements(before_content)
after_packages = parse_requirements(after_content)
# Get a set of all unique package names from both files
all_package_names = sorted(set(before_packages.keys()) | set(after_packages.keys()))
has_changes = False
for name in all_package_names:
before_ver = before_packages.get(name)
after_ver = after_packages.get(name)
if before_ver == after_ver:
continue
has_changes = True
if before_ver and after_ver:
if parse_version(before_ver) < parse_version(after_ver):
print(f" [UPGRADED] {name}: {before_ver} -> {after_ver}")
elif parse_version(before_ver) > parse_version(after_ver):
print(f" [DOWNGRADED] {name}: {before_ver} -> {after_ver}")
else:
# This case handles non-version changes, like in the hash or marker
print(f" [MODIFIED] {name}: Line changed but version is the same.")
elif after_ver:
print(f" [ADDED] {name}: {after_ver}")
elif before_ver:
print(f" [REMOVED] {name}: {before_ver}")
if not has_changes:
print(" No version changes detected.")
print()
if __name__ == "__main__":
try:
main()
except ImportError:
print("Error: The 'packaging' library is required.")
print("Please install it: python3 -m pip install packaging")
except FileNotFoundError:
print("Error: The 'git' command was not found.")
print("Please make sure you are in a git repository and git is in your PATH.") |
…d `Pipfile.lock`
646aeb5
to
dec6614
Compare
https://issues.redhat.com/browse/RHAIENG-785
Description
How Has This Been Tested?
Merge criteria:
Summary by CodeRabbit