Parses arguments, returns ``(options, args)``.

    .. versionchanged:: 0.24.1
        Fix handling of optional :data:`args`.

def parse_args(args=None):
    '''
    Parses arguments, returns ``(options, args)``.

    .. versionchanged:: 0.24.1
        Fix handling of optional :data:`args`.
    '''
    if args is None:
        args = sys.argv[1:]

    parser = argparse.ArgumentParser(description='MicroDrop plugin '
                                     'Conda recipe builder')
    parser.add_argument('-s', '--source-dir', type=ph.path, nargs='?')
    parser.add_argument('-t', '--target-dir', type=ph.path, nargs='?')
    parser.add_argument('-p', '--package-name', nargs='?')
    # Use `-V` for version (from [common Unix flags][1]).
    #
    # [1]: https://unix.stackexchange.com/a/108141/187716
    parser.add_argument('-V', '--version-number', nargs='?')

    parsed_args = parser.parse_args()
    if not parsed_args.source_dir:
        parsed_args.source_dir = ph.path(os.environ['SRC_DIR'])
    if not parsed_args.target_dir:
        prefix_dir = ph.path(os.environ['PREFIX'])
        # Extract module name from Conda package name.
        #
        # For example, the module name for a package named
        # `microdrop.droplet_planning_plugin` would be
        # `droplet_planning_plugin`.
        module_name = os.environ['PKG_NAME'].split('.')[-1].replace('-', '_')
        parsed_args.target_dir = prefix_dir.joinpath('share', 'microdrop',
                                                     'plugins', 'available',
                                                     module_name)
    if not parsed_args.package_name:
        parsed_args.package_name = os.environ['PKG_NAME']

    return parsed_args