【发布时间】:2020-01-10 13:05:10
【问题描述】:
在过去的几天里,我正在研究一个 python 模块。到目前为止,我在许多其他项目中使用poetry 作为包管理工具,但这是我第一次想将包发布到 PyPI。
我能够运行poetry build 和poetry publish 命令。我还能够安装已发布的软件包:
$ pip3 install git-profiles
Collecting git-profiles
Using cached https://files.pythonhosted.org/packages/0e/e7/bac9027effd1e34a5b5718f2b35c0b28b3d67f3809e2f2981b6c7b58963e/git_profiles-1.1.0-py3-none-any.whl
Installing collected packages: git-profiles
Successfully installed git-profiles-1.1.0
但是,在安装之后,我无法运行我的包:
$ git-profiles --help
git-profiles: command not found
我的项目结构如下:
git-profiles/
├── src/
│ ├── commands/
│ ├── executor/
│ ├── git_manager/
│ ├── profile/
│ ├── utils/
│ ├── __init__.py
│ └── git_profiles.py
└── tests
我尝试在 pyproject.toml 文件中使用不同的脚本配置,但安装后我一直无法使其工作。
[tool.poetry.scripts]
poetry = "src:git_profiles.py"
或
[tool.poetry.scripts]
git-profile = "src:git_profiles.py"
不知道这是python/pip路径/版本的问题还是我需要在配置文件里改一下。
【问题讨论】:
标签: python git publish pypi python-poetry