Skip to content

Commit 5a3bc79

Browse files
committed
update contribution.md to resolve NOAA-OWP#143.
1 parent fb9190e commit 5a3bc79

File tree

1 file changed

+79
-59
lines changed

1 file changed

+79
-59
lines changed

CONTRIBUTING.md

+79-59
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Guidance on how to contribute
22

33
There are two primary ways to help:
4-
- Using the issue tracker, and
5-
- Changing the code-base.
64

5+
- Using the issue tracker, and
6+
- Changing the code-base.
77

88
## Using the issue tracker
99

@@ -23,7 +23,6 @@ unit tests that validate implemented features and the presence or lack of defect
2323
Additionally, the code should follow any stylistic and architectural guidelines
2424
prescribed by the project.
2525

26-
2726
## Contribution Guidelines
2827

2928
### Setting Up Development Environment
@@ -104,70 +103,76 @@ This project uses python native `namespace` packaging as outlined introduced in
104103

105104
```bash
106105
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
116122
```
117123

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
119169

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-
)
165170
```
166171

167172
4. The package's `pyproject.toml` should use the following template and add any
168173
build-system requirements:
169174

170-
```
175+
```toml
171176
[build-system]
172177
build-backend = "setuptools.build_meta"
173178
requires = [
@@ -177,4 +182,19 @@ requires = [
177182

178183
```
179184

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+
180200
Further explanation of the rational behind this pattern and more verbose explanation can be found in #12.

0 commit comments

Comments
 (0)