1
1
# Guidance on how to contribute
2
2
3
3
There are two primary ways to help:
4
- - Using the issue tracker, and
5
- - Changing the code-base.
6
4
5
+ - Using the issue tracker, and
6
+ - Changing the code-base.
7
7
8
8
## Using the issue tracker
9
9
@@ -23,7 +23,6 @@ unit tests that validate implemented features and the presence or lack of defect
23
23
Additionally, the code should follow any stylistic and architectural guidelines
24
24
prescribed by the project.
25
25
26
-
27
26
## Contribution Guidelines
28
27
29
28
### Setting Up Development Environment
@@ -104,70 +103,76 @@ This project uses python native `namespace` packaging as outlined introduced in
104
103
105
104
``` bash
106
105
python
107
- ├── my_subpackage/
108
- ├── hydrotools/
109
- │ └── my_subpackage/
110
- │ ├── __init__.py
111
- │ └── foo.py
112
- │ └── bar.py
113
- ├── setup.py
114
- ├── pyproject.toml
115
- └── tests/
106
+ └── my_subpackage/
107
+ ├── src/
108
+ │ └── hydrotools/
109
+ │ └── my_subpackage/
110
+ │ ├── __init__.py
111
+ │ ├── foo.py
112
+ │ └── _version.py
113
+ ├── tests/
114
+ ├── CONTRIBUTION.md -> ../../CONTRIBUTION.md
115
+ ├── LICENSE -> ../../LICENSE
116
+ ├── SECURITY.md -> ../../SECURITY.md
117
+ ├── TERMS.md -> ../../TERMS.md
118
+ ├── README.md
119
+ ├── pyproject.toml
120
+ ├── pytest.ini -> ../../pytest.ini
121
+ └── setup.cfg
116
122
```
117
123
118
- 3 . The package's ` setup.py ` should use the following template:
124
+ 3 . The package's ` setup.cfg ` should use the following template:
125
+
126
+ ``` ini
127
+ [metadata]
128
+ name = hydrotools.{{ SUBPACKAGE_NAME }}
129
+ version = attr: hydrotools.{{ SUBPACKAGE_NAME }}._version.__version__
130
+ author = {{ AUTHOR }}
131
+ author_email = {{ AUTHOR_EMAIL }}
132
+ description = {{ SHORT_DESCRIPTION }}
133
+ long_description = file: README.md
134
+ long_description_content_type = text/markdown; charset=UTF-8
135
+ license = USDOC
136
+ license_files =
137
+ LICENSE
138
+ url = https://github.com/NOAA-OWP/hydrotools
139
+ project_urls =
140
+ Documentation = https://noaa-owp.github.io/hydrotools/hydrotools.{{ SUBPACKAGE_NAME }}.html
141
+ Source = https://github.com/NOAA-OWP/hydrotools/tree/main/python/nwm_client
142
+ Tracker = https://github.com/NOAA-OWP/hydrotools/issues
143
+ classifiers =
144
+ Development Status :: 3 - Alpha
145
+ Intended Audience :: Education
146
+ Intended Audience :: Science/Research
147
+ License :: Free To Use But Restricted
148
+ Programming Language :: Python :: 3.7
149
+ Programming Language :: Python :: 3.8
150
+ Programming Language :: Python :: 3.9
151
+ Topic :: Scientific/Engineering :: Hydrology
152
+ Operating System :: OS Independent
153
+
154
+ [options]
155
+ packages = find_namespace:
156
+ package_dir =
157
+ =src
158
+ install_requires =
159
+ {{ PACKAGE_REQUIREMENTS }}
160
+ python_requires = >=3.7
161
+ include_package_data = True
162
+
163
+ [options.packages.find]
164
+ where = src
165
+
166
+ [options.extras_require]
167
+ develop =
168
+ pytest
119
169
120
- ``` python
121
- # !/usr/bin/env python3
122
- from setuptools import setup, find_namespace_packages
123
-
124
- # python namespace subpackage
125
- # this namespace package follows PEP420
126
- # https://packaging.python.org/guides/packaging-namespace-packages/#native-namespace-packages
127
-
128
- NAMESPACE_PACKAGE_NAME = " hydrotools"
129
- SUBPACKAGE_NAME = " {{ SUBPACKAGE_NAME }} "
130
-
131
- # Namespace subpackage slug.
132
- # Ex: mypkg.a # Where the namespace pkg = `mypkg` and the subpackage = `a`
133
- SUBPACKAGE_SLUG = f " { NAMESPACE_PACKAGE_NAME } . { SUBPACKAGE_NAME } "
134
-
135
- # Subpackage version
136
- VERSION = " 0.1.0"
137
-
138
- # Package author information
139
- AUTHOR = " {{ AUTHOR }} "
140
- AUTHOR_EMAIL = " {{ AUTHOR_EMAIL }} "
141
-
142
- # Short sub-package description
143
- DESCRIPTION = " {{ SHORT_DESCRIPTION }} "
144
-
145
- # Package dependency requirements
146
- REQUIREMENTS = []
147
-
148
- # Development requirements
149
- DEVELOPMENT_REQUIREMENTS = [" pytest" ]
150
-
151
- setup(
152
- name = SUBPACKAGE_SLUG ,
153
- version = VERSION ,
154
- author = AUTHOR ,
155
- author_email = AUTHOR_EMAIL ,
156
- classifiers = [" Private :: Do Not Upload to pypi server" ,],
157
- description = DESCRIPTION ,
158
- namespace_packages = [NAMESPACE_PACKAGE_NAME ],
159
- packages = find_namespace_packages(
160
- include = [f " { NAMESPACE_PACKAGE_NAME } .* " ]
161
- ),
162
- install_requires = REQUIREMENTS ,
163
- extras_require = {" develop" : DEVELOPMENT_REQUIREMENTS },
164
- )
165
170
```
166
171
167
172
4 . The package's ` pyproject.toml ` should use the following template and add any
168
173
build-system requirements:
169
174
170
- ```
175
+ ``` toml
171
176
[build-system ]
172
177
build-backend = " setuptools.build_meta"
173
178
requires = [
@@ -177,4 +182,19 @@ requires = [
177
182
178
183
```
179
184
185
+ 5 . ` _version.py ` should use the following template:
186
+
187
+ ``` python
188
+ __version__ = " 0.0.1"
189
+
190
+ ```
191
+
192
+ 6 . ` __init__.py ` must start with the following:
193
+
194
+ ``` python
195
+ # removing __version__ import will cause build to fail. see: https://github.com/pypa/setuptools/issues/1724#issuecomment-627241822
196
+ from ._version import __version__
197
+
198
+ ```
199
+
180
200
Further explanation of the rational behind this pattern and more verbose explanation can be found in #12 .
0 commit comments