I break out utility functions and validators into their own files and import them, but I actually kind of like having all the command functions in a single file.
https://stackoverflow.com/a/39228156/4074877 has an approach that looks good, though.
On 7/29/21, 4:42 PM, "Code for Libraries on behalf of Eric Lease Morgan" <[log in to unmask] on behalf of [log in to unmask]> wrote:
On Jul 29, 2021, at 12:46 PM, Eric Lease Morgan <[log in to unmask]> wrote:
> So far, Click has been working for me: https://click.palletsprojects.com/en/8.0.x/
My Click script is coming along quite nicely, but now I have a Python noobie question. My script is getting longer and longer with various definitions looking something like this:
def config() :
# do cool stuff here
@click.argument( 'location' )
def list( location ) :
# do more cool stuff
@click.argument( 'carrel' )
def harvest( carrel ) :
# do even more cool stuff
What is the technique I should use if I want to put each of these little functions into individual files? In the end, I'd like to have a whole set of little files where each one does a specific operation. I suppose I could create file full of functions, but then that file would be very long.
Eric "Sort Of Embarrassed" Morgan