|
| 1 | +Guidelines for Contributing |
| 2 | +=========================== |
| 3 | + |
| 4 | +PyPika welcomes contributions in all forms. These may be bugs, feature requests, documentation, or examples. Please feel free to: |
| 5 | + |
| 6 | +#. Submitting an issue |
| 7 | +#. Opening a pull request |
| 8 | +#. Helping with outstanding issues and pull requests |
| 9 | + |
| 10 | +Open an issue |
| 11 | +------------- |
| 12 | + |
| 13 | +If you find a bug or have a feature request, please `open an issue <https://github.com/kayak/pypika/issues>`_ on GitHub. Please just check that the issue doesn't already exist before opening a new one. |
| 14 | + |
| 15 | +Local development steps |
| 16 | +----------------------- |
| 17 | + |
| 18 | +Create a forked branch of the repo |
| 19 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 20 | + |
| 21 | +Do this once but keep it up to date |
| 22 | + |
| 23 | +#. `Fork the kayak/PyPika repo GitHub <https://github.com/kayak/pypika/fork>`_ |
| 24 | +#. Clone forked repo and set upstream |
| 25 | + |
| 26 | + .. code-block:: bash |
| 27 | +
|
| 28 | + git clone [email protected]:<your-username>/pypika.git |
| 29 | + cd pypika |
| 30 | + git remote add upstream [email protected]:kayak/pypika.git |
| 31 | +
|
| 32 | +Setup local development environment |
| 33 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 34 | + |
| 35 | +#. Setup up python virtual environment |
| 36 | + |
| 37 | + Create and activate the environment. Here is an example using ``venv`` from the standard library: |
| 38 | + |
| 39 | + .. code-block:: bash |
| 40 | +
|
| 41 | + python -m venv .venv |
| 42 | + source .venv/bin/activate |
| 43 | +
|
| 44 | +#. Install python dependencies for development |
| 45 | + |
| 46 | + With the virtual environment activated, install the development requirements, pre-commit, and the package itself: |
| 47 | + |
| 48 | + .. code-block:: bash |
| 49 | +
|
| 50 | + make install |
| 51 | +
|
| 52 | +#. Run the tests |
| 53 | + |
| 54 | + The unit tests are run with ``unittest`` via ``tox``. To run the tests locally: |
| 55 | + |
| 56 | + .. code-block:: bash |
| 57 | +
|
| 58 | + make test |
| 59 | +
|
| 60 | + These tests will also run on GitHub Actions when you open a pull request. |
| 61 | + |
| 62 | +#. Build the docs locally |
| 63 | + |
| 64 | + Our docs are built with Sphinx. To build the docs locally: |
| 65 | + |
| 66 | + .. code-block:: bash |
| 67 | +
|
| 68 | + make docs.build |
| 69 | +
|
| 70 | + Open the docs in your browser. For instance, on macOS: |
| 71 | + |
| 72 | + .. code-block:: bash |
| 73 | +
|
| 74 | + open docs/_build/index.html |
| 75 | +
|
| 76 | +Pull Request checklist |
| 77 | +---------------------- |
| 78 | + |
| 79 | +Please check that your pull request meets the following criteria: |
| 80 | + |
| 81 | +- Unit tests pass |
| 82 | +- pre-commit hooks pass |
| 83 | +- Docstring and examples and checking for correct render in the docs |
| 84 | + |
| 85 | +Documentation |
| 86 | +------------- |
| 87 | + |
| 88 | +Documentation is built with Sphinx and hosted on `Read the Docs <https://pypika.readthedocs.io/en/latest/>`_. The latest builds are displayed on their site `here <https://readthedocs.org/projects/pypika/builds/>`_. |
| 89 | + |
| 90 | +The code documentation is to be written in the docstrings of the code itself or in the various ``.rst`` files in project root or the ``docs/`` directory. |
| 91 | + |
| 92 | +The docstrings can be in either `Numpy <https://numpydoc.readthedocs.io/en/latest/format.html>`_ or `Sphinx <https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html>`_ format. |
| 93 | + |
| 94 | +Automations |
| 95 | +----------- |
| 96 | + |
| 97 | +We use `pre-commit <https://pre-commit.com/>`_ to automate format checks. Install the pre-commit hooks with the ``make install`` command described above. |
| 98 | + |
| 99 | +GitHub Actions runs both format checks and unit tests on every pull request. |
| 100 | + |
| 101 | +**NOTE:** The hosted documentation is built separately from the GitHub Actions workflow. To build the docs locally, use the ``make docs.build`` command described above. |
0 commit comments