我正在尝试收集一些我的默认设置,有一件事我意识到我没有标准的.gitignore文件。有一个很好的线程显示good .gitignore for Visual Studio projects,但我没有看到很多关于Python和相关工具的建议(PyGTK,Django)。
到目前为止,我有......
*.pyc
*.pyo
...对于编译对象和......
build/
dist/
...用于setuptools输出。
.gitignore文件的最佳实践是什么?我可以在哪里获得有关这些最佳实践的更多信息?
当使用buildout时,我跟随.gitignore
(以及*.pyo
和*.pyc
):
.installed.cfg
bin
develop-eggs
dist
downloads
eggs
parts
src/*.egg-info
lib
lib64
此外,我倾向于将.svn
放入,因为我们使用了几个SCM-s。
Github has a great boilerplate .gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Django stuff:
*.log
*.pot
# Sphinx documentation
docs/_build/
local_settings.py,为django项目。
*〜适用于所有项目。
一个问题是,如果您还想使用git来实现项目的开发。如果是这样,您可能希望从存储库中排除本地sqlite文件,同样可能适用于文件上载(主要在您的媒体文件夹中)。 (我现在在谈论django,因为你的问题也用django标记)
以下是setuptools可能遗留的一些其他文件:
MANIFEST
*.egg-info
涵盖了大多数一般的东西 -
# 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/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# 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/