简体   繁体   English

Lamba软件包包括pip,setuptools

[英]Lamba package includes pip, setuptools

I followed the AWS guide to prepare a deployment package for my lambda function. 我按照AWS指南为lambda函数准备了部署程序包。 The generated zip file is around 9 - 10MB which includes pip, setuptools, pylint. 生成的zip文件约为9-10MB,其中包括pip,setuptools,pylint。 Are they really required? 他们真的需要吗?

Here are the commands. 这是命令。

virtualenv v-env
source v-env/bin/activate
pip install xmltodict
pip install requests
deactivate
cd v-env/lib/python3.7/site-packages/
zip -r9 ../../../../function.zip .

Edit: Remove installing boto as it is provided by AWS already 编辑:删除安装boto,因为它已经由AWS提供

Well, as you may see the guides provide standars and, obviously, guidance for a clean and nice coding or project deployment. 好了,正如您可能会看到的,这些指南提供了标准知识,并且显然还提供了干净整洁的编码或项目部署的指南。

Pylint has a lot of features that help you out while using Python as your programming language, such as checking coding standars, error detection, refactoring help in order to prevend duplicated code, among other tools. Pylint具有许多功能,可在将Python用作编程语言时为您提供帮助,例如检查编码标准,错误检测,重构帮助以防止重复代码,以及其他工具。

Setuptools is really useful too. Setuptools也确实很有用。 Is a development process library designed to facilitate packaging Python projects by enhancing the Python standard library distribution utilities, I encourage you to use it in order to wrap your processes and models in order to have a strong modular project. 是一个开发过程库,旨在通过增强Python标准库分发实用程序来促进打包Python项目,我鼓励您使用它来包装过程和模型,以拥有一个强大的模块化项目。

And pip is a Package Manager for python packages or modules. pip是python软件包或模块的软件包管理器。 You can add, download, delete and a lot more things with it by simple using few words on a line of code. 您可以通过在一行代码中简单地使用几个单词就可以添加,下载,删除以及执行更多操作。 This package manager is useful, you can download wheels, zip's and modules from the internet and easily install them by just using 该软件包管理器很有用,您可以从互联网上下载轮子,zip文件和模块,并只需使用即可轻松安装它们

pip install <module or library name>

So, by answering your question, if you downloaded and installed a package for AWS supported in Python and it installed those libraries I must think those are being used across the modules you want to use. 因此,通过回答您的问题,如果您下载并安装了Python支持的AWS软件包并安装了这些库,则我必须认为这些库正在您要使用的模块中使用。

You can always check the source code in order to be sure. 您始终可以检查源代码以确保。 If the libraries aren't really being used, they aren't necessary since there are several libraries and packages that do what those libraries do. 如果没有真正使用这些库,则没有必要使用它们,因为有多个库和程序包可以完成这些库的工作。

Hope it helps, happy coding. 希望对您有所帮助,编码愉快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM