python poetry怎么创建项目

发布时间:2021-09-07 11:01:38 作者:小新
来源:亿速云 阅读:144

这篇文章主要为大家展示了“python poetry怎么创建项目”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“python poetry怎么创建项目”这篇文章吧。

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 <qaz6803609@163.com>, 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 <you@example.com>"]
 
[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怎么创建项目”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

推荐阅读:
  1. 在Fedora上如何使用Poetry管理Python项目
  2. Python安装包的方法有哪些

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

poetry

上一篇:python中flake8怎么用

下一篇:python中mypy怎么用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》