Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Pyrefly Type Challenge — PyCon US 2026

    _____                  __ _
   |  __ \                / _| |
   | |__) |   _ _ __ ___ | |_| |_   _
   |  ___/ | | | '__/ _ \|  _| | | | |
   | |   | |_| | | |  __/| | | | |_| |
   |_|    \__, |_|  \___||_| |_|\__, |
           __/ |                 __/ |
          |___/                 |___/

   ~~~ PyCon US 2026 Type Challenge ~~~
      May 13–19, 2026 · Long Beach, CA

Hello and welcome to the Pyrefly Type Challenge! Fix type bugs, configure Pyrefly, and write some type-safe code. Complete all three parts and show your work to Meta booth staff for a swag reward!


What You'll Do:

Part Task
1 Install & configure Pyrefly
2 Fix every type error in challenge.py
3 Write 20–50 lines of your own type-safe code

Part 1: Setup

# 1. Clone the repo
git clone https://github.com/migeed-z/pyrefly-type-challenge.git
cd pyrefly-type-challenge

# 2. Install pyrefly (use any Python environment you prefer)
pip install pyrefly

# 3. Try running pyrefly on the challenge file
pyrefly check challenge.py

Now create a pyrefly.toml configuration file. Some bugs in challenge.py only show up when you enable error checks that Pyrefly doesn't turn on by default. Check the pyrefly docs to learn more.


Part 2: Fix the Type Bugs

Open challenge.py and fix every type error. The file has a mix of bugs:

  • Some that Pyrefly catches by default
  • Others that only appear once your pyrefly.toml is configured correctly

Some fixes only need annotation changes, others require fixing the code itself — you can either rewrite the code or use error suppressions.

The rules:

  • No Any — remove all uses of it
  • pyrefly check challenge.py must pass with zero errors
  • Don't delete functions — fix them!

Hint: there are 3 error kinds disabled by default that enable stricter checking for return types, parameter types, and decorators. And remember the "no Any" rule — there's a config setting for that too. Check the [errors] section in the configuration docs to find them.


Part 3: Write Your Own Code

At the bottom of challenge.py there's a stub function called score_quests(). Fill it in with 20–50 lines of type-safe code. No Any allowed!

Read the docstring for what to implement, then get creative with the scoring logic!


Claim Your Swag

Once you're done, show your work to Meta booth staff to claim a reward (while supplies last). They'll want to see:

  1. Your pyrefly.toml setup
  2. A clean pyrefly check challenge.py with zero errors
  3. A quick walk-through of your score_quests() solution

Side Quest: Teach Your AI Agent

Want your AI coding assistant to use Pyrefly automatically? Set up a rules file so your agent type-checks with Pyrefly out of the box.

Claude Code — add a CLAUDE.md file
# Type Checking

Use pyrefly for type checking Python files:
- Run `pyrefly check <file>` to check for type errors
- Fix all type errors before committing
- Never use `Any` — use proper type annotations
GitHub Copilot — add .github/copilot-instructions.md
Use pyrefly for Python type checking. Run `pyrefly check` on all Python files
before suggesting changes. Ensure code is fully annotated with no use of Any.
Cursor — add a .cursor/rules file
Use pyrefly for Python type checking. Run `pyrefly check` on all Python files.
Ensure code is fully annotated with no use of Any.

This is optional — but it's a great habit to start!


What is Pyrefly?

Pyrefly is a fast type checker and language server for Python, built in Rust. It's designed to be lightning-fast, easy to configure, and a joy to use.


Happy typing!

~ The Pyrefly Team at Meta ~

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages