需要帮助使用诗歌创建 CLI 应用程序

问题描述 投票:0回答:1

我使用 typer 在 python 中创建了一个 cli 应用程序,但我不想调用

py main.py
,而是想使用命令
starfish
来调用该程序。过去我使用诗歌包装创建并发布了 cli 应用程序,但这次我遇到了问题。

pyproject.toml

[tool.poetry]
name = "starfish"
version = "0.1.0"
description = "A python based File Transfer Protocol(FTP) program."
authors = ["777advait"]
license = "MIT License"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
rich = "^13.3.4"
questionary = "^1.10.0"
bcrypt = "^4.0.1"
typer = "^0.7.0"
scapy = "^2.5.0"

[tool.poetry.scripts]
starfish="starfish.main:run"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

下图显示了我面临的问题

python command-line-interface packaging
1个回答
0
投票

尝试

poetry run starfish

或使用

poetry shell
输入诗歌 venv,然后只需
starfish

© www.soinside.com 2019 - 2024. All rights reserved.