Parsing the configuration file

Parsing the configuration file requires three distinct parts, as shown previously in the reactivity diagram for the application:

  • Parsing the command-line arguments
  • Reading the configuration file
  • Parsing the configuration file and converting it to a Python object

Command-line arguments are retrieved with the argv driver of the cyclotron-std package, as already seen with the cyclotron echo example. The application accepts only one argument, named config. The Python standard library contains a module dedicated to the parsing of arguments: argparse. Moreover, the cyclotron-std package contains a helper to use the argparse module with an observable of arguments as an input. So, all these elements can be used as ...

Get Hands-On Reactive Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.