How to configure __main__.py, __init__.py, and __setup__.py for a basic package setup?

前端 未结 3 1294
栀梦
栀梦 2021-01-30 01:48

Background:

I have a directory structure like so:

Package/
    setup.py
    src/
        __init__.py
        __main__.py 
        code.py
3条回答
  •  無奈伤痛
    2021-01-30 02:16

    I often use this setup because it works better with python setup.py develop

    Package_root/
        setup.py
        src/
            Package/
                __init__.py
                __main__.py 
                code.py
    

    It's probably not (yet) the detailed answer you're expecting but I think it's worth trying for the three use cases.

    setup( ...
        package_dir = {'': 'src'},
        entry_points = {'console_scripts': ['Package = Package.__main__:main'],},
        packages = find_packages(exclude=["Package.egg_info",]),
    ...)
    

提交回复
热议问题