When doing a poetry init I got the following structure:
/packagename
__init__.py
packagename.py
/packagename
/tests
__init__.py
test_packagename.py
pyproject.toml
which is fine for a package but I do not see how to make it fit a command line script. When I have a script like script.py with the following code structure:
In file script.py:
#!/usr/bin/python3
def main():
print("Ok")
if __name__ == '__main__':
main()
It is not intended to be used as a python module however, it may have dependencies and tests that are interesting to be handle with poetry.
In some example it is shown that with the following poetry syntax:
[tool.poetry.scripts]
cli_script = 'script.py:main'
then one can call the script with:
poetry run cli_script
I am looking for some guideline on howto organize properly my poetry project for such usage.
I have looked for option for poetry init (like poetry init --script) for instance. But it seems that kind of use case was not covered in the new/init poetry options.