nutikacompile


Namenutikacompile JSON
Version 0.13 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/nutikacompile
SummaryA function that creates the cmd line for nuitka and executes it - Windows only
upload_time2023-08-20 08:34:10
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords nuitka exe compile
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# A function that creates the cmd line for nuitka and executes it - Windows only 

## Tested against Windows 10 / Python 3.10 / Anaconda

### pip install nutikacompile


```python
from nutikacompile import compile_with_nuitka
# creates the command line and executes it in a new console
wholecommand = 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.exe
        r"C:\ProgramData\anaconda3\envs\adda\pi2\README.MD",  # output: compiledapptest/pi2/README.MD
    ],
    delete_onefile_temp=False,  # creates a permanent cache folder
    needs_admin=True,
)
print(wholecommand)

# The function creates and executes this command: 
start "" "C:\ProgramData\anaconda3\envs\adda\python.exe" -m nuitka C:/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.0



from nutikacompile import compile_with_nuitka

command_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)

Compilation command used: start "" "C:\ProgramData\anaconda3\envs\dfdir\python.exe" -m nuitka C:/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=1



def compile_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:

    Compiles a Python file using Nuitka.

    Args:
        pyfile (str): The path to the Python file to be compiled.
        icon (Union[str, None], optional): The path to the icon file to be used for the compiled executable. Defaults to None.
        disable_console (bool, optional): Whether to disable the console window for the compiled executable. Defaults to True.
        onefile (bool, optional): Whether to create a single executable file. Defaults to True.
        file_version (str, optional): The version number to be assigned to the compiled executable. Defaults to "1".
        file_description (str, optional): Description of the compiled executable. Defaults to an empty string.
        product_name (str, optional): The name of the product associated with the executable. Defaults to an empty string.
        copyright (str, optional): Copyright information for the executable. Defaults to an empty string.
        trademarks (str, optional): Trademarks information for the executable. Defaults to an empty string.
        outputdir (Union[str, None], optional): The path to the directory where the compiled executable will be saved. Defaults to None.
        addfiles (Union[list, None], optional): A list of files to be included in the compiled executable. Defaults to None.
        delete_onefile_temp (bool, optional): Whether to delete the temporary directory for the single executable file. Defaults to False.
        needs_admin (bool, optional): Whether the compiled executable requires administrative privileges to run. Defaults to False.
        relativefolderinapps (Union[None, str], optional): The relative folder path to be used for the compiled executable. Defaults to None.
        arguments2add (str, optional): Additional arguments to be passed to the Nuitka compiler. Defaults to an empty string.

    Returns:
        str: The command used to compile the Python file.

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/nutikacompile",
    "name": "nutikacompile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "nuitka,exe,compile",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9d/34/9ebb587f4dd22febae5cb5d6966ac5b5e6cf47fb7e9a3bf7556f6a14730e/nutikacompile-0.13.tar.gz",
    "platform": null,
    "description": "\r\n# A function that creates the cmd line for nuitka and executes it - Windows only \r\n\r\n## Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n### pip install nutikacompile\r\n\r\n\r\n```python\r\nfrom nutikacompile import compile_with_nuitka\r\n# creates the command line and executes it in a new console\r\nwholecommand = compile_with_nuitka(\r\n    pyfile=r\"C:\\ProgramData\\anaconda3\\envs\\adda\\secretsubprocess.py\",\r\n    icon=r\"C:\\Users\\hansc\\Pictures\\radiobutton.png\",\r\n    disable_console=True,\r\n    file_version=\"1.0.0.0\",\r\n    onefile=True,\r\n    outputdir=\"c:\\\\compiledapptest\",\r\n    addfiles=[\r\n        r\"C:\\ProgramData\\anaconda3\\envs\\adda\\convertpic2ico.exe\",  # output: compiledapptest/convertpic2ico.exe\r\n        r\"C:\\ProgramData\\anaconda3\\envs\\adda\\pi2\\README.MD\",  # output: compiledapptest/pi2/README.MD\r\n    ],\r\n    delete_onefile_temp=False,  # creates a permanent cache folder\r\n    needs_admin=True,\r\n)\r\nprint(wholecommand)\r\n\r\n# The function creates and executes this command: \r\nstart \"\" \"C:\\ProgramData\\anaconda3\\envs\\adda\\python.exe\" -m nuitka C:/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.0\r\n\r\n\r\n\r\nfrom nutikacompile import compile_with_nuitka\r\n\r\ncommand_used = compile_with_nuitka(\r\n    pyfile=r\"C:\\ProgramData\\anaconda3\\envs\\dfdir\\hiwo.py\",\r\n    icon=r\"C:\\Users\\hansc\\Pictures\\collage_2023_04_23_05_25_48_657510.png\",\r\n    outputdir=\"c:\\\\testcompnew\",\r\n    addfiles=[\r\n        r\"C:\\Users\\hansc\\Pictures\\numberresults.png\",\r\n        r\"C:\\Users\\hansc\\Pictures\\stringresultsdf.png\",\r\n    ],\r\n    file_version=\"1.0\",\r\n    file_description=\"My compiled executable\",\r\n    product_name=\"My App\",\r\n    copyright=\"Copyright 2023\",\r\n    trademarks=\"My Trademarks\",\r\n    disable_console=False,\r\n    onefile=True,\r\n    needs_admin=False,\r\n    arguments2add=\"--msvc=14.3 --noinclude-numba-mode=nofollow --jobs=1\",\r\n)\r\n\r\nprint(\"Compilation command used:\", command_used)\r\n\r\nCompilation command used: start \"\" \"C:\\ProgramData\\anaconda3\\envs\\dfdir\\python.exe\" -m nuitka C:/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=1\r\n\r\n\r\n\r\ndef compile_with_nuitka(\r\n    pyfile: str,\r\n    icon: Union[str, None] = None,\r\n    disable_console: bool = True,\r\n    onefile: bool = True,\r\n    file_version: str = \"1\",\r\n    file_description: str = \"\",\r\n    product_name: str = \"\",\r\n    copyright: str = \"\",\r\n    trademarks: str = \"\",\r\n    outputdir: Union[str, None] = None,\r\n    addfiles: Union[list, None] = None,\r\n    delete_onefile_temp: bool = False,\r\n    needs_admin: bool = False,\r\n    relativefolderinapps: Union[None, str] = None,\r\n    arguments2add: str = \"\",\r\n) -> str:\r\n\r\n    Compiles a Python file using Nuitka.\r\n\r\n    Args:\r\n        pyfile (str): The path to the Python file to be compiled.\r\n        icon (Union[str, None], optional): The path to the icon file to be used for the compiled executable. Defaults to None.\r\n        disable_console (bool, optional): Whether to disable the console window for the compiled executable. Defaults to True.\r\n        onefile (bool, optional): Whether to create a single executable file. Defaults to True.\r\n        file_version (str, optional): The version number to be assigned to the compiled executable. Defaults to \"1\".\r\n        file_description (str, optional): Description of the compiled executable. Defaults to an empty string.\r\n        product_name (str, optional): The name of the product associated with the executable. Defaults to an empty string.\r\n        copyright (str, optional): Copyright information for the executable. Defaults to an empty string.\r\n        trademarks (str, optional): Trademarks information for the executable. Defaults to an empty string.\r\n        outputdir (Union[str, None], optional): The path to the directory where the compiled executable will be saved. Defaults to None.\r\n        addfiles (Union[list, None], optional): A list of files to be included in the compiled executable. Defaults to None.\r\n        delete_onefile_temp (bool, optional): Whether to delete the temporary directory for the single executable file. Defaults to False.\r\n        needs_admin (bool, optional): Whether the compiled executable requires administrative privileges to run. Defaults to False.\r\n        relativefolderinapps (Union[None, str], optional): The relative folder path to be used for the compiled executable. Defaults to None.\r\n        arguments2add (str, optional): Additional arguments to be passed to the Nuitka compiler. Defaults to an empty string.\r\n\r\n    Returns:\r\n        str: The command used to compile the Python file.\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A function that creates the cmd line for nuitka and executes it - Windows only",
    "version": "0.13",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/nutikacompile"
    },
    "split_keywords": [
        "nuitka",
        "exe",
        "compile"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "39eee97981914edaea70fff1e825db4dbdd910015cf9258282c892ef177f679f",
                "md5": "29244815176785b298268f3676d5b30d",
                "sha256": "5649cffefe6ec63a426c54a7ff76146f4118d41f6ec7fcad0fdfd798d8c4a017"
            },
            "downloads": -1,
            "filename": "nutikacompile-0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "29244815176785b298268f3676d5b30d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 26830,
            "upload_time": "2023-08-20T08:34:07",
            "upload_time_iso_8601": "2023-08-20T08:34:07.723469Z",
            "url": "https://files.pythonhosted.org/packages/39/ee/e97981914edaea70fff1e825db4dbdd910015cf9258282c892ef177f679f/nutikacompile-0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d349ebb587f4dd22febae5cb5d6966ac5b5e6cf47fb7e9a3bf7556f6a14730e",
                "md5": "99ec4e425cd4174ff4fa1f33c3d744a5",
                "sha256": "6f5a0aef891702cb1a82816997c963c08fd88ee1a65451ef61d174232aa626f9"
            },
            "downloads": -1,
            "filename": "nutikacompile-0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "99ec4e425cd4174ff4fa1f33c3d744a5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26150,
            "upload_time": "2023-08-20T08:34:10",
            "upload_time_iso_8601": "2023-08-20T08:34:10.951030Z",
            "url": "https://files.pythonhosted.org/packages/9d/34/9ebb587f4dd22febae5cb5d6966ac5b5e6cf47fb7e9a3bf7556f6a14730e/nutikacompile-0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-20 08:34:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "nutikacompile",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "nutikacompile"
}
        
Elapsed time: 0.10256s