Package: nutikacompile
A function that creates the cmd line for nuitka and executes it - Windows onlyTested against Windows 10 / Python 3.10 / Anacondapip install nutikacompilefromnutikacompileimportcompile_with_nuitka# creates the command line and executes it in a new consolewholecommand=compile_with_nuitka(pyfile=r"C:\ProgramData\anaconda3\envs\adda\secretsubprocess.py",icon=r"C:\Users\hansc\Pictures\radiobutton.png",disable_console=True,file_version="1.0.0.0",onefile=True,outputdir="c:\\compiledapptest",addfiles=[r"C:\ProgramData\anaconda3\envs\adda\convertpic2ico.exe",# output: compiledapptest/convertpic2ico.exer"C:\ProgramData\anaconda3\envs\adda\pi2\README.MD",# output: compiledapptest/pi2/README.MD],delete_onefile_temp=False,# creates a permanent cache folderneeds_admin=True,)print(wholecommand)# The function creates and executes this command:start"""C:\ProgramData\anaconda3\envs\adda\python.exe"-mnuitkaC:/ProgramData/anaconda3/envs/adda/secretsubprocess.py--assume-yes-for-downloads--output-dir=c:/compiledapptest--windows-disable-console--onefile--windows-icon-from-ico=C:/Users/hansc/AppData/Local/Temp/tmpb4w1z8d9.ico--include-data-files=C:/Users/hansc/AppData/Local/Temp/tmpb4i48w8_=.//=**/*.*--windows-uac-admin--file-version=1.0.0.0--onefile-tempdir-spec=%CACHE_DIR%/nutikacompile/1.0.0.0fromnutikacompileimportcompile_with_nuitkacommand_used=compile_with_nuitka(pyfile=r"C:\ProgramData\anaconda3\envs\dfdir\hiwo.py",icon=r"C:\Users\hansc\Pictures\collage_2023_04_23_05_25_48_657510.png",outputdir="c:\\testcompnew",addfiles=[r"C:\Users\hansc\Pictures\numberresults.png",r"C:\Users\hansc\Pictures\stringresultsdf.png",],file_version="1.0",file_description="My compiled executable",product_name="My App",copyright="Copyright 2023",trademarks="My Trademarks",disable_console=False,onefile=True,needs_admin=False,arguments2add="--msvc=14.3 --noinclude-numba-mode=nofollow --jobs=1",)print("Compilation command used:",command_used)Compilationcommandused:start"""C:\ProgramData\anaconda3\envs\dfdir\python.exe"-mnuitkaC:/ProgramData/anaconda3/envs/dfdir/hiwo.py--standalone--assume-yes-for-downloads--output-dir=c:/testcompnew--onefile--windows-icon-from-ico=C:/Users/hansc/AppData/Local/Temp/tmp8zzir78h.ico--include-data-files=C:/Users/hansc/AppData/Local/Temp/tmpms6imq2a=.//=**/*.*--file-version=1.0--product-name="My App"--file-description="My compiled executable"--copyright="Copyright 2023"--trademarks="My Trademarks"--onefile-tempdir-spec=%CACHE_DIR%/hiwo/1.0--msvc=14.3--noinclude-numba-mode=nofollow--jobs=1defcompile_with_nuitka(pyfile:str,icon:Union[str,None]=None,disable_console:bool=True,onefile:bool=True,file_version:str="1",file_description:str="",product_name:str="",copyright:str="",trademarks:str="",outputdir:Union[str,None]=None,addfiles:Union[list,None]=None,delete_onefile_temp:bool=False,needs_admin:bool=False,relativefolderinapps:Union[None,str]=None,arguments2add:str="",)->str:CompilesaPythonfileusingNuitka.Args:pyfile(str):ThepathtothePythonfiletobecompiled.icon(Union[str,None],optional):Thepathtotheiconfiletobeusedforthecompiledexecutable.DefaultstoNone.disable_console(bool,optional):Whethertodisabletheconsolewindowforthecompiledexecutable.DefaultstoTrue.onefile(bool,optional):Whethertocreateasingleexecutablefile.DefaultstoTrue.file_version(str,optional):Theversionnumbertobeassignedtothecompiledexecutable.Defaultsto"1".file_description(str,optional):Descriptionofthecompiledexecutable.Defaultstoanemptystring.product_name(str,optional):Thenameoftheproductassociatedwiththeexecutable.Defaultstoanemptystring.copyright(str,optional):Copyrightinformationfortheexecutable.Defaultstoanemptystring.trademarks(str,optional):Trademarksinformationfortheexecutable.Defaultstoanemptystring.outputdir(Union[str,None],optional):Thepathtothedirectorywherethecompiledexecutablewillbesaved.DefaultstoNone.addfiles(Union[list,None],optional):Alistoffilestobeincludedinthecompiledexecutable.DefaultstoNone.delete_onefile_temp(bool,optional):Whethertodeletethetemporarydirectoryforthesingleexecutablefile.DefaultstoFalse.needs_admin(bool,optional):Whetherthecompiledexecutablerequiresadministrativeprivilegestorun.DefaultstoFalse.relativefolderinapps(Union[None,str],optional):Therelativefolderpathtobeusedforthecompiledexecutable.DefaultstoNone.arguments2add(str,optional):AdditionalargumentstobepassedtotheNuitkacompiler.Defaultstoanemptystring.Returns:str:ThecommandusedtocompilethePythonfile.