Skip to content

Commit 627b60a

Browse files
authored
Contributing guidelines (#758)
* add another common location * code block but also ticks * add command to build docs * switch to rst format * link to new file * update the contributing section * add some more text in the steps * add missing modules to docs * pin jinja2 and add support for numpydoc style * reference numpydoc
1 parent ded17eb commit 627b60a

14 files changed

+207
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ target/
7070
# virtualenv
7171
venv/
7272
ENV/
73+
.venv/
7374

7475
# OS X
7576
.DS_Store

CONTRIBUTING.rst

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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.

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# You can set these variables from the command line.
2+
SPHINXBUILD = sphinx-build
3+
SOURCEDIR = docs
4+
BUILDDIR = docs/_build
5+
6+
7+
help: ## Show this help.
8+
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
9+
10+
install: ## Install development dependencies
11+
pip install -r requirements-dev.txt pre-commit -e .
12+
pre-commit install
13+
14+
test: ## Run tests
15+
tox
16+
17+
docs.build: ## Build the documentation
18+
$(SPHINXBUILD) $(SOURCEDIR) $(BUILDDIR) -b html -E
19+
@echo
20+
@echo "Build finished. The HTML pages are in $(BUILDDIR)."
21+
22+
docs.clean: ## Remove the generated documentation
23+
rm -rf $(BUILDDIR)

README.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,17 @@ This produces:
13701370
13711371
.. _tutorial_end:
13721372

1373+
.. _contributing_start:
13731374

1374-
.. _license_start:
1375+
Contributing
1376+
------------
1377+
1378+
We welcome community contributions to |Brand|. Please see the `contributing guide <6_contributing.html>`_ to more info.
13751379

1380+
.. _contributing_end:
1381+
1382+
1383+
.. _license_start:
13761384

13771385
License
13781386
-------

docs/6_contributing.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../CONTRIBUTING.rst

docs/api/pypika.analytics.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pypika.analytics module
2+
=======================
3+
4+
.. automodule:: pypika.analytics
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/api/pypika.dialects.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pypika.dialects module
2+
======================
3+
4+
.. automodule:: pypika.dialects
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/api/pypika.pseudocolumns.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pypika.pseudocolumns module
2+
===========================
3+
4+
.. automodule:: pypika.pseudocolumns
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/api/pypika.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ pypika package
33

44
.. toctree::
55

6-
6+
pypika.analytics
7+
pypika.dialects
78
pypika.enums
89
pypika.functions
10+
pypika.pseudocolumns
911
pypika.queries
1012
pypika.terms
1113
pypika.utils

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
'sphinx.ext.coverage',
4040
'sphinx.ext.imgmath',
4141
'sphinx.ext.viewcode',
42+
'numpydoc',
4243
]
4344

4445
# Add any paths that contain templates here, relative to this directory.

0 commit comments

Comments
 (0)