or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/questionary@2.1.x
tile.json

tessl/pypi-questionary

tessl install tessl/pypi-questionary@2.1.0

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

Agent Success

Agent success rate when using this tile

96%

Improvement

Agent success rate improvement when using this tile compared to baseline

1x

Baseline

Agent success rate without this tile

96%

task.mdevals/scenario-2/

Developer Registration Wizard

A command-line user registration wizard that collects developer information through an interactive multi-question form.

Requirements

Build a registration wizard that collects the following information from a developer:

  1. Username: A text input that must be at least 3 characters long
  2. Programming Language: Select from a list of options (Python, JavaScript, Go, Rust, Other)
  3. Years of Experience: Text input that must be a valid number between 0 and 50
  4. Team Lead: Confirmation (yes/no) asking if they are a team lead
  5. Team Size: Only shown if they answered "yes" to being a team lead. Must be a number between 1 and 100.
  6. Newsletter: Confirmation (yes/no) asking if they want to subscribe to a newsletter

The wizard should:

  • Execute all questions in sequence
  • Return all collected answers as a dictionary
  • Skip the "Team Size" question if the user is not a team lead
  • Validate inputs according to the constraints listed above
  • Display appropriate error messages for invalid inputs

Test Cases

  • When a user provides valid inputs for all fields (non-team-lead), the wizard returns a dictionary with username, programming_language, years_of_experience, team_lead, and newsletter fields @test
  • When a user indicates they are a team lead, the wizard asks for team size and includes it in the returned dictionary @test
  • When a username shorter than 3 characters is provided, validation fails with an appropriate error @test
  • When an invalid years of experience value (e.g., negative number or over 50) is provided, validation fails @test

Implementation

@generates

API

def run_registration_wizard():
    """
    Runs an interactive registration wizard that collects developer information.

    Returns:
        dict: A dictionary containing the collected answers with keys:
            - 'username': str
            - 'programming_language': str
            - 'years_of_experience': str
            - 'team_lead': bool
            - 'team_size': str (only if team_lead is True)
            - 'newsletter': bool
    """
    pass

Dependencies { .dependencies }

questionary { .dependency }

Provides interactive command-line prompts and form functionality.