🖊️

命令行工具

# 开启新项目 poetry new visfer cd visfer # 自动创建虚拟环境 poetry add 'typer[all]' # 激活虚拟环境 poetry shell
开发
# visfer/main.py import typer app = typer.Typer() @app.callback() def callback(): """ Awesome Portal Gun """ @app.command() def shoot(): """ Shoot the portal gun """ typer.echo("Shooting portal gun") @app.command() def load(): """ Load the portal gun """ typer.echo("Loading portal gun")
pip install typer-cli typer --install-completion typer visfer.main utils docs --output README.md --name visfer
# pyproject.toml [tool.poetry] name = "visfer" version = "0.1.0" description = "" authors = ["LinXueyuanStdio <linxy59@mail2.sysu.edu.cn>"] readme = "README.md" packages = [{include = "src"}] [tool.poetry.scripts] <- 加这两行 visfer = "visfer.main:app" [tool.poetry.dependencies] python = "^3.6" typer = {extras = ["all"], version = "^0.1.0"} [tool.poetry.dev-dependencies] pytest = "^5.2" [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api"
安装
poetry install visfer --help visfer load
poetry build poetry config pypi-token.pypi pypi-xxx poetry publish --build
poetry source add hexin http://xxx/simple/