Skip to content

πŸ‘½οΈ Ensure compatibility with Click 8.3.0 by restoring the original value_is_missing function#1333

Merged
tiangolo merged 10 commits intofastapi:masterfrom
svlandeg:fix/ci
Sep 19, 2025
Merged

πŸ‘½οΈ Ensure compatibility with Click 8.3.0 by restoring the original value_is_missing function#1333
tiangolo merged 10 commits intofastapi:masterfrom
svlandeg:fix/ci

Conversation

@svlandeg
Copy link
Member

@svlandeg svlandeg commented Sep 19, 2025

Yesterday's release of Click 8.3.0 has introduced a new internal variable UNSET to differentiate between (truly) unset values and user-provided None values. As a consequence, the method Parameter.value_is_missing in click.core now checks for this UNSET value instead of for None.

This results in bugs when using the current Typer with Click 8.3.0+, because a required, unset parameter would be None in Typer (and not the new UNSET value) and would eventually get the default value instead of throwing an exception.

For instance:

@app.command()
def main(name: str):
    print(f"Hello {name}")

would result in a print "Hello None" when calling it without any arguments.

Potential solutions

  1. A quick fix would be to pin Typer to <8.3.0, but obviously that would only be temporary.
  2. This PR overwrites Click's value_is_missing function to revert it back to its functionality from before 8.3.0. This at least makes the test go green, and allows users to install Click 8.3.0+
  3. Rewrite Typer's core more fundamentally to exploit the new options of the UNSET value. This should also allow us to make different choices with respect to optional flags & flag values, cf πŸ—‘οΈ Deprecate support for is_flag and flag_value parametersΒ #987. Maybe with the new functionality in Click, we can restore some of that again. But it would require careful refactoring if we also want to continue support Click 8.2 and lower.

Proposal

At this point in time (right before the weekend πŸ™ƒ) I suggest to merge this PR (option 2), close #1336 (option 1) and continue working on option 3 in the next few weeks.

@svlandeg svlandeg self-assigned this Sep 19, 2025
@svlandeg svlandeg added the bug Something isn't working label Sep 19, 2025
@svlandeg svlandeg changed the title Fix CI (WIP) πŸ‘½οΈ Fix CI to be compatible with Click 8.3.0 Sep 19, 2025
@svlandeg
Copy link
Member Author

This must be related to pallets/click#3030 and using the "UNSET" value...

@svlandeg svlandeg changed the title πŸ‘½οΈ Fix CI to be compatible with Click 8.3.0 πŸ‘½οΈ Ensure compatibility with Click 8.3.0 Sep 19, 2025
@svlandeg svlandeg changed the title πŸ‘½οΈ Ensure compatibility with Click 8.3.0 πŸ‘½οΈ Ensure compatibility with Click 8.3.0 by restoring the original value_is_missing function Sep 19, 2025
@svlandeg svlandeg marked this pull request as ready for review September 19, 2025 13:14
Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick workaround and all the investigation and explanation, great as always! πŸ™Œ

I'll release this now in Typer 0.18.0 πŸš€

@tiangolo tiangolo merged commit 7a23d25 into fastapi:master Sep 19, 2025
25 checks passed
@svlandeg svlandeg deleted the fix/ci branch September 20, 2025 12:35
@svlandeg svlandeg removed their assignment Oct 7, 2025
castrojo added a commit to castrojo/casestudypilot that referenced this pull request Feb 9, 2026
Fixes TypeError: Parameter.make_metavar() missing required argument 'ctx'

Root Cause:
- typer 0.9.0 (Jan 2024) is incompatible with Click 8.3.0+ (Sep 2025)
- Click 8.3.0 changed Parameter.make_metavar() signature
- GitHub Actions installs latest Click by default
- Result: All CLI commands fail with TypeError

Solution:
- Upgrade to typer>=0.18.0 (includes fix from PR fastapi/typer#1333)
- Minimum version 0.18.0 required for Click 8.3+ compatibility
- Open-ended range allows future updates

Impact:
- Unblocks GitHub Copilot agent CLI operations
- Fixes copilot-setup-steps workflow validation
- Enables full 12-step case study generation workflow
- Zero breaking changes for our usage patterns

Testing:
- βœ… Local: python -m casestudypilot --help works
- βœ… All subcommands accessible (youtube-data, verify-company, assemble, extract-screenshots, validate)
- βœ… Test suite: 15/16 tests pass (1 pre-existing test issue with metric detection strictness)

References:
- Typer 0.18.0 release: https://github.com/fastapi/typer/releases/tag/0.18.0
- Click 8.3.0 breaking change: pallets/click#3030
- Typer compatibility fix: fastapi/typer#1333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants