Reputation: 1789
I want to have a directory structure like so:
package
package/__init__.py
package/__main__.py
setup.py
And use package.__main__
as a entry point
setuptools.setup(
name="package",
version=0.1,
...
entry_points={"console_scripts": ["llmcli=llmcli"]},
)
Can I set entrypoints to do this?
Upvotes: 1
Views: 403
Reputation: 7253
The easiest is to refactor your __main__.py
slightly, so that it calls a main
function internally:
def main():
...
if __name__ == "__main__":
main()
Then you can add it as an entrypoint as mymodule.__main__:main
.
Upvotes: 3