[metadata]name= hello-worldversion="1.0.0"description="helloworld description"[option]python_requires= >=3.6packages= find:zip_safe=false# 此处申明了一个可执行程序名为hello-world,指向hello.hello_impl包中的say函数[options.entry_points]console_scripts=hello-world= hello.hello_impl:say setup.py fro...
[entry_points] console_scripts=project_name=project.cmd.mycmd:main [options] zip_safe=False include_package_data=True packages=find: scripts=bin/first.py bin/second.py install_requires=requests importlib; python_version== "2.7"[options.package_data]* = *.txt, *.rst hello= *.msg [options....
load_entry_point('demo==0.1','console_scripts','foo')() ) 这个内容其实显示的意思是,foo将执行console_scripts中定义的foo所代表的函数。执行foo,发现打出了hello world!,和预期结果一样。 使用Eggsecutable Scripts 从字面上来理解这个词,Eggsecutable是Eggs和executable合成词,翻译过来就是另eggs可执行。...
load_entry_point('demo==0.1', 'console_scripts', 'foo')() ) 1. 2. 3. 4. 5. 6. 7. 8. 9. 这个内容其实显示的意思是,foo将执行console_scripts中定义的foo所代表的函数。执行foo,发现打出了hello world!,和预期结果一样。 使用Eggsecutable Scripts 在字面上来理解这个词,Eggsecutable是Eggs和...
'console_scripts': [ 'mytool=myproject.module:function', ], }, 这将在安装后创建一个名为mytool的命令行工具,运行时将调用myproject.module模块中的function函数。 测试命令行工具 安装项目后,你可以在命令行中直接调用mytool来测试它是否正常工作。
["data/*.dat"], } # 可以定义从命令行运行的脚本 [options.entry_points] console_scripts = [ "example-script = example_package:main", ] # 开发环境的依赖,通常包含测试、构建文档等 [tool.setuptools.extras_require] dev = ["check-manifest", "build", "twine"] # 测试相关配置 [tool....
scripts是把.sh、.py等可执行脚本生成到系统path中 from setuptools import setup setup( ……… #把python中的函数自动生成为一个可执行的脚本 # 如下:把fool.main文件中的main函数自动生成为一个可执行脚本,可以通过命令foo执行该脚本 entry_points={ 'console_scripts': [ # key值为console_scripts 'fo...
'console_scripts': [ 'foo = demo:test', 'bar = demo:test', ], 'gui_scripts': [ 'baz = demo:test', ] } ) 修改setup.py增加以上内容以后,再次安装这个egg,可以发现在安装信息里头多了两行代码(Linux下): Installing foo script to /usr/local/bin ...
例如,如果你的脚本名为"mycli",并且它的入口函数在"mycli.main"模块的"main"函数中,那么你可以将entry_points参数设置为{"console_scripts": "mycli=mycli.main:main"}。 在setup函数中,使用install_requires参数来指定你的项目所依赖的其他Python包。这样,在安装你的项目时,setuptools会自动安装这些依赖项。...
entry_points={# 命令行脚本的入口点'console_scripts': ['my_command=my_package.cli:main', ], }, ) 四、代码解释 导入模块:首先,我们从setuptools模块中导入了setup和find_packages函数。 读取长描述:我们使用with open语句从README.md文件中读取长描述,并将其存储在long_description变量中。这通常用于在PyPI...