Closed waylan closed 6 years ago
A couple notes on my initial proposal.
I had missed that the README specifically states:
click-man will generate one man page per command of your click CLI application specified in
console_scripts
in yoursetup.py
.
That being the case, the command click-man foo
should look for the console-script
entry point named foo
among installed packages. That actually makes more sense than assuming foo.__main__
and solves the problem of defining which object in foo.__main__
should be used (i.e. foo.__main__:cli
) as that would already be defined by the console_script
entry point (a detail I missed in my proposal above).
After reviewing PEP 427, specifically the answer to Is it possible to import Python code directly from a wheel file?, it seems likely that while passing a .whl
file to click-man might work for most pure-python packages, there is no guarantee it will work for all packages. That being the case, perhaps it makes sense to leave the click-man
command to only work with installed packages. After all, it would be odd to generate a man-page for a package that is not installed.
By requiring a disutils Command to run click-man, you are also requiring that the user has a
setup.py
file and an uninstalled package available locally. However, many (most?) packages these days document installation withpip install packagename
. And more and more packages are being distributed as wheels, which don't even contain a setup.py script. Naturally, a disutls Command does not work in these settings.Therefore, click-man should provide its own command line tool (presumably implemented with click, which would need to be installed anyway). Then the tool could be pointed at either an already installed package (perhaps using whatever would be passed to
python -m
) or a distribution package (whl/tar.gz) to generate man pages.Then, using an installed package, the user would do something like this:
Of course, the
foo
lib would need to supportpython -m foo
to run foo's commands forclick-man foo
to work.Or, if the user has a downloaded distribution file, then this would work:
Presumably, click-man would look for
foo/__main__.py
within the whl file.