Add shebangs to pyx/pxd/pyx.in files
State: closed

This enables automatic syntax highlighting in SublimeText (and presumably other editors).  This is effectively 100% cosmetic.

`msgpack` had shebangs `# coding: utf-8` which is changed to `# -*- coding: utf-8 -*-`.  If there is a reason to use the former, let me know and I'll amend the PR. 

Related: #15131, #15134

 - [ ] closes #xxxx
 - [ ] tests added / passed
 - [X] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff`` (On Windows, ``git diff upstream/master -u -- "*.py" | flake8 --diff`` might work as an alternative.)
 - [ ] whatsnew entry


Labels:
name: Build
description: Library building on various platforms
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=h1) Report
> Merging [#16876](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f4b12d8488434d5f9a45fba1cbe7ad5a77c776ff?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16876/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16876      +/-   ##
==========================================
- Coverage   90.99%   90.97%   -0.02%     
==========================================
  Files         161      161              
  Lines       49301    49301              
==========================================
- Hits        44859    44852       -7     
- Misses       4442     4449       +7
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.74% <ø> (ø)` | :arrow_up: |
| #single | `40.17% <ø> (-0.23%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-41.67%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=footer). Last update [f4b12d8...f03dd51](https://codecov.io/gh/pandas-dev/pandas/pull/16876?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

in #15134 we removed these all from the test files. Now adding back to the cython ones. So is the issue that some file editors don't automatically recognize python/cython extensions? and this helps?
> So is the issue that some file editors don't automatically recognize python/cython extensions? and this helps?

Yes and yes.

Regarding PR #15164. The original issue #15131 that PR was fixing should be OK with "/usr/bin/env python" as the case is in this PR, as long as we do not have hardcoded paths. See the original discussion in #15131 for more info.

@ssalonen Thanks.  I referenced the earlier issues by searching for "shebang", so the relation is pretty minor.
do the package managers resolve .py correctly? 
SublimeText is my day-to-day.  Just checked Atom and Textmate.  They all get syntax highlighting right with the ".py" extension and default to plain-text on ".pyx" etc.  With the `#!/usr/bin/env python` present they all make the inference.
@TomAugspurger thoughts on this
I thought that shebangs were purely for describing which programs should execute a file, but Wikipedia wasn't super clear about that. If that's correct then I'm -1. If I'm wrong, and shebangs serve more than one purpose, then this seems fine. Every editor I've used has has had a config setting for associating extensions with plugins / modes though.
> I thought that shebangs were purely for describing which programs should execute a file

That's roughly my understanding.  More generally, they are (in practice at least) used as a fallback to identify file types when it can't be figured out via the extension.

I've filed an issue with SublimeText on this one, am happy to let this go.
> I've filed an issue with SublimeText on this one, am happy to let this go.

yeah I think this is up to the editor. I understand that this should just work, but adding shebangs is not a good general soln.