如何创建python库以及如何在palantir代工厂中导入它 [英] How to create python libraries and how to import it in palantir foundry
问题描述
为了概括 python 函数,我想向 python 库添加函数,以便我可以在多个存储库中使用这些函数.任何人都请回答以下问题.
In order to generalize the python functions, I wanted to add functions to python libraries so that I can use these function across the multiple repositories. Anyone please answer the below questions.
1) 如何创建我们自己的python库2) 如何跨多个存储库导入这些库
推荐答案
- 如何在 Palantir Foundry 中创建 Python 库?
要创建新库,您可以通过创建新存储库来实现.当提示初始化存储库时,您应该有一个选项,内容如下:
To create a new library, you can do so by creating a new repository. When prompted to initialise the repository, you should have an option that reads:
Python Library
Template for publishing a Python library package. Consuming new libraries has changed,
please read README in library repository.
自述文件将包含有关如何发布库的说明.建议您了解 conda 发布渠道如何为此工作.
The readme will contain instructions on how to publish a library. It is recommended you understand how conda publishing channels work for this.
注意,避免在库名称中使用 _
,因为它会导致问题.-
可以安全使用.
A note, avoid using _
in the library name, since it can cause problems. -
is safe to use though.
- 如何在代码创作中导入库?
一旦您的库发布,您可以将其添加到您想要使用该库的存储库的 conda 配方中.您可以在以下位置找到它:transforms-python/conda_recipe/meta.yaml
Once your library is publishing, you can add it to your conda recipe of the repository you want to consume the library in. You can find this in: transforms-python/conda_recipe/meta.yaml
之后只需将其添加到下面的列表中
Afterwards just add it to the list of under
requirements:
run:
- python
- pandas
- your-library-name
这篇关于如何创建python库以及如何在palantir代工厂中导入它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!