Skip to content

Commit

Permalink
docstrings, encoding get_pkg_reqs
Browse files Browse the repository at this point in the history
  • Loading branch information
evelynmitchell committed Dec 29, 2023
1 parent 39d9721 commit d1127ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/get_package_requirements.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
"""
This script extracts the package names and versions from a requirements.txt file and writes them to a new file.
The new file can be used to install the same package versions on another machine.
"""

import pkg_resources


def get_package_versions(requirements_path, output_path):
"""
Extract package names and versions from a requirements.txt file and write them to a new file.
"""
try:
with open(requirements_path, "r") as file:
with open(requirements_path, "r", encoding="utf-8") as file:
requirements = file.readlines()
except FileNotFoundError:
print(f"Error: The file '{requirements_path}' was not found.")
Expand Down

0 comments on commit d1127ca

Please sign in to comment.