系统信息发现和资产跟踪
corn的Python项目详细描述
系统信息发现和资产跟踪
安装
pip install corn
开发安装
克隆cornrepo并使用pip安装:
^{pr2}$执行
安装后,corn命令现在应该可用了。在
命令在垂直扩展之前没有输出(详细信息如下)。在
测试
安装要求-测试.txt使用pip并运行pytest:
pip install -r corn/requirements-test.txt pytest corn/tests
垂直应用程序合并
玉米延伸说明
安装pop:
pip install --upgrade pop
为项目创建新目录:
mkdir corn_{project_name} cd corn_{project_name}
使用pop seed生成扩展玉米的项目结构:
pop-seed -t v corn_{project_name} -d corn
- “-t v”指定这是一个垂直应用程序合并的项目
- “-d corn”表示要实现“corn”的动态名称
请注意,已经为您创建了一些结构。 我们特别关注corn{project_name}/corn中的新目录
添加“玉米”到要求.txt公司名称:
echo "corn" >> requirements.txt
创造玉米
- Create a new file in “corn_{project_name}/corn”
- The directory should already have been created by pop-seed.
- The file name is arbitrary.
- Every file in this directory, then it’s subdirectories, will be parsed “simultaneously” (as far as that makes sense for asyncio).
- Corns that are dependant on each other should be assigned in the same function.
- Do NOT rely on the collector’s recursion strategy for corns to depend on each other.
- Use hub.corn.init.wait_for(“corn”) to wait for corns to be generated by another sub
- Add your new project to the python path
- alternatively, run “pip install -e .” from your project’s root directory
- you only need to do this once
- Create an async function in this file with a descriptive yet arbitrary name
- By convention it should start with “load”
- Make it async unless you have a really really really good reason.
- Grains that depend on each other already belong in the same function, don’t depend on synchronous programming for determinism
- Corns can be accessed and assigned like a dictionary, but our convention is to use the namespace
示例:
async def load_my_corn(hub): hub.corn.CORN.new_corn = "Hello World!"
就这样!现在从命令行验证是否收集了玉米:
corn new_corn
输出:
new_corn: Hello World!
- 项目
标签: