def list_modules(curdir, pattern):
    """List names from files (*.py) in ``curdir`` match ``pattern``.
    """
    return sorted(
        m.name.replace('.py', '')
        for m in curdir.glob('*.py') if pattern.match(m.name)
    )