CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-questionary

Python library to build pretty command line user prompts with interactive forms and validation

Overall
score

96%

Overview
Eval results
Files

task.mdevals/scenario-4/

User Registration CLI Tool

A command-line tool that collects user registration information with proper input validation and helpful error messages.

Overview

Create an interactive CLI tool that prompts users for registration details including username, email, and password. The tool must validate each input and provide clear, helpful error messages when validation fails.

Capabilities

Username validation

  • Collects username with validation that it must be at least 3 characters long and contain only alphanumeric characters and underscores. @test
  • Rejects usernames shorter than 3 characters with a clear error message. @test
  • Rejects usernames containing invalid characters with a descriptive error message. @test

Email validation

  • Collects email address with validation that it must be a properly formatted email address. @test
  • Rejects emails missing the @ symbol with an appropriate error message. @test
  • Rejects emails without a domain extension with a helpful error message. @test

Password validation

  • Collects password with validation that it must be at least 8 characters and contain at least one uppercase letter, one lowercase letter, and one digit. @test
  • Rejects passwords shorter than 8 characters with a specific error message. @test
  • Rejects passwords missing required character types with a detailed error message explaining what's missing. @test

Registration completion

  • Successfully completes registration when all inputs are valid and returns a dictionary with username, email, and password. @test

Implementation

@generates

The tool should implement a collect_registration() function that prompts for each field in sequence and returns the collected data.

API

def collect_registration():
    """
    Collect user registration information through interactive prompts.

    Prompts the user for:
    - Username (alphanumeric + underscores, min 3 chars)
    - Email (valid email format)
    - Password (min 8 chars, with uppercase, lowercase, and digit)

    Each field has custom validation with helpful error messages.

    Returns:
        dict: A dictionary containing 'username', 'email', and 'password' keys
              with the validated user input values.
    """
    pass

Dependencies { .dependencies }

questionary { .dependency }

Provides interactive command-line prompts with validation support.

Install with Tessl CLI

npx tessl i tessl/pypi-questionary

tile.json