(Jun-24-2022, 11:41 PM)Skaperen Wrote: could you do pip_lst.append(line.split(None,1)[0]) to get a simpler list?Like this
pip_lst.append(line.split()[0])
But when i think about should not use
pip list
in poetry,as get stuff that not need as pytest modules.Like this.
poetry export --without-hashes --format=requirements.txt > requirements.txt
requirements.txt
numpy==1.23.0; python_version >= "3.10" pandas==1.4.3; python_version >= "3.8" python-dateutil==2.8.2; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8" pytz==2022.1; python_version >= "3.8" six==1.16.0; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.8"Then if need even simpler list don't known why this in needed all,parse like this.
poetry_lst = [] with open('requirements.txt') as f: for line in f: line = line.split('==') poetry_lst.append(line[0]) print(poetry_lst)
Output:['numpy', 'pandas', 'python-dateutil', 'pytz', 'six']
So remember this is the modules Pandas need to run,as started with just a environment for Pandas poetry add pandas
.