'How to use 'Nuitka' to create a CLI app using a library like 'click'

When creating Click CLI apps we need to define entry points, which we do in setup.py

For example: (from click docs)

from setuptools import setup

setup(
    name='yourscript',
    version='0.1.0',
    py_modules=['yourscript'],
    install_requires=[
        'Click',
    ],
    entry_points={
        'console_scripts': [
            'yourscript = yourscript:cli',
        ],
    },
)

How do we define entry points for nuitka generated executable file.



Solution 1:[1]

One way to pass the entry point to nuitka would be as follows:

  • Install package in editable mode to generate entry point script
  • Pass entry point script to nuitka as the main module
$ pip install -e .  
$ python -m nuitka --onefile $(which yourscript)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jcollado