Skip to content

insiders ¤

insiders package.

Manage your Insiders projects.

Classes:

Functions:

Account dataclass ¤

Account(
    *,
    name: str,
    image: str | None = None,
    url: str | None = None,
    platform: SponsorshipPlatform,
    is_org: bool = False,
    sponsorships: list[Sponsorship] = list(),
    included: bool = False,
    excluded: bool = False
)

An account.

Attributes:

  • direct_sponsor (bool) –

    Return whether the account is a direct sponsor.

  • excluded (bool) –

    Indicates if the account is excluded from the sponsors list.

  • highest_tier (int) –

    Return the highest tier amount.

  • image (str | None) –

    The image URL of the account.

  • included (bool) –

    Indicates if the account is included in the sponsors list.

  • is_org (bool) –

    Indicates if the account is an organization.

  • is_user (bool) –

    Return whether the account is a user.

  • name (str) –

    The name of the account.

  • platform (SponsorshipPlatform) –

    The platform of the account.

  • sponsorships (list[Sponsorship]) –

    List of sponsorships associated with the account

  • tier_sum (int) –

    Return the sum of all tier amounts.

  • url (str | None) –

    The URL of the account.

direct_sponsor property ¤

direct_sponsor: bool

Return whether the account is a direct sponsor.

excluded class-attribute instance-attribute ¤

excluded: bool = False

Indicates if the account is excluded from the sponsors list.

highest_tier property ¤

highest_tier: int

Return the highest tier amount.

image class-attribute instance-attribute ¤

image: str | None = None

The image URL of the account.

included class-attribute instance-attribute ¤

included: bool = False

Indicates if the account is included in the sponsors list.

is_org class-attribute instance-attribute ¤

is_org: bool = False

Indicates if the account is an organization.

is_user property ¤

is_user: bool

Return whether the account is a user.

name instance-attribute ¤

name: str

The name of the account.

platform instance-attribute ¤

platform: SponsorshipPlatform

The platform of the account.

sponsorships class-attribute instance-attribute ¤

sponsorships: list[Sponsorship] = field(
    default_factory=list
)

List of sponsorships associated with the account

tier_sum property ¤

tier_sum: int

Return the sum of all tier amounts.

url class-attribute instance-attribute ¤

url: str | None = None

The URL of the account.

Backlog dataclass ¤

Backlog(*, issues: list[Issue] = list())

Backlog of issues.

Classes:

Methods:

  • sort

    Sort the backlog.

Attributes:

issues class-attribute instance-attribute ¤

issues: list[Issue] = field(default_factory=list)

A list of issues.

SortStrategy ¤

Methods:

author_sponsorships staticmethod ¤

author_sponsorships(
    *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • reverse (bool, default: True ) –

created staticmethod ¤

created(*, reverse: bool = False) -> Callable[[Issue], int]

Parameters:

  • reverse (bool, default: False ) –

label staticmethod ¤

label(
    name: str, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • name (str) –
  • reverse (bool, default: True ) –

min_author_sponsorships staticmethod ¤

min_author_sponsorships(
    amount: int, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • amount (int) –
  • reverse (bool, default: True ) –

min_pledge staticmethod ¤

min_pledge(
    amount: int, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • amount (int) –
  • reverse (bool, default: True ) –

min_sponsorships staticmethod ¤

min_sponsorships(
    amount: int, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • amount (int) –
  • reverse (bool, default: True ) –

min_upvoters_sponsorships staticmethod ¤

min_upvoters_sponsorships(
    amount: int, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • amount (int) –
  • reverse (bool, default: True ) –

min_upvotes staticmethod ¤

min_upvotes(
    amount: int, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • amount (int) –
  • reverse (bool, default: True ) –

pledge staticmethod ¤

pledge(*, reverse: bool = True) -> Callable[[Issue], int]

Parameters:

  • reverse (bool, default: True ) –

repository staticmethod ¤

repository(
    name: str, *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • name (str) –
  • reverse (bool, default: True ) –

sponsorships staticmethod ¤

sponsorships(
    *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • reverse (bool, default: True ) –

upvoters_sponsorships staticmethod ¤

upvoters_sponsorships(
    *, reverse: bool = True
) -> Callable[[Issue], int]

Parameters:

  • reverse (bool, default: True ) –

upvotes staticmethod ¤

upvotes(*, reverse: bool = True) -> Callable[[Issue], int]

Parameters:

  • reverse (bool, default: True ) –

sort ¤

sort(*strats: Callable[[Issue], Any]) -> None

Sort the backlog.

Parameters:

GitHub ¤

GitHub(token: str)

Bases: Client

GitHub client.

Initialize GitHub API client.

Parameters:

  • token (str) –

    A GitHub token. Recommended scopes: admin:org and read:user.

Methods:

consolidate_beneficiaries ¤

consolidate_beneficiaries(
    sponsors: Sponsors,
    beneficiaries: Mapping[
        str,
        Mapping[
            str, Iterable[str | Mapping[str, str | bool]]
        ],
    ],
) -> None

Parameters:

create_repo ¤

create_repo(
    repository: str,
    *,
    description: str | None = None,
    homepage: str | None = None,
    private: bool = False,
    has_issues: bool = False,
    has_projects: bool = False,
    has_wiki: bool = False,
    has_discussions: bool = False
) -> None

Create a repository.

Parameters:

  • repository (str) –

    The repository, like namespace/repo.

  • description (str | None, default: None ) –

    The repository description.

  • homepage (str | None, default: None ) –

    The repository homepage.

  • private (bool, default: False ) –

    Whether the repository is private.

  • has_issues (bool, default: False ) –

    Enable issues.

  • has_projects (bool, default: False ) –

    Enable projects.

  • has_wiki (bool, default: False ) –

    Enable the wiki.

  • has_discussions (bool, default: False ) –

    Enable discussions.

get_failed_invites ¤

get_failed_invites(org: str) -> set[str]

Parameters:

  • org (str) –

    The organization name.

Returns:

  • set[str]

    A set of member names.

get_issues ¤

get_issues(
    github_accounts: Iterable[str],
    known_github_users: Iterable[Account] | None = None,
    *,
    allow_labels: set[str] | None = None
) -> IssueDict

Get issues from GitHub.

Parameters:

  • github_accounts (Iterable[str]) –

    A list of GitHub account names.

  • known_github_users (Iterable[Account] | None, default: None ) –

    Known user accounts.

  • allow_labels (set[str] | None, default: None ) –

    A set of labels to keep.

Returns:

  • IssueDict

    A dictionary of issues.

get_org_members ¤

get_org_members(org: str) -> set[str]

Get organization members (username only).

Parameters:

  • org (str) –

    The organization name.

Returns:

  • set[str]

    A set of member names.

get_sponsors ¤

get_sponsors(*, exclude_private: bool = False) -> Sponsors

Get GitHub sponsors.

Parameters:

  • exclude_private (bool, default: False ) –

Returns:

get_team_invites ¤

get_team_invites(org: str, team: str) -> set[str]

Get pending invitations to a GitHub team.

Parameters:

  • org (str) –

    The organization name.

  • team (str) –

    The team name.

Returns:

  • set[str]

    A set of member names.

get_team_members ¤

get_team_members(org: str, team: str) -> set[str]

Get members of a GitHub team.

Parameters:

  • org (str) –

    The organization name.

  • team (str) –

    The team name.

Returns:

  • set[str]

    A set of member names.

grant_access ¤

grant_access(user: str, org: str, team: str) -> None

Grant access to a user to a GitHub team.

Parameters:

  • user (str) –

    A username.

  • org (str) –

    An organization name.

  • team (str) –

    A team name.

is_org ¤

is_org(account: str) -> bool

Check if an account is an organization.

Parameters:

  • account (str) –

    An account name.

Returns:

  • bool

    Whether the account is an organization.

revoke_access ¤

revoke_access(user: str, org: str, team: str) -> None

Revoke access from a user to a GitHub team.

Parameters:

  • user (str) –

    A username.

  • org (str) –

    An organization name.

  • team (str) –

    A team name.

sync_team ¤

sync_team(
    team: str,
    *,
    sponsors: Sponsors | None = None,
    min_amount: int | None = None,
    include_users: set[str] | None = None,
    exclude_users: set[str] | None = None,
    dry_run: bool = False
) -> None

Sync sponsors with members of a GitHub team.

Parameters:

  • team (str) –

    GitHub team to sync sponsors with.

  • sponsors (Sponsors | None, default: None ) –

    Sponsors data.

  • min_amount (int | None, default: None ) –

    Minimum amount to be considered a sponsor.

  • include_users (set[str] | None, default: None ) –

    Users to always grant access to.

  • exclude_users (set[str] | None, default: None ) –

    Users to never grant access to.

  • dry_run (bool, default: False ) –

    Display changes without applying them.

Index ¤

Index(
    url: str = DEFAULT_INDEX_URL,
    git_dir: Path = DEFAULT_REPO_DIR,
    dist_dir: Path = DEFAULT_DIST_DIR,
)

Index of repositories.

Initialize the index.

Parameters: conf_path: The path to the configuration file.

Parameters:

  • url (str, default: DEFAULT_INDEX_URL ) –
  • git_dir (Path, default: DEFAULT_REPO_DIR ) –
  • dist_dir (Path, default: DEFAULT_DIST_DIR ) –

Methods:

  • add
  • exists

    Tell if a package version exists.

  • latest

    Get the latest version of a package.

  • logs

    Return the logs file path.

  • remove
  • start

    Start the server.

  • status

    Return the server status as a dict of metadata.

  • stop

    Stop the server.

  • update

    Update PyPI packages.

  • upload

    Upload distributions.

add ¤

add(git_url: str, repo: str | None = None) -> None

Parameters:

  • git_url (str) –
  • repo (str | None, default: None ) –

exists ¤

exists(name: str, version: str) -> bool

Tell if a package version exists.

Parameters:

  • name (str) –

    The package name (distribution name).

  • version (str) –

    The package version.

Returns:

  • bool

    Whether the package version exists or not.

latest ¤

latest(name: str) -> str | None

Get the latest version of a package.

Parameters:

  • name (str) –

    The package name (distribution name).

Returns:

  • str | None

    The version as a string, or none.

logs ¤

logs() -> str

Return the logs file path.

remove ¤

remove(repo: str) -> None

Parameters:

  • repo (str) –

start ¤

start(
    *, background: bool = False, log_path: str | None = None
) -> None

Start the server.

Parameters:

  • background (bool, default: False ) –
  • log_path (str | None, default: None ) –

status ¤

status() -> dict | None

Return the server status as a dict of metadata.

Returns:

  • dict | None

    Some metadata about the server process.

stop ¤

stop() -> bool

Stop the server.

Returns:

  • bool

    Whether the server was stopped or not.

update ¤

update(projects: Iterable[str] | None = None) -> None

Update PyPI packages.

For each configured repository, pull latest contents, checkout latest tag, and if the corresponding version is not present on the index, build and upload distributions.

Parameters:

upload ¤

upload(dists: Iterable[str | Path]) -> None

Upload distributions.

Parameters:

Issue dataclass ¤

Issue(
    *,
    repository: str,
    number: int,
    title: str,
    created: datetime,
    author: Account,
    upvotes: set[Account] = set(),
    labels: set[str] = set(),
    pledged: int = 0,
    platform: IssuePlatform
)

An issue.

Attributes:

author instance-attribute ¤

author: Account

The issue author.

created instance-attribute ¤

created: datetime

The issue creation date.

labels class-attribute instance-attribute ¤

labels: set[str] = field(default_factory=set)

The issue labels.

number instance-attribute ¤

number: int

The issue number.

platform instance-attribute ¤

platform: IssuePlatform

The issue platform.

pledged class-attribute instance-attribute ¤

pledged: int = 0

The amount pledged.

repository instance-attribute ¤

repository: str

The issue repository.

title instance-attribute ¤

title: str

The issue title.

upvotes class-attribute instance-attribute ¤

upvotes: set[Account] = field(default_factory=set)

The issue upvotes / upvoters.

Polar ¤

Polar(token: str)

Bases: Client

Polar client.

Initialize Polar API client.

Parameters:

  • token (str) –

    A Polar API token. Recommended scopes: user:read, issues:read, subscriptions:read.

Methods:

get_issues ¤

get_issues(
    github_accounts: Iterable[str],
    known_github_users: Iterable[Account] | None = None,
) -> IssueDict

Get issues from Polar.

Parameters:

  • github_accounts (Iterable[str]) –

    GitHub accounts to fetch issues from.

  • known_github_users (Iterable[Account] | None, default: None ) –

    Known GitHub user accounts.

Returns:

  • IssueDict

    Issues data.

get_sponsors ¤

get_sponsors(*, exclude_private: bool = False) -> Sponsors

Get Polar sponsorships.

Parameters:

  • exclude_private (bool, default: False ) –

Returns:

Sponsors dataclass ¤

Sponsors(*, sponsorships: list[Sponsorship] = list())

Wrapper class for sponsorships.

Methods:

Attributes:

accounts property ¤

accounts: set[Account]

Set of accounts who created sponsorships.

beneficiaries property ¤

beneficiaries: dict[str, Beneficiary]

Beneficiaries of all sponsorships.

sponsorships class-attribute instance-attribute ¤

sponsorships: list[Sponsorship] = field(
    default_factory=list
)

Sponsorships.

merge ¤

merge(other: Sponsors) -> Sponsors

Parameters:

Sponsorship dataclass ¤

Sponsorship(
    *,
    private: bool = True,
    created: datetime,
    amount: int,
    account: Account,
    beneficiaries: dict[str, Beneficiary] = dict()
)

A sponsorship.

Attributes:

account instance-attribute ¤

account: Account

The account who created the sponsorship

amount instance-attribute ¤

amount: int

The amount of the sponsorship

beneficiaries class-attribute instance-attribute ¤

beneficiaries: dict[str, Beneficiary] = field(
    default_factory=dict
)

Beneficiaries of this sponsorship.

created instance-attribute ¤

created: datetime

The creation date of the sponsorship

private class-attribute instance-attribute ¤

private: bool = True

Indicates if the sponsorship is private

get_backlog ¤

get_backlog(
    github_namespaces: list[str],
    github: GitHub,
    polar: Polar | None = None,
    sponsors: Sponsors | None = None,
    issue_labels: set[str] | None = None,
) -> Backlog

Parameters:

  • github_namespaces (list[str]) –
  • github (GitHub) –
  • polar (Polar | None, default: None ) –
  • sponsors (Sponsors | None, default: None ) –
  • issue_labels (set[str] | None, default: None ) –

main ¤

main(args: list[str] | None = None) -> int

Run the main program.

This function is executed when you type insiders or python -m insiders.

Parameters:

  • args (list[str] | None, default: None ) –

    Arguments passed from the command line.

Returns:

  • int

    An exit code.

print_backlog ¤

print_backlog(
    backlog: Backlog,
    labels: dict[str, str] | None = None,
    limit: int = 0,
) -> None

Print the backlog.

Parameters:

  • backlog (Backlog) –

    The backlog to print.

  • labels (dict[str, str] | None, default: None ) –

    A map of label representations.

  • limit (int, default: 0 ) –

    The maximum number of issues to print.

update_numbers_file ¤

update_numbers_file(
    sponsorships: list[Sponsorship],
    filepath: Path = Path("numbers.json"),
) -> None

Update the file storing sponsorship numbers.

Parameters:

  • sponsorships (list[Sponsorship]) –

    List of sponsorships.

  • filepath (Path, default: Path('numbers.json') ) –

    File-path to update.

update_sponsors_file ¤

update_sponsors_file(
    sponsorships: list[Sponsorship],
    filepath: Path = Path("sponsors.json"),
    *,
    exclude_private: bool = True
) -> None

Update the file storing sponsors info.

Parameters:

  • sponsorships (list[Sponsorship]) –

    List of sponsorships.

  • filepath (Path, default: Path('sponsors.json') ) –

    File-path to update.

  • exclude_private (bool, default: True ) –

    Whether to exclude private members.