Skip to content

📝 Add a note that Python 3.13+ venv creates .gitignore by default#15592

Open
ftnext wants to merge 4 commits into
fastapi:masterfrom
ftnext:docs-python313-venv-gitignore
Open

📝 Add a note that Python 3.13+ venv creates .gitignore by default#15592
ftnext wants to merge 4 commits into
fastapi:masterfrom
ftnext:docs-python313-venv-gitignore

Conversation

@ftnext
Copy link
Copy Markdown
Contributor

@ftnext ftnext commented May 24, 2026

Pull Request

Discussion:

I couldn't find a suitable Discussion category for this small docs-only clarification 🙏

Description

Add a tip to the virtual environments docs noting that Python 3.13+ creates .venv/.gitignore automatically when using venv.

Python 3.13's venv module creates SCM ignore files by default, including Git ignore files, so the manual .gitignore step is only needed for Python 3.12 and below.

This matches the existing uv tip, as uv also creates .venv/.gitignore when creating the virtual environment.

Reference: https://docs.python.org/3/whatsnew/3.13.html#venv

Context: noticed while checking virtual-environments.md after #15463 in 0.163.2.

Checklist

  • This PR is an obvious typo fix, or it links to a GitHub Discussion for the proposed code change.
  • I added tests for the change.
  • The new or updated tests fail on the main branch and pass on this PR.
  • Coverage stays at 100%.
  • The documentation explains the change if needed.

Python 3.13's venv module creates SCM ignore files by default, including Git ignore files, so the manual .gitignore step is only needed for Python 3.12 and below.

This matches the existing uv tip, as uv also creates .venv/.gitignore when creating the virtual environment.

Reference: https://docs.python.org/3/whatsnew/3.13.html#venv

Context: noticed while checking virtual-environments.md after fastapi#15463 in 0.163.2.
@github-actions github-actions Bot added the docs Documentation about how to use FastAPI label May 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

Comment thread docs/en/docs/virtual-environments.md Outdated
@YuriiMotov YuriiMotov changed the title docs-only factual correction: Mention Python 3.13 venv gitignore behavior 📝 Add a note that Python 3.13+ venv creates .gitignore by behavior May 25, 2026
@YuriiMotov YuriiMotov changed the title 📝 Add a note that Python 3.13+ venv creates .gitignore by behavior 📝 Add a note that Python 3.13+ venv creates .gitignore by default May 25, 2026
Copy link
Copy Markdown
Member

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation about how to use FastAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants