Skip to content

✨ Allow setting an environment variable to None in CliRunner.invoke#1303

Merged
tiangolo merged 1 commit intofastapi:masterfrom
arjenzorgdoc:patch-1
Sep 20, 2025
Merged

✨ Allow setting an environment variable to None in CliRunner.invoke#1303
tiangolo merged 1 commit intofastapi:masterfrom
arjenzorgdoc:patch-1

Conversation

@arjenzorgdoc
Copy link
Copy Markdown
Contributor

The type of the Click env parameter is Mapping[str, str | None] | None. This can be used to "delete" an environment variable.

The type of the Click env parameter is Mapping[str, str | None] | None. This can be used to "delete" an environment variable.
@svlandeg svlandeg added the feature New feature, enhancement or request label Sep 15, 2025
@svlandeg svlandeg changed the title CliRunner: Fix typing of env parameter ✨ Allow setting an environment variable to None in CliRunner.invoke Sep 15, 2025
Copy link
Copy Markdown
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

Looks good to me, Click also takes a Mapping[str, str | None] | None for this env variable.

Thanks for the PR, @arjenzorgdoc!

@tiangolo
Copy link
Copy Markdown
Member

Great, thanks! 🚀

@tiangolo tiangolo merged commit a6266e6 into fastapi:master Sep 20, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants