创新互联Python教程:pythonpoetry如何创建项目

1、可以通过命令poetrynew创建项目手脚架。

 poetry new example
 tree
.
└── example
    ├── example
    │   └── __init__.py
    ├── pyproject.toml
    ├── README.rst
    └── tests
        ├── __init__.py
        └── test_example.py
 
3 directories, 5 files

2、Poetry创建了example项目,生成了相应的文件夹和pyproject.toml,包括项目信息。

在现有项目中,通过命令poetryinit进行初始化。

  example poetry init
 
This command will guide you through creating your pyproject.toml config.
# 交互bash, 通过该交互bash填写项目信息。
Package name [example]:  example
Version [0.1.0]:  0.0.8
Description []:  example project
Author [so1n , n to skip]:  n
License []:  
Compatible python versions [^3.7]:  
 
Would you like to define your main dependencies interactively? (yes/no) [yes] no
Would you like to define your development dependencies interactively? (yes/no) [yes] no
Generated file
# 填写完项目信息后会生成以下内容, 之后会在刚才的路径创建pyproject.toml文件, 并写入。
[tool.poetry]
name = "example"
version = "0.0.8"
description = "example project"
authors = ["Your Name "]
 
[tool.poetry.dependencies]
python = "^3.7"
 
[tool.poetry.dev-dependencies]
 
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
 
 
Do you confirm generation? (yes/no) [yes] yes

以上就是python poetry创建项目的方法,希望对大家有所帮助。更多Python学习指路:创新互联python教程

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。

名称栏目:创新互联Python教程:pythonpoetry如何创建项目
标题URL:http://www.shufengxianlan.com/qtweb/news11/319861.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联