[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')() ) 1. 2. 3. 4. 5. 6. 7. 8. 9. 这个内容其实显示的意思是,foo将执行console_scripts中定义的foo所代表的函数。执行foo,发现打出了hello world!,和预期结果一样。 使用Eggsecutable Scripts 在字面上来理解这个词,Eggsecutable是Eggs和...
entry_points={ 'console_scripts': [ 'mytool=myproject.module:function', ], }, 这将在安装后创建一个名为mytool的命令行工具,运行时将调用myproject.module模块中的function函数。 测试命令行工具 安装项目后,你可以在命令行中直接调用mytool来测试它是否正常工作。 通过以上各个步骤,你可以全面掌握使用setup...
["data/*.dat"], } # 可以定义从命令行运行的脚本 [options.entry_points] console_scripts = [ "example-script = example_package:main", ] # 开发环境的依赖,通常包含测试、构建文档等 [tool.setuptools.extras_require] dev = ["check-manifest", "build", "twine"] # 测试相关配置 [tool....
这个内容其实显示的意思是,foo将执行console_scripts中定义的foo所代表的函数。执行foo,发现打出了hello world!,和预期结果一样。 使用Eggsecutable Scripts 从字面上来理解这个词,Eggsecutable是Eggs和executable合成词,翻译过来就是另eggs可执行。也就是说定义好一个参数以后,可以另你生成的.egg文件可以被直接执行...
'console_scripts': [ 'foo = demo:test', 'bar = demo:test', ], 'gui_scripts': [ 'baz = demo:test', ] } ) 修改setup.py增加以上内容以后,再次安装这个egg,可以发现在安装信息里头多了两行代码(Linux下): Installing foo script to /usr/local/bin ...
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 ...
entry_points参数是一个字典,其中的键是你的脚本的名称,值是脚本所在的模块和函数。例如,如果你的脚本名为"mycli",并且它的入口函数在"mycli.main"模块的"main"函数中,那么你可以将entry_points参数设置为{"console_scripts": "mycli=mycli.main:main"}。