admin管理员组文章数量:1333390
I have been developing a small python-based package that contains multiple scripts that are to be used as command line tools in linux environment.
This has a typical package structure:
MyPackage/
├── LICENSE
├── README.md
├── MyPackage
│ ├── __init__.py
│ ├── command1.py
│ ├── command2.py
│ ├── command3.py
│ ...
├── pyproject.toml
├── setup.py
I want for the commands to be found as command line tools after installing this package by
pip install .
However, after installation, my environment does not find the commands. Checking a lot of resources, it seems that the problem is likely to be with the setup.py file, or more specifically, with entry points. If entry points are set properly, the commands are supposed to be found at bin directory, but they are not found. pip show MyPackage prints the following directory only: /home/My/../python3.12/site-packages/MyPackage
The following is my setup.py
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="MyPackage",
version="0.0.1",
author="Me",
description="my package",
entry_points={
'console_scripts': [
'command1=MyPackagemand1:main',
'command2=MyPackagemand2:main',
'command3=MyPackagemand3:main'
],
},
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"],
python_requires='>=3.6',
install_requires=['numpy>=1.17.2']
Of course, I can add some files to bin that calls the commands of my package. But I want to make it pip available for other users.
I am sure this is not a problem of my environment since I tested it with multiple devices. I am using conda, but I am not sure if this is relevant.
I tried to install the package as user specific by adding --user with pip installation as suggested by some people online. However, it did not resolve the issue.
Could you please give me some help make it easily installable as a command line tool package?
本文标签: pythonEntrypoints problem with setuptools for making my script executableStack Overflow
版权声明:本文标题:python - Entrypoints problem with setuptools for making my script executable - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742332822a2455033.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论