Skip to content

Instantly share code, notes, and snippets.

@woss
Forked from michaelBenin/sort_requirements.py
Created February 15, 2017 18:24
Show Gist options
  • Select an option

  • Save woss/8d2e08069139d43b93a99b96032a255c to your computer and use it in GitHub Desktop.

Select an option

Save woss/8d2e08069139d43b93a99b96032a255c to your computer and use it in GitHub Desktop.

Revisions

  1. @michaelBenin michaelBenin created this gist Jul 20, 2014.
    16 changes: 16 additions & 0 deletions sort_requirements.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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()