Debian Codegraph @

docs/contributing.rst

raw
1 Contributing
2 ============
3
4 Contributions to :mod:`petl` are welcome in any form, please feel free
5 to email the [email protected] mailing list if you have some
6 code or ideas you'd like to discuss.
7
8 Please note that the :mod:`petl` package is intended as a stable,
9 general purpose library for ETL work. If you would like to extend
10 :mod:`petl` with functionality that is domain-specific, or if you have
11 an experimental or tentative feature that is not yet ready for
12 inclusion in the core :mod:`petl` package but you would like to
13 distribute it, please contribute to the `petlx
14 <http://petlx.readthedocs.org>`_ project instead, or distribute your
15 code as a separate package.
16
17 If you are thinking of developing or modifying the :mod:`petl` code base in
18 any way, here is some information on how to set up your development
19 environment to run tests etc.
20
21 Running the test suite
22 ----------------------
23
24 The main :mod:`petl` test suite can be run with `nose
25 <https://nose.readthedocs.org/>`_. E.g., assuming you have the source code
26 repository cloned to the current working directory, you can run the test
27 suite with::
28
29 $ pip install -r requirements-tests.txt
30 $ pytest -v petl
31
32 Currently :mod:`petl` supports Python 2.7, 3.6 up to 3.13
33 so the tests should pass under all these Python versions.
34
35 Dependencies
36 ------------
37
38 To keep installation as simple as possible on different platforms,
39 :mod:`petl` has no installation dependencies. Most functionality also
40 depends only on the Python core libraries.
41
42 Some :mod:`petl` functions depend on third party packages, however
43 these should be kept as optional requirements. Any tests for modules
44 requiring third party packages should be written so that they are
45 skipped if the packages are not available. See the existing tests for
46 examples of how to do this.
47
48
49 Running database tests
50 ----------------------
51
52 There are some additional tests within the test suite that require
53 database servers to be setup correctly on the local host. To run these
54 additional tests, make sure you have both MySQL and PostgreSQL servers
55 running locally, and have created a user "petl" with password "test"
56 and all permissions granted on a database called "petl". Install
57 dependencies::
58
59 $ pip install pymysql psycopg2 sqlalchemy
60
61 If these dependencies are not installed, or if a local database server
62 is not found, these tests are skipped.
63
64 Running doctests
65 ----------------
66
67 Doctests in docstrings should (almost) all be runnable, and should
68 pass if run with Python 3.6. Doctests can be run with `nose
69 <https://nose.readthedocs.org/>`_. See the tox.ini file for example
70 doctest commands.
71
72 Building the documentation
73 --------------------------
74
75 Documentation is built with `sphinx <http://sphinx-doc.org/>`_. To build::
76
77 $ pip install -r requirements-docs.txt
78 $ cd docs
79 $ make html
80
81 Built docs can then be found in the ``docs/_build/html/`` directory.
82
83 Automatically running all tests
84 -------------------------------
85
86 All of the above tests can be run automatically using `tox
87 <https://tox.readthedocs.org/>`_. You will need binaries for Python
88 2.7 and 3.6 available on your system.
89
90 To run all tests **without** installing any of the optional
91 dependencies, do::
92
93 $ tox -e py27,py36,docs
94
95 To run the entire test suite, including installation of **all**
96 optional dependencies, do::
97
98 $ tox
99
100 The first time you run this it will take some while all the optional
101 dependencies are installed in each environment.
102
103 Contributing code via GitHub
104 ----------------------------
105
106 The best way to contribute code is via a GitHub pull request.
107
108 Please include unit tests with any code contributed.
109
110 If you are able, please run tox and ensure that all the above tests pass
111 before making a pull request.
112
113 Thanks!
114
115 Guidelines for core developers
116 ------------------------------
117
118 Before merging a pull request that includes new or modified code, all
119 items in the `PR checklist <https://github.com/petl-developers/petl/blob/master/.github/PULL_REQUEST_TEMPLATE.md>`_
120 should be complete.
121
122 Pull requests containing new and/or modified code that is anything
123 other than a trivial bug fix should be approved by at least one core
124 developer before being merged. If a core developer is making a PR
125 themselves, it is OK to merge their own PR if they first allow some
126 reasonable time (e.g., at least one working day) for other core devs
127 to raise any objections, e.g., by posting a comment like "merging soon
128 if no objections" on the PR. If the PR contains substantial new
129 features or modifications, the PR author might want to allow a little
130 more time to ensure other core devs have an opportunity to see it.