enable easy checkout switch
Author: stas00
Pull request: yes

allow having multiple repository checkouts and not needing to remember to rerun `pip install -e .[dev]` when switching between checkouts and running tests. This code will automatically do the right thing for the test suite.

Note that `python -m pytest` automatically adds `.` to the path, so normally most packages get automatically tested against the local checkout. However, since this project is under a sub-dir `src/` this feature doesn't help.


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5645?src=pr&el=h1) Report
> Merging [#5645](https://codecov.io/gh/huggingface/transformers/pull/5645?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/02a0b43014ac333a169e99d76aaba023a316e384&el=desc) will **increase** coverage by `0.97%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/5645/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/5645?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #5645      +/-   ##
==========================================
+ Coverage   78.17%   79.14%   +0.97%     
==========================================
  Files         145      145              
  Lines       25366    25366              
==========================================
+ Hits        19829    20076     +247     
+ Misses       5537     5290     -247     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5645?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/generation\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5645/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9nZW5lcmF0aW9uX3RmX3V0aWxzLnB5) | `86.46% <0.00%> (+6.51%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_gpt2.py](https://codecov.io/gh/huggingface/transformers/pull/5645/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9ncHQyLnB5) | `95.32% <0.00%> (+31.77%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/5645/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9yb2JlcnRhLnB5) | `93.36% <0.00%> (+49.37%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/5645?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/huggingface/transformers/pull/5645?src=pr&el=footer). Last update [02a0b43...a348729](https://codecov.io/gh/huggingface/transformers/pull/5645?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Not seeing any activity, I'm not sure the purpose of this feature is clear, so I'd try to clarify:

If you just use one repo check out and then just switch git branches then running `pip install -e .[dev]` once is sufficient for an error-free work-flow.

Problems:
- if you also want to have a normal `transformers` installed and used - you can't, you will have to constantly rerun `pip install -e .` , unless you use a different virtual environment - this is very error-prone - forgetting to switch
- you can't have more than one check out - you again have to re-run `pip install -e .` - so easy to forget and waste time figuring out why code modifications have no effect.

Solution:
- let's point python path to `/full/path/to/checktout-dir/src/`and now you will never again need to remember to run `pip install -e .` to run the test suite against. And you can still have "normal" `transformers` installed for normal use.

It doesn't interfere with anybody's current work flow.

I at the very least have two checkouts - one remote master, which I can run tests against any moment, after just `git pull` and then the forked master and its branches, where development is done. I typically have several check outs for different branches in my dev environments since I find it's often simpler to manage then switching branches all the time.

Thank you. 

And I see that `examples` needs the same solution (added).

The other workaround is to run tests with:

```
PYTHONPATH=`pwd`/src:$PYTHONPATH python -m pytest ...
```
but this is far from being easy to be used often.

And finally, removing the intermediary `src` dir and making `transformers` a top-level dir will fix this problem as well for the `python -m pytest` situation, but not in other kinds of invocation.

Could someone with write access rerun this CI check - the failure has nothing to do with my PR.
https://app.circleci.com/pipelines/github/huggingface/transformers/9527/workflows/73306d70-4190-48cd-b24a-b73619cd2002/jobs/64665/steps
Thank you.

---
Thank you to the kind soul who triggered a re-run.