-
-
Save woss/8d2e08069139d43b93a99b96032a255c to your computer and use it in GitHub Desktop.
Sort requirements pip files or requirements.txt for python dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requirements_file = 'base.pip' | |
requirements = open(requirements_file, 'r') | |
content = requirements.read().splitlines() | |
content = list(set(content)) | |
content.sort(key=lambda y: y.lower()) | |
content = '\n'.join(content) | |
file = open('sorted_'+requirements_file, 'w') | |
file.write(content) | |
file.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment