Hey there! Welcome to the Python Project Template repository. This repository is designed to help you kickstart your Python projects with best practices and a clean, efficient codebase. This README will guide you through the essentials of our .gitignore
file—because nobody likes clutter in their codebase, right? Let's keep things tidy!
Ever wonder what happens to all those unnecessary files your project generates? Fear not! Our trusty .gitignore
file is here to save the day. It's like the ultimate bouncer, keeping out all the riff-raff and ensuring only the essential files are tracked in the repository.
Here's the content of our .gitignore
file, designed to keep your Python projects clean and efficient:
*~
.DS_Store
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# .python-version
# pipenv
#Pipfile.lock
# poetry
#poetry.lock
# pdm
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
.idea/
-
Add entries to your
.gitignore_global
file: Open~/.gitignore_global
in your favorite text editor and add the entries you want to ignore globally. -
Verify your global ignore settings:
git config --global core.excludesfile
By including these ignore rules, you help maintain a clean and efficient working environment across all your projects by preventing unwanted files from being tracked by Git. This standard practice ensures that only the necessary code and assets are included in version control, which is particularly crucial for collaborative projects.
For more information about .gitignore
patterns and usage, refer to the Git documentation.
If you're using Visual Studio Code (VSCode) for your development, it offers built-in support for .gitignore
files and various extensions to enhance your experience. Here's how you can pair this .gitignore
with the VSCode setup:
-
Add the .gitignore file to your repository root: Place the
.gitignore
file at the root of your repository. -
Commit the .gitignore file:
git add .gitignore git commit -m "Add .gitignore file to keep things neat and tidy" git push origin main
-
Install recommended extensions:
- GitLens: Supercharges the built-in Git capabilities.
- Python: Official Python extension by Microsoft for code linting, IntelliSense, Jupyter Notebooks, and more.
-
Configure your settings: Open your VSCode settings (
.vscode/settings.json
) and add the following to enhance your Python development experience:{ "python.pythonPath": "path/to/your/python", "python.linting.enabled": true, "python.linting.pylintEnabled": true, "python.linting.flake8Enabled": true, "python.linting.mypyEnabled": true, "python.formatting.autopep8Path": "path/to/autopep8", "python.formatting.blackPath": "path/to/black", "python.formatting.yapfPath": "path/to/yapf", "python.formatting.provider": "autopep8" }
By following these steps, you'll have a well-configured .gitignore
file and a powerful VSCode setup for your Python projects.
For more information about .gitignore
patterns and usage, refer to the Git documentation.
Thanks for stopping by! Now go forth and code with a clean conscience, knowing your repository is in tip-top shape. Happy coding! 🚀