Skip to content

Commit 1c16896

Browse files
committed
Metadata hook: add suport for additional-classifiers property
1 parent 8cf6b03 commit 1c16896

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Metadata hook: add suport for additional-classifiers property #10
13+
1014
## [0.1.0] - 2024-02-05
1115

1216
### Added

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ NOTA: the `dependencies` attribute is not specific to our hook(s), it is a gener
6363
| Variable | Required | Description |
6464
|---|---|---|
6565
| `additional-authors` | N | List of authors that will be appended to the automatic one |
66+
| `additional-classifiers` | N | List of classifiers that will be appended to the automatic ones |
6667
| `additional-keywords` | N | List of keywords that will be appended to the automatic ones |
6768
| `kind` | N | If set to `scraper`, scrapers keywords will be automatically added as well |
6869
| `organization` | N | Override organization (otherwise detected from Github repository to set author and keyword appropriately). Case-insentive. Supported values are `openzim`, `kiwix` and `offspot` |

src/hatch_openzim/metadata.py

+1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ def update(root: str, config: dict, metadata: dict):
6060
]
6161
for python_version in get_python_versions(metadata["requires-python"]):
6262
classifiers.append(f"Programming Language :: Python :: {python_version}")
63+
classifiers.extend(config.get("additional-classifiers", []))
6364
metadata["classifiers"] = classifiers

tests/test_metadata.py

+22
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,28 @@ def test_metadata_additional_keywords(metadata):
129129
assert set(metadata["keywords"]) == {"openzim", "keyword1", "keyword2"}
130130

131131

132+
def test_metadata_additional_classifiers(metadata):
133+
config = {}
134+
config["additional-classifiers"] = [
135+
"Development Status :: 5 - Production/Stable",
136+
"Intended Audience :: Developers",
137+
]
138+
update(
139+
root=str(Path(os.path.dirname(os.path.abspath(__file__))).parent),
140+
config=config,
141+
metadata=metadata,
142+
)
143+
# we compare sets because order is not relevant
144+
assert set(metadata["classifiers"]) == {
145+
"Programming Language :: Python :: 3",
146+
"Programming Language :: Python :: 3.10",
147+
"Programming Language :: Python :: 3.11",
148+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
149+
"Development Status :: 5 - Production/Stable",
150+
"Intended Audience :: Developers",
151+
}
152+
153+
132154
def test_metadata_additional_authors(metadata):
133155
config = {}
134156
config["additional-authors"] = [{"email": "[email protected]", "name": "Some One"}]

0 commit comments

Comments
 (0)