Skip to content

Commit 0ce529e

Browse files
schema: reviewers can be empty now + parsing: handle bold/italics formatting (#310)
* Change reviewers field to be optional * Modify get_contributor_data return type to include None Update get_contributor_data method to return None when no models are found. * Add check for empty GitHub username and name return None instead of trying to instantiate a ReviewUser * fix models checking logic * debug: hatch run * go back to simpler handling of empty models Refactor user model parsing to handle empty lists. * Fix error handling for new contributors in update_review_teams early return when we're missing a ReviewUser / fail to validate the PersonModel (skip behavior to align with the existing log statement) * Add '*' to unwanted characters in clean_name function there's a contributor that's being processed with * in their name. stripping this character should allow them to be processed as a PersonModel (in theory) * Remove markdown formatting from issue value Strip markdown formatting from returned value. * Update CHANGELOG for version 1.7.6 Added details for version 1.7.6 including bug fix and feature.
1 parent 3533532 commit 0ce529e

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ See [GitHub releases](https://github.com/pyOpenSci/pyosMeta/releases) page for a
66

77
## [Unreleased]
88

9+
## [v1.7.6] - 2025-10-10
10+
* Bug fix: handle markdown styling in issue template for package submission
11+
* Feature: allow empty reviewers for in issue template for package submission
12+
913
## [v1.7.5] - 2025-09-10
1014

1115
* Bug fix: remove an extra newline character that prevents Jekyll from building pages from RSS feed stubs (@banesullivan, #306)

src/pyosmeta/cli/update_review_teams.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def process_user(
119119
f"Error processing new contributor {gh_user}. Skipping this user.",
120120
exc_info=True,
121121
)
122+
return user, contribs
122123

123124
# Update user the list of contribution types if there are new types to add
124125
# for instance a new reviewer would have a "Reviewer" contributor type

src/pyosmeta/models/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class ReviewModel(BaseModel):
256256
categories: Optional[list[str]] = None
257257
editor: ReviewUser | list[ReviewUser] | None = None
258258
eic: ReviewUser | list[ReviewUser] | None = None
259-
reviewers: list[ReviewUser] = Field(default_factory=list)
259+
reviewers: list[ReviewUser] | None = None
260260
archive: str | None = None
261261
version_accepted: str | None = None
262262
date_accepted: str | None = Field(

src/pyosmeta/parse_issues.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _parse_field(self, key: str, val: str) -> Any:
250250
# add other conditions here for special processing of fields..
251251
# pass
252252
else:
253-
return val
253+
return val.strip("*").strip("__") # remove markdown formatting
254254

255255
def parse_issue(self, issue: Issue | str) -> ReviewModel:
256256
"""
@@ -340,7 +340,7 @@ def parse_issues(
340340

341341
def get_contributor_data(
342342
self, line: str
343-
) -> Union[ReviewUser, List[ReviewUser]]:
343+
) -> Union[ReviewUser, List[ReviewUser], None]:
344344
"""Parse names for various review roles from issue metadata.
345345
346346
Parameters
@@ -358,6 +358,8 @@ def get_contributor_data(
358358
users = line.split(",")
359359
models = [parse_user_names(username=user) for user in users]
360360
models = [model for model in models if model is not None]
361+
if len(models) == 0:
362+
return None
361363
if len(models) == 1:
362364
models = models[0]
363365
return models

src/pyosmeta/utils_clean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def clean_date(source_date: str | None) -> datetime | str:
7474
def clean_name(source_name: str) -> str:
7575
"""Remove unwanted characters from a name."""
7676

77-
unwanted = ["(", ")", "@"]
77+
unwanted = ["(", ")", "@", "*"]
7878
for char in unwanted:
7979
source_name = source_name.replace(char, "")
8080

src/pyosmeta/utils_parse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ def parse_user_names(username: str) -> ReviewUser | None:
4545
"github_username": clean_name(names[0]),
4646
"name": "",
4747
}
48-
48+
if (parsed["github_username"] == "") and (parsed["name"] == ""):
49+
return None
4950
return ReviewUser(**parsed)

0 commit comments

Comments
 (0)