.gitattributes 语言学家语言声明

.gitattributes linguist-language declaration

我目前正在开发一个 python 包,整个源代码都在我的 git 仓库中。我已经看到 github 没有正确跟踪 repo 统计信息中的 cython 文件。所以我刚刚创建了一个 .gitattributes 文件,我在其中找到了文档 here。最后我的文件看起来像这样:

# Specify Python source files. 
*.py linguist-language=python
*.pyi linguist-language=python

# Highlight Cython source files as C language, since it's hopefully better
# than nothing. This also affects repo statistics.
*.pyx linguist-language=C
*.pxd linguist-language=C

# Specify python binary files.
*.db binary
...

# Jupyter notebook
*.ipynb text

# Highlight C and C++ source files.
*.c linguist-language=c
*.cc linguist-language=cpp
*.cxx linguist-language=cpp
...

# Compiled Object files
*.slo binary
...

# Compiled Dynamic libraries
*.so binary
...

声明所有这些扩展是一种常见的做法吗?
*.pyx linguist-language=C 是否可以在不让最近的 python 开发人员心脏病发作的情况下完成?

请注意,Cython 应该被 linguist 识别,该库在 GitHub.com 上用于检测 blob 语言。

Cython:
  type: programming
  group: Python
  extensions:
  - ".pyx"
  - ".pxd"
  - ".pxi"

Calamitizer/rainbow-of-code does illustrate that, and do use a .gitattributes with这样的项目:

*.pyx linguist-language=Cython