Contributing
============

.. image:: _static/vcr.svg
   :alt: vcr.py logo
   :align: right

🎁 Contributing Issues and PRs
-------------------------------

 - Issues and PRs will get triaged.
 - PRs get priority over issues.
 - The maintainers have limited bandwidth and do so **voluntarily**.

So whilst reporting issues are valuable, please consider:
 - contributing an issue with a toy repo that replicates the issue.
 - contributing PRs is a more valuable donation of your time and effort.

Thanks again for your interest and support in VCRpy.

We really appreciate it.

----

👥 Collaborators
-----------------

We also have a large test matrix to cover and would like members to volunteer covering these roles.

============ ==================== ================= ================== ======================
**Library**  **Issue Triager(s)** **Maintainer(s)** **PR Reviewer(s)** **Release Manager(s)**
------------ -------------------- ----------------- ------------------ ----------------------
``core``     Needs support        Needs support     Needs support      @neozenith
``requests`` @neozenith           Needs support     @neozenith         @neozenith
``aiohttp``  Needs support        Needs support     Needs support      @neozenith
``urllib3``  Needs support        Needs support     Needs support      @neozenith
``httplib2`` Needs support        Needs support     Needs support      @neozenith
``tornado4`` Needs support        Needs support     Needs support      @neozenith
``boto3``    Needs support        Needs support     Needs support      @neozenith
============ ==================== ================= ================== ======================

Role Descriptions
~~~~~~~~~~~~~~~~~

**Issue Triager:**

Simply adding these three labels for incoming issues means a lot for maintaining this project:
 -  ``bug`` or ``enhancement``
 - Which library does it affect? ``core``, ``aiohttp``, ``requests``, ``urllib3``, ``tornado4``, ``httplib2``
 - If it is a bug, is it ``Verified Can Replicate`` or ``Requires Help Replicating``
 - Thanking people for raising issues. Feedback is always appreciated.
 - Politely asking if they are able to link to an example repo that replicates the issue if they haven't already. Being able to *clone and go* helps the next person and we like that. 😃

**Maintainer:**

This involves creating PRs to address bugs and enhancement requests. It also means maintaining the test suite, docstrings and documentation .

**PR Reviewer:**

The PR reviewer is a second set of eyes to see if:
 - Are there tests covering the code paths added/modified?
 - Do the tests and modifications make sense seem appropriate?
 - Add specific feedback, even on approvals, why it is accepted. eg "I like how you use a context manager there. 😄 "
 - Also make sure they add a line to `docs/changelog.rst` to claim credit for their contribution.

**Release Manager:**
 - Ensure CI is passing.
 - Create a release on github and tag it with the changelog release notes.
 - ``python3 setup.py build sdist bdist_wheel``
 - ``twine upload dist/*``
 - Go to ReadTheDocs build page and trigger a build https://readthedocs.org/projects/vcrpy/builds/

----

Running VCR's test suite
------------------------

The tests are all run automatically on `Github Actions CI <https://github.com/kevin1024/vcrpy/actions>`__,
but you can also run them yourself using `pytest <http://pytest.org/>`__.

In order for the boto3 tests to run, you will need an AWS key.
Refer to the `boto3
documentation <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/index.html>`__
for how to set this up. I have marked the boto3 tests as optional in
Travis so you don't have to worry about them failing if you submit a
pull request.

Using Pyenv with VCR's test suite
---------------------------------

Pyenv is a tool for managing multiple installation of python on your system.
See the full documentation at their `github <https://github.com/pyenv/pyenv>`_
in this example::

    git clone https://github.com/pyenv/pyenv ~/.pyenv

    # Add ~/.pyenv/bin to your PATH
    export PATH="$PATH:~/.pyenv/bin"

    # Setup shim paths
    eval "$(pyenv init -)"

    # Install supported versions (at time of writing), this does not activate them
    pyenv install 3.12.0 pypy3.10

    # This activates them
    pyenv local 3.12.0 pypy3.10

    # Run the whole test suite
    pip install .[tests]
    ./runtests.sh


Troubleshooting on MacOSX
-------------------------

If you have this kind of error when running tests :

.. code:: python

    __main__.ConfigurationError: Curl is configured to use SSL, but we have
    not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.

Then you need to define some environment variables:

.. code:: bash

    export PYCURL_SSL_LIBRARY=openssl
    export LDFLAGS=-L/usr/local/opt/openssl/lib
    export CPPFLAGS=-I/usr/local/opt/openssl/include

Reference : `stackoverflow issue <https://stackoverflow.com/questions/51019622/curl-is-configured-to-use-ssl-but-we-have-not-been-able-to-determine-which-ssl>`__
