Python generates many files that shouldn't be committed: compiled bytecode (__pycache__, .pyc), virtual environment directories, distribution packages, coverage reports, and IDE-specific settings.
This template uses the official GitHub Python gitignore combined with VirtualEnv rules and common IDE/OS patterns. It works with pip, poetry, pipenv, conda, pytest, mypy, and all major Python workflows.
How to Use
1. Review the pre-selected templates below
2. Add or remove templates to match your project (e.g., add Django, Flask)
3. Click "Copy" or "Download" to get the file
4. Place it in your project's root directory
Frequently Asked Questions
Should I commit my virtual environment?
Never. Virtual environments (venv, .venv, env) can be huge and are machine-specific. Add them to .gitignore and use requirements.txt or pyproject.toml to recreate them.
Should I ignore __pycache__ and .pyc files?
Yes. These are compiled bytecode files generated automatically by Python. They're machine-specific and will be regenerated when Python runs your code.
Should I commit Jupyter notebook checkpoints?
No. The .ipynb_checkpoints directory is auto-generated by Jupyter and should be ignored. The notebooks themselves (.ipynb files) should be committed.