cuddly-jelly-27016
05/18/2025, 2:21 PMpyflyte package unfortunately result in a very bad first-time UX
Issue created by fg91
### Description
Imagine we have a working directory called workflows which contains a file wf.py which I as a first-time user of pyflyte package want to package:
When a user runs pyflyte package —help, they see:
~ pyflyte package —help
…
--source -s DIRECTORY Local filesystem path to the root of the package.
…
So I ran pyflyte package -s . which gives this error:
<help message>
No packages to scan for flyte entities. Aborting!
When googling`pyflyte package`, the first result is this docs page which does, however, not contain any example of how to use pyflyte package.
This docs page which I found next and which describes all pyflyte commands and options also does not contain a working code snippet.
Only when searching further I found this page which gives the first hint that the —source flag is not the right way to specify the workflow package/location but that one needs to use the pyflyte --pkgs <path> package command which notably does not contain —source.
When trying pyflyte --pkgs . package, I get this error:
Failed with Unknown Exception <class 'TypeError'> Reason: the 'package' argument is required to perform a relative import for '.'
…
File “…/importlib/__init__.py", line 122, in import_module
raise TypeError(msg.format(name))
Only when trying pyflyte --pkgs workflows package instead of pyflyte --pkgs . package from the parent directory of workflows, it finally works.
Todos for closing this issue:
• Provide a working code snippet in the documentation showing how the —source argument of pyflyte package is used or remove the —source argument if in fact it is not working.
• pyflyte package —help should show a working command including the —pkgs option.
• This and this documentation page should contain a working code snippet for pyflyte package
• pyflyte —pkgs . package should work when passing . as the current working directory or should at least catch the exception and provide a meaningful error message.
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
05/18/2025, 2:21 PM