|
1 | 1 | Contributing |
2 | 2 | ============ |
3 | 3 |
|
4 | | -Contributions to ``dataretrieval`` are welcome and greatly appreciated, but |
5 | | -please read this document before doing so. |
| 4 | +Contributions to ``dataretrieval`` are welcome. The repository's contributor |
| 5 | +requirements and development commands are maintained in `CONTRIBUTING.md`_. |
| 6 | +That file is the single source of truth for reporting issues, proposing |
| 7 | +changes, preparing pull requests, coding standards, testing, documentation, |
| 8 | +and release guidance. |
6 | 9 |
|
| 10 | +For the design constraints that apply to architecturally significant changes, |
| 11 | +see :doc:`../architecture/index` and its architecture decision records. |
7 | 12 |
|
8 | | -Ways to contribute |
9 | | ------------------- |
10 | | - |
11 | | -Reporting Bugs: |
12 | | -^^^^^^^^^^^^^^^ |
13 | | - |
14 | | -Report bugs at https://github.com/DOI-USGS/dataretrieval-python/issues |
15 | | - |
16 | | -When reporting a bug, please include: |
17 | | - |
18 | | - - Detailed steps to reproduce the bug |
19 | | - - Your operating system name and version. |
20 | | - - Any details about your local setup that might be helpful in troubleshooting. |
21 | | - |
22 | | -Fixing Bugs: |
23 | | -^^^^^^^^^^^^ |
24 | | - |
25 | | -Look through the GitHub issues for bugs. Anything tagged as a "bug" is open to |
26 | | -whomever wants to fix it. |
27 | | - |
28 | | - |
29 | | -Implementing Features: |
30 | | -^^^^^^^^^^^^^^^^^^^^^^ |
31 | | - |
32 | | -Look through the GitHub issues for features. Anything tagged with "enhancement" |
33 | | -and "please-help" is open to whomever wants to implement it. |
34 | | - |
35 | | -Please do not combine multiple feature enhancements into a single pull request. |
36 | | - |
37 | | -Writing Documentation: |
38 | | -^^^^^^^^^^^^^^^^^^^^^^ |
39 | | - |
40 | | -``dataretrieval`` could always use more documentation, whether as part of the |
41 | | -official docs, in docstrings, or even in blog posts or articles. |
42 | | - |
43 | | -Submitting Feedback: |
44 | | -^^^^^^^^^^^^^^^^^^^^ |
45 | | - |
46 | | -The best way to send feedback is to file an issue at |
47 | | -https://github.com/DOI-USGS/dataretrieval-python/issues |
48 | | - |
49 | | -If you are proposing a feature: |
50 | | - |
51 | | - - Explain in detail how it would work. |
52 | | - - Keep the scope as narrow as possible, to make it easier to implement. |
53 | | - |
54 | | -Contributor Guidelines |
55 | | ----------------------- |
56 | | - |
57 | | -Pull Request Guidelines: |
58 | | -^^^^^^^^^^^^^^^^^^^^^^^^ |
59 | | - |
60 | | -Before you submit a pull request, check that it meets these guidelines: |
61 | | - |
62 | | -1. Changes to package functionality should include tests. |
63 | | -2. Changes to behavior should update the relevant documentation or docstrings. |
64 | | -3. The pull request should work for Python 3.10 and later and pass the GitHub |
65 | | - Actions continuous integration pipelines. |
66 | | -4. Build-related changes should preserve the installed-wheel smoke test; tests |
67 | | - run from a source checkout do not prove that an artifact is complete. |
68 | | -5. Architecturally significant changes should update :doc:`../architecture/index`, |
69 | | - add or supersede an ADR, and adjust the corresponding fitness function. |
70 | | - |
71 | | - |
72 | | -Updating Package Version: |
73 | | -^^^^^^^^^^^^^^^^^^^^^^^^^^ |
74 | | - |
75 | | -Follow semantic versioning as best as possible. This means that changing the |
76 | | -first digit of the version indicates a breaking change. Any smaller changes |
77 | | -should attempt to maintain backwards-compatibility with previous code and |
78 | | -issue deprecation warnings for features or functionality that will be removed |
79 | | -or no longer be backwards-compatible in future releases. |
80 | | - |
81 | | -The package version is derived automatically from Git tags by |
82 | | -``setuptools_scm`` (see ``[tool.setuptools_scm]`` in ``pyproject.toml``), so |
83 | | -there is no version string to edit by hand. To cut a release, tag the commit |
84 | | -(for example, ``git tag v1.2.3``) and push the tag; both the installed package |
85 | | -version and the documentation's ``version`` and ``release`` values (read via |
86 | | -``importlib.metadata`` in ``docs/source/conf.py``) follow from it. |
87 | | - |
88 | | - |
89 | | -Coding Standards |
90 | | ----------------- |
91 | | - |
92 | | -Formatting, linting, and strict type checking are enforced by CI and the |
93 | | -pre-commit configuration. Run ``ruff check .``, ``ruff format --check .``, |
94 | | -``mypy``, and the relevant pytest suite before submitting a change. |
95 | | - |
96 | | - - Follow PEP8 (https://peps.python.org/pep-0008/). |
97 | | - - Docstrings should follow the NumPy standard (`example`_). |
98 | | - - The public interface should emphasize functions over classes; classes can |
99 | | - and should be used internally and in tests. |
100 | | - - Group public download functions by data portal. |
101 | | - - Preserve the dependency direction in :doc:`../architecture/index`: |
102 | | - public facades depend on service/protocol adapters, which depend on stable |
103 | | - shared policy and infrastructure. Shared OGC code must not import service |
104 | | - adapters, and modern modules must not depend on legacy NWIS. |
105 | | - - Treat underscore-prefixed helpers as implementation details. Existing |
106 | | - cross-package uses are documented variances, not extension points. |
107 | | - |
108 | | -.. _example: https://www.sphinx-doc.org/en/master/usage/extensions/example_numpy.html |
109 | | - |
110 | | - - Example: |
111 | | - |
112 | | - .. code:: python |
113 | | -
|
114 | | - def foo(param1, param2): |
115 | | - """Example function with types documented in the docstring. |
116 | | -
|
117 | | - A more detailed description of the function and its implementation. |
118 | | -
|
119 | | - Parameters |
120 | | - ---------- |
121 | | - param1 : int |
122 | | - The first parameter. |
123 | | - param2 : str |
124 | | - The second parameter. |
125 | | -
|
126 | | - Returns |
127 | | - ------- |
128 | | - bool |
129 | | - True if successful, False otherwise. |
130 | | -
|
131 | | - Examples |
132 | | - -------- |
133 | | - Examples should be written in doctest format and should demonstrate basic usage. |
134 | | -
|
135 | | - .. doctest:: |
136 | | -
|
137 | | - >>> type(1) is int |
138 | | - True |
139 | | -
|
140 | | - """ |
141 | | -
|
142 | | - - The public interface should emphasize functions over classes; however, classes can and should be used internally and in tests. |
143 | | - - Functions for downloading data from a specific web portal must be grouped within their own submodule. |
144 | | - - For example, all NWIS functions are located at :obj:`dataretrieval.nwis`. |
145 | | - |
146 | | - - Quotes via http://stackoverflow.com/a/56190/5549: |
147 | | - |
148 | | - - Use double quotes around strings that are used for interpolation or that are natural language messages |
149 | | - - Use single quotes for small symbol-like strings (but break the rules if the strings contain quotes) |
150 | | - - Use triple double quotes for doc-strings and raw string literals for regular expressions even if they aren't needed. |
151 | | - |
152 | | - - Example: |
153 | | - |
154 | | - .. code:: python |
155 | | -
|
156 | | - LIGHT_MESSAGES = { |
157 | | - 'English': "There are %(number_of_lights)s lights.", |
158 | | - 'Pirate': "Arr! Thar be %(number_of_lights)s lights." |
159 | | - } |
160 | | -
|
161 | | - def lights_message(language, number_of_lights): |
162 | | - """Return a language-appropriate string reporting the light count.""" |
163 | | - return LIGHT_MESSAGES[language] % locals() |
164 | | -
|
165 | | - def is_pirate(message): |
166 | | - """Return True if the given message sounds piratical.""" |
167 | | - return re.search(r"(?i)(arr|avast|yohoho)!", message) is not None |
168 | | -
|
169 | | -
|
170 | | -Acknowledgements |
171 | | ----------------- |
172 | | -This document was adapted from the ``cookiecutter`` project's CONTRIBUTING file, which resides at |
173 | | -https://github.com/cookiecutter/cookiecutter/blob/main/CONTRIBUTING.md |
174 | | -Thank you to the ``cookiecutter`` team for helping streamline open-source development for the masses. |
| 13 | +.. _CONTRIBUTING.md: https://github.com/DOI-USGS/dataretrieval-python/blob/main/CONTRIBUTING.md |
0 commit comments