Skip to content

Click, a Cromulent Command-line Parsing Package for Python (presentation)

Notifications You must be signed in to change notification settings

unixnut/Python-Click-talk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Click, a Command-line Parsing Package for Python

A talk to be given at the Python WA meetup on 2021-11-04

Blurb

Do you prefer to spend your time writing a program, or writing the interface layer (which handles the command-line options and subcommands, tests them for validity, opens files, etc.)?

Wouldn't it be great if you could just indicate how your command-line interface should work and let something else take care of the details? Good news: Click can do this! It uses decorators, so as to keep your interface functions concerned only with business logic, i.e. dealing with the problem domain. Click has a large set of classes that make it easy to specify the type of your command-line options and arguments, and create custom types if you want. And it generates online help messages, which can be enhanced by optional descriptions that you add to your option specifications.

This talk will give an overview of how to create a Python command-line tool using setup.py packaging, with entry points.

https://click.palletsprojects.com

Outline

  1. Introduction
  2. Click rationale
  3. The basics
  4. Options
    1. Boolean options
    2. Options with parameters
    3. Integer options
    4. Counting options
    5. Mandatory options
    6. Choice options
    7. File path options
    8. File handle options
    9. Multi-string options
    10. Password option
    11. Prompting when an option is missing
  5. Positional parameters
    1. Lists of parameters
    2. Variable numbers of parameters
  6. Click types
  7. Subcommands
  8. Contexts
  9. Defaults and the environment
  10. Colours, logging, prompting, exceptions, oh my!
  11. Conclusion
  12. Questions

Presenter bio

Alastair is a Software Engineer and system administrator by trade. He has a BSc in Computer Science from Curtin University.

His computer-related interests lie in various areas within his trade; suffice to say that he is a "geek of many colours". :) Alastair is a die-hard FOSS user and Linux fan.

He is also a freelancer with his own business. Warpspace IT is a consultancy with a fairly broad focus on the technical side of IT.

Contact

[email protected]

1300 881744

Slides

[Python-Click-talk slides.odp](Python-Click-talk slides.odp)

About

Click, a Cromulent Command-line Parsing Package for Python (presentation)

Resources

Stars

Watchers

Forks

Packages

No packages published