-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Parse and display recent contributors from YAML #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
melissawm
merged 8 commits into
pyOpenSci:main
from
Phinart98:#10-parse-contributor-data
Aug 27, 2025
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1cdceed
feat: Parse and display recent contributors from YAML
Phinart98 d592318
docs: Update all docstrings to numpy style format
Phinart98 673b1ec
Merge branch 'pyOpenSci:main' into #10-parse-contributor-data
Phinart98 971df32
Replace PyYAML with ruamel.yaml for active maintenance
Phinart98 41c7f3b
include uv.lock
Phinart98 0a1c78b
Merge branch 'main' into #10-parse-contributor-data
Phinart98 284a64a
Address code review feedback and simplify contributor logic
Phinart98 898bb40
Merge branch '#10-parse-contributor-data' of https://github.com/Phina…
Phinart98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| from django.contrib import admin | ||
|
|
||
| from django.contrib import admin | ||
| # Register your models here. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,97 @@ | ||
| from django.db import models | ||
|
|
||
| # Create your models here. | ||
| from django.db import models | ||
| from typing import Optional | ||
|
|
||
|
|
||
| class Contributor(models.Model): | ||
| """ | ||
| Django model representing a pyOpenSci contributor. | ||
|
|
||
| This model mirrors the PersonModel from pyosMeta for future database migration. | ||
| Currently, contributor data is read directly from YAML files. | ||
| """ | ||
|
|
||
| # Basic information | ||
| name = models.CharField(max_length=255, null=True, blank=True) | ||
| github_username = models.CharField(max_length=100, unique=True) | ||
| github_image_id = models.IntegerField(null=True, blank=True) | ||
| bio = models.TextField(null=True, blank=True) | ||
| organization = models.CharField(max_length=255, null=True, blank=True) | ||
| location = models.CharField(max_length=255, null=True, blank=True) | ||
| email = models.EmailField(null=True, blank=True) | ||
|
|
||
| # Dates | ||
| date_added = models.DateField(null=True, blank=True) | ||
|
|
||
| # Role flags | ||
| deia_advisory = models.BooleanField(default=False) | ||
| editorial_board = models.BooleanField(default=False) | ||
| emeritus_editor = models.BooleanField(default=False) | ||
| advisory = models.BooleanField(default=False) | ||
| emeritus_advisory = models.BooleanField(default=False) | ||
| board = models.BooleanField(default=False) | ||
|
|
||
| # Social media and external links | ||
| twitter = models.CharField(max_length=50, null=True, blank=True) | ||
| mastodon = models.URLField(null=True, blank=True) | ||
| orcidid = models.CharField(max_length=50, null=True, blank=True) | ||
| website = models.URLField(null=True, blank=True) | ||
|
|
||
| # JSON fields for lists (SQLite compatible) | ||
| title = models.JSONField(default=list, blank=True) | ||
| partners = models.JSONField(default=list, blank=True) | ||
| contributor_type = models.JSONField(default=list, blank=True) | ||
| packages_eic = models.JSONField(default=list, blank=True) | ||
| packages_editor = models.JSONField(default=list, blank=True) | ||
| packages_submitted = models.JSONField(default=list, blank=True) | ||
| packages_reviewed = models.JSONField(default=list, blank=True) | ||
|
|
||
| # Metadata | ||
| sort = models.IntegerField(null=True, blank=True) | ||
| created_at = models.DateTimeField(auto_now_add=True) | ||
| updated_at = models.DateTimeField(auto_now=True) | ||
|
|
||
| class Meta: | ||
| ordering = ['-date_added', 'sort', 'name'] | ||
| verbose_name = "Contributor" | ||
| verbose_name_plural = "Contributors" | ||
|
|
||
| def __str__(self) -> str: | ||
| return self.display_name | ||
|
|
||
| @property | ||
| def display_name(self) -> str: | ||
| """ | ||
| Return name if available, otherwise GitHub username. | ||
|
|
||
| Returns | ||
| ------- | ||
| str | ||
| The contributor's display name. | ||
| """ | ||
| return self.name or f"@{self.github_username}" | ||
|
|
||
| @property | ||
| def github_avatar_url(self) -> Optional[str]: | ||
| """ | ||
| Generate GitHub avatar URL from image ID. | ||
|
|
||
| Returns | ||
| ------- | ||
| str or None | ||
| GitHub avatar URL if image ID exists, None otherwise. | ||
| """ | ||
| if self.github_image_id: | ||
| return f"https://avatars.githubusercontent.com/u/{self.github_image_id}?s=400&v=4" | ||
| return None | ||
|
|
||
| @property | ||
| def github_profile_url(self) -> str: | ||
| """ | ||
| Generate GitHub profile URL. | ||
|
|
||
| Returns | ||
| ------- | ||
| str | ||
| GitHub profile URL for the contributor. | ||
| """ | ||
| return f"https://github.com/{self.github_username}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment supposed to be here? Also, whenever possible, it would be best to add an extra empty line at the end of each file (that will get rid of the red symbols you see here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those comments are there in the starter files when you install Django. I should have cleared them after I added my code. I will do that in my next commit.
I have always wondered why many files I see in repos online have an extra empty line at the bottom. Thanks for pointing this out to me😅