packaging.python.org
packaging.python.org copied to clipboard
Add a tutorial/guide for creating a command line tool
Related to #614.
As a companion to the packaging tutorial and installing command line tools guide, it'd be nice to have a walkthrough of transforming a command-line utility from running python my_utility.py
in the script's directory to running my_utility
in an arbitrary location (maybe via pipx
?).
@theacodes Something that occurred to me while talking to Brian about this is that we have a potentially interesting opportunity here around the following structure:
- how to package a utility to make it installable with
pipx
(tutorial, perhaps?) - how to use
briefcase
to take a utility installable withpipx
, and create platform native installers for it
(cc @freakboy3742)
I'd love guides along those two lines.
On Wed, May 8, 2019, 10:27 AM Nick Coghlan [email protected] wrote:
@theacodes https://github.com/theacodes Something that occurred to me while talking to Brian about this is that we have a potentially interesting opportunity here around the following structure:
- how to package a utility to make it installable with pipx (tutorial, perhaps?)
- how to use briefcase to take a utility installable with pipx, and create platform native installers for it
(cc @freakboy3742 https://github.com/freakboy3742)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pypa/packaging.python.org/issues/615#issuecomment-490576644, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB5I4ZFQWUHZX4FRV47R3DPUMEPDANCNFSM4HLDRCKQ .
Briefcase doesn't currently have any tooling for supporting command line scripts - it's focused on packaging traditional "app" bundles (i.e., icons on a launcher that create a window). However, I don't have any objection to adding a mode for adding command line scripts.
I did what I think is the minimum amount of work to convert a standalone script to an installable utility in the first release of a personal utility. The next release added a README
and LICENSE
.
I know this doesn't follow a lot of best practices (package instead of module, __main__
, tests, ...), but I was aiming for the shortest path to pipx install
.
Related: Creating a setup process for a Python command line utility - Packaging - Discussions on Python.org
A guide on PyApp usage, which emerged just recently but is already quite successful, should be useful, too.
Updating the status of Briefcase on this: we are nearing completion of a PR that will add support for packaging command line apps. We anticipate this will be merged very soon, with a release soon after (probably by mid June).
Happy to package that into a guide once it's ready!