Extract the import statements and create a requirements.txt/environment.yml file, but remember that some of them may need editing since the PyPI package may not match the module. We can keep a manually curated list for the most popular ones ( maybe use PyPI API to check which ones do not exist)
we can iterate over imports with:
import parso
tree = parso.parse(code_str)
tree.iter_imports()
Extract the import statements and create a
requirements.txt
/environment.yml
file, but remember that some of them may need editing since the PyPI package may not match the module. We can keep a manually curated list for the most popular ones ( maybe use PyPI API to check which ones do not exist)we can iterate over imports with: