Skip to content

Instantly share code, notes, and snippets.

@joeld1
Last active October 24, 2020 18:57
Show Gist options
  • Save joeld1/aa749491a44275fd63c098cc88f43034 to your computer and use it in GitHub Desktop.
Save joeld1/aa749491a44275fd63c098cc88f43034 to your computer and use it in GitHub Desktop.
Notes on ways to import requirements.txt files into Poetry

Original StackOverflow Post

  • Solution - 1

    • "poetry doesn't support this directly. But if you have a handmade list of required packages (at best without any version numbers), that only contain the main dependencies and not the dependencies of a dependency you could do this:"
      • cat requirements.txt|xargs poetry add
  • Solution - 2

    • Another Solution
      • for item in $(cat requirements.txt); do poetry add "${item}"; done
  • Solution - 3

    • A solution that prints out all requirements without version numbers; After dependencies are printed out, copy, paste, and run all poetry add commands
      • cat requirements.txt | grep -E '^[^# ]' | cut -d= -f1 | xargs -n 1 echo poetry add
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment