如何整理我的安装脚本,只保留使用的内容?

2024-05-20 02:31:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我们使用pip进行安装,现在我想清理它,以便只安装所使用的包。使用pycharm扫描python项目中的python文件并删除没有使用的导入的包,或者删除实际使用的安装可能会出错的包,这是一种可以接受的策略吗?你知道吗

我的安装脚本如下。你知道吗

--find-links=http://pypi.sys.kth.se/local/

# Git support for setuptools
setuptools-git==1.0

Django==1.6.2
django-autoslug==1.6.1
django-cas==KTH-2.0.3
BeautifulSoup==3.2.1
South==0.8.4
Pillow==2.3.0
pysolr==2.0.15
django-haystack==1.2.7
django-pagination==1.0.7
Whoosh==2.4.1
markdown2==2.1.0
suds==0.4
python-dateutil<2.0
# for timezone information
pytz<=2013d

django-plainpasswordhasher==0.3

# Infrastructure
python-memcached==1.53
pymongo==2.7.1


# You also need this.. MySQL-python==1.2.3c1

# for iCalendar support (deprecated and slow!)
vobject==0.8.1c

# for iCalendar support
icalendar==3.5

# sane advanced http client (need to support file upload etc)
requests==1.2.1


# for async task handling (for now using simple db backend)
# note this imples amqplib, anyjson, django-celery, django-picklefield, kombu, ordereddict, pyparsing, python-dateutil that we do not explciitly list here.
django-celery==3.1.10
# And Celery monitoring
flower

# Be specific about celery version.
celery==3.1.13

# And pyparse
pyparsing==1.5.7
html2text==3.200.3 # to convert html to (markup) text in mails etc
django-rosetta==0.7.4

diff-match-patch>=20110725

django-compressor==1.4

# note jsmin 2.0.4 was breaking widget.js etc.
jsmin==2.0.2 

# For coverage testing
#coverage

# For nose test runner
nose==1.3.4
django-nose==1.2
mock

#VCR for python
vcrpy==1.0.2

freezegun==0.2.2

phonenumbers==7.0.1

# Monitoring
newrelic==2.34.0.29

# Fileserver requirements
flask>=0.10
httmock==1.2.2
beaker>=1.6.4

Tags: todjangohttpsupportforetcpyparsingneed
1条回答
网友
1楼 · 发布于 2024-05-20 02:31:41

在一般情况下,您的方法听起来是合理的,但实际上并不能保证它适用于每个代码库。你知道吗

真正的解决方案是首先确保您有足够的测试覆盖率;然后,您可以进行更改,运行测试套件,并以合理的信心发现更改是否破坏了任何东西。你知道吗

相关问题 更多 >