Skip to content

Started failing with TypeError: '<' not supported between instances of 'str' and 'float' #164

@krassowski

Description

@krassowski

Describe the bug

context

It all worked perfectly earlier today but started failing at about 16:00 UTC time Jan 21st:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.12/x64/bin/jupyter-releaser", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/cli.py", line 121, in invoke
    super().invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/cli.py", line 416, in build_changelog
    changelog.build_entry(
  File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/changelog.py", line 190, in build_entry
    entry = get_version_entry(
            ^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/changelog.py", line 127, in get_version_entry
    md = generate_activity_md(
         ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/github_activity/github_activity.py", line 594, in generate_activity_md
    data.at[ix, "contributors"] = list(item_contributors)
                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/github_activity/github_activity.py", line 386, in __iter__
    for item in sorted(self.other - {self.author}):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'str' and 'float'

expectation

Does not fail

bug

I am not sure, probably GitHub API changed?

problem

jupyter-releaser uses github_activity for CI

Reproduce the bug

See:

List your environment

github-activity-1.1.4

Relevant place in code:

@dataclasses.dataclass(slots=True)
class ContributorSet:
"""This class represents a sorted set of PR contributor usernames.
The sorting is special, in that the author is placed first.
"""
author: str = ""
other: set = dataclasses.field(default_factory=set)
def add(self, contributor):
self.other.add(contributor)
def __iter__(self):
if self.author:
yield self.author
for item in sorted(self.other - {self.author}):
yield item

for ix, row in data.iterrows():
# Track contributors to this PR
item_contributors = ContributorSet()
# This is a list, since we *want* duplicates in here—they
# indicate number of times a contributor commented
item_commenters = []
# contributor order:
# - author
# - committers
# - merger
# - reviewers
# Only add author if they're not a bot
if not ignored_user(row.author):
item_contributors.author = row.author
if row.kind == "pr":
for committer in filter_ignored(row.committers):
item_contributors.add(committer)
# Only add merger if they're not a bot and not the author
if (
row.mergedBy
and row.mergedBy != row.author
and not ignored_user(row.mergedBy)
):
item_contributors.add(row.mergedBy)
for reviewer in filter_ignored(row.reviewers):
item_contributors.add(reviewer)
for icomment in row["comments"]["edges"]:
comment_author = icomment["node"]["author"]
if not comment_author:
# This happens if the GitHub user has been deleted
# ref: https://github.com/jupyterhub/oauthenticator/pull/224#issuecomment-453211986
continue
comment_author = comment_author["login"]
if ignored_user(comment_author):
# ignore bots and user-specified contributors
continue
# Add to list of commenters on items they didn't author
if comment_author != row["author"]:
comment_helpers.append(comment_author)
# Add to list of commenters for this item so we can see how many times they commented
item_commenters.append(comment_author)
# count all comments on a PR as a contributor
item_contributors.add(comment_author)
# Count any commenters that had enough comments on the issue to be a contributor
item_commenters_counts = pd.Series(item_commenters).value_counts()
item_commenters_counts = item_commenters_counts[
item_commenters_counts >= comment_response_cutoff
].index.tolist()
for person in item_commenters_counts:
# Filter out NaN values and non-strings
if isinstance(person, str):
all_contributors.add(person)
# record contributor list (ordered, unique)
data.at[ix, "contributors"] = list(item_contributors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions