Skip to content

insiders ¤

insiders package.

Manage your Insiders projects.

Classes:

Functions:

Attributes:

DEFAULT_CONF_DIR module-attribute ¤

DEFAULT_CONF_DIR: Path = Path(user_config_dir(_APP_NAME))

The default configuration directory.

DEFAULT_CONF_PATH module-attribute ¤

DEFAULT_CONF_PATH: Path = DEFAULT_CONF_DIR / "insiders.toml"

The default configuration file path.

DEFAULT_DIST_DIR module-attribute ¤

DEFAULT_DIST_DIR: Path = Path(
    user_data_dir(_APP_NAME, _APP_AUTHOR)
)

The default index distributions directory

DEFAULT_INDEX_URL module-attribute ¤

DEFAULT_INDEX_URL: str = f'http://localhost:{DEFAULT_PORT}'

The default index URL.

DEFAULT_PORT module-attribute ¤

DEFAULT_PORT: int = 31411

The default index port.

DEFAULT_REPO_DIR module-attribute ¤

DEFAULT_REPO_DIR: Path = Path(
    user_cache_dir(_APP_NAME, _APP_AUTHOR)
)

The default Git repository (clones) cache directory.

SponsorshipPlatform module-attribute ¤

SponsorshipPlatform: TypeAlias = Literal['github', 'polar']

The supported sponsorship platforms.

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 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 ¤

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]

Sort by author sponsorships.

Parameters:

  • reverse (bool, default: True ) –

    Sort in reverse.

created staticmethod ¤

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

Sort by creation date.

Parameters:

  • reverse (bool, default: False ) –

    Sort in reverse.

label staticmethod ¤

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

Sort by label presence.

Parameters:

  • reverse (bool, default: True ) –

    Sort in reverse.

min_author_sponsorships staticmethod ¤

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

Sort by minimum author sponsorships.

Parameters:

  • amount (int) –

    Minimum amount.

  • reverse (bool, default: True ) –

    Sort in reverse.

min_sponsorships staticmethod ¤

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

Sort by minimum sponsorships.

Parameters:

  • amount (int) –

    Minimum amount.

  • reverse (bool, default: True ) –

    Sort in reverse.

min_upvoters_sponsorships staticmethod ¤

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

Sort by minimum upvoters sponsorships.

Parameters:

  • amount (int) –

    Minimum amount.

  • reverse (bool, default: True ) –

    Sort in reverse.

min_upvotes staticmethod ¤

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

Sort by minimum upvotes.

Parameters:

  • amount (int) –

    Minimum amount.

  • reverse (bool, default: True ) –

    Sort in reverse.

repository staticmethod ¤

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

Sort by repository.

Parameters:

  • reverse (bool, default: True ) –

    Sort in reverse.

sponsorships staticmethod ¤

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

Sort by sponsorships.

Parameters:

  • reverse (bool, default: True ) –

    Sort in reverse.

upvoters_sponsorships staticmethod ¤

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

Sort by upvoters sponsorships.

Parameters:

  • reverse (bool, default: True ) –

    Sort in reverse.

upvotes staticmethod ¤

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

Sort by upvotes.

Parameters:

  • reverse (bool, default: True ) –

    Sort in reverse.

sort ¤

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

Sort the backlog.

Beneficiary dataclass ¤

Beneficiary(*, user: Account, grant: bool | None = None)

A sponsorship beneficiary: a user, grant bit, and optional org.

Attributes:

  • grant (bool | None) –

    Whether the user is granted access to Insiders (in addition to getting voting power).

  • user (Account) –

    The user who benefits from the sponsorship.

grant class-attribute instance-attribute ¤

grant: bool | None = None

Whether the user is granted access to Insiders (in addition to getting voting power).

user instance-attribute ¤

user: Account

The user who benefits from the sponsorship.

CommandBacklog dataclass ¤

CommandBacklog(
    *,
    backlog_namespaces: list[str],
    issue_labels: dict[str, str] = dict(),
    limit: int = 0,
    sort: list[Callable] = list(),
    public: bool = False,
    polar_token: str = "",
    polar_beneficiaries: dict[str, list[str]] = dict(),
    github_token: str = "",
    github_beneficiaries: dict[str, list[str]] = dict(),
)

Command to list the backlog of issues.

Methods:

Attributes:

backlog_namespaces instance-attribute ¤

backlog_namespaces: list[str]

Namespaces to fetch issues from.

github_beneficiaries class-attribute instance-attribute ¤

github_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

Beneficiaries of GitHub sponsors.

github_token class-attribute instance-attribute ¤

github_token: str = ''

A GitHub token. Recommended scopes: read:user.

issue_labels class-attribute instance-attribute ¤

issue_labels: dict[str, str] = field(default_factory=dict)

Issue labels to keep in issues metadata, and how they are represented.

limit class-attribute instance-attribute ¤

limit: int = 0

Limit the number of issues to display.

polar_beneficiaries class-attribute instance-attribute ¤

polar_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

Beneficiaries of Polar sponsors.

polar_token class-attribute instance-attribute ¤

polar_token: str = ''

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

public class-attribute instance-attribute ¤

public: bool = False

Only use public sponsorships.

sort class-attribute instance-attribute ¤

sort: list[Callable] = field(default_factory=list)

Sort strategy.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexAdd dataclass ¤

CommandIndexAdd(
    *,
    repositories: list[str],
    sources_directory: Path = DEFAULT_REPO_DIR,
    distributions_directory: Path = DEFAULT_DIST_DIR,
    url: str = DEFAULT_INDEX_URL,
)

Command to add a repository to the watched repositories.

Methods:

Attributes:

distributions_directory class-attribute instance-attribute ¤

distributions_directory: Path = DEFAULT_DIST_DIR

Directory where the distributions are stored.

repositories instance-attribute ¤

repositories: list[str]

List of repositories (GitHub namespace/project or Git URL git@host:repo).

sources_directory class-attribute instance-attribute ¤

sources_directory: Path = DEFAULT_REPO_DIR

Directory where the sources are stored.

url class-attribute instance-attribute ¤

URL of the index to upload packages to.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexList dataclass ¤

CommandIndexList(
    *,
    sources_directory: Path = DEFAULT_REPO_DIR,
    distributions_directory: Path = DEFAULT_DIST_DIR,
    dists: bool = False,
    projects: bool = False,
)

Command to list the watched repositories.

Methods:

Attributes:

distributions_directory class-attribute instance-attribute ¤

distributions_directory: Path = DEFAULT_DIST_DIR

Directory where the distributions are stored.

dists class-attribute instance-attribute ¤

dists: bool = False

List distributions.

projects class-attribute instance-attribute ¤

projects: bool = False

List projects.

sources_directory class-attribute instance-attribute ¤

sources_directory: Path = DEFAULT_REPO_DIR

Directory where the sources are stored.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexLogs dataclass ¤

CommandIndexLogs()

Command to show the server logs.

Methods:

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexRemove dataclass ¤

CommandIndexRemove(
    *,
    repositories: list[str],
    sources_directory: Path = DEFAULT_REPO_DIR,
    distributions_directory: Path = DEFAULT_DIST_DIR,
)

Command to remove a repository and its distributions (if served locally).

Methods:

Attributes:

distributions_directory class-attribute instance-attribute ¤

distributions_directory: Path = DEFAULT_DIST_DIR

Directory where the distributions are stored.

repositories instance-attribute ¤

repositories: list[str]

List of repository names.

sources_directory class-attribute instance-attribute ¤

sources_directory: Path = DEFAULT_REPO_DIR

Directory where the sources are stored.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexStart dataclass ¤

CommandIndexStart(
    *,
    sources_directory: Path = DEFAULT_REPO_DIR,
    distributions_directory: Path = DEFAULT_DIST_DIR,
    url: str = DEFAULT_INDEX_URL,
    background: bool = False,
    log_path: str | None = None,
)

Command to start the server.

Methods:

Attributes:

background class-attribute instance-attribute ¤

background: bool = False

Run the server in the background.

distributions_directory class-attribute instance-attribute ¤

distributions_directory: Path = DEFAULT_DIST_DIR

Directory where the distributions are stored.

log_path class-attribute instance-attribute ¤

log_path: str | None = None

Where to write index server logs.

sources_directory class-attribute instance-attribute ¤

sources_directory: Path = DEFAULT_REPO_DIR

Directory where the sources are stored.

url class-attribute instance-attribute ¤

URL to serve the index at.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexStatus dataclass ¤

CommandIndexStatus()

Command to show the server status.

Methods:

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexStop dataclass ¤

CommandIndexStop()

Command to stop the server.

Methods:

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandIndexUpdate dataclass ¤

CommandIndexUpdate(
    *,
    repositories: list[str] = list(),
    sources_directory: Path = DEFAULT_REPO_DIR,
    distributions_directory: Path = DEFAULT_DIST_DIR,
    url: str = DEFAULT_INDEX_URL,
)

Command to update watched projects.

Methods:

Attributes:

distributions_directory class-attribute instance-attribute ¤

distributions_directory: Path = DEFAULT_DIST_DIR

Directory where the distributions are stored.

repositories class-attribute instance-attribute ¤

repositories: list[str] = field(default_factory=list)

List of repository names.

sources_directory class-attribute instance-attribute ¤

sources_directory: Path = DEFAULT_REPO_DIR

Directory where the sources are stored.

url class-attribute instance-attribute ¤

URL of the index to upload packages to.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandMain dataclass ¤

CommandMain(
    *,
    subcommand: CommandBacklog
    | CommandIndex
    | CommandProject
    | CommandSponsors,
    version: bool = False,
    debug_info: bool = False,
    config: Config = _load_config(),
    log_level: Literal[
        "TRACE",
        "DEBUG",
        "INFO",
        "SUCCESS",
        "WARNING",
        "ERROR",
        "CRITICAL",
    ] = "INFO",
    log_path: str | None = None,
    log_include: tuple[str, ...] = tuple(),
    log_exclude: tuple[str, ...] = tuple(),
    log_downgrade: tuple[str, ...] = tuple(),
)

Command to manage your Insiders projects.

Attributes:

config class-attribute instance-attribute ¤

config: Config = field(default_factory=_load_config)

Path to the configuration file.

debug_info class-attribute instance-attribute ¤

debug_info: bool = False

Print debug information.

log_downgrade class-attribute instance-attribute ¤

log_downgrade: tuple[str, ...] = field(
    default_factory=tuple
)

Downgrade INFO logs to DEBUG for logs originating from these modules/loggers. By default, all dependency logs are downgraded.

log_exclude class-attribute instance-attribute ¤

log_exclude: tuple[str, ...] = field(default_factory=tuple)

Exclude logs originating from these modules/loggers. Applied after inclusion. By default, nothing is excluded.

log_include class-attribute instance-attribute ¤

log_include: tuple[str, ...] = field(default_factory=tuple)

Include logs originating from these modules/loggers. By default, all logs are included.

log_level class-attribute instance-attribute ¤

log_level: Literal[
    "TRACE",
    "DEBUG",
    "INFO",
    "SUCCESS",
    "WARNING",
    "ERROR",
    "CRITICAL",
] = "INFO"

Lowest log level to display. Levels below that will be hidden.

log_path class-attribute instance-attribute ¤

log_path: str | None = None

Write log messages to this file path.

subcommand instance-attribute ¤

The selected subcommand.

version class-attribute instance-attribute ¤

version: bool = False

Print the program version and exit.

CommandProject dataclass ¤

Command to manage projects on GitHub and locally.

Attributes:

subcommand instance-attribute ¤

The selected subcommand.

CommandProjectCheck dataclass ¤

CommandProjectCheck()

Command to check GitHub projects.

Methods:

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandProjectCreate dataclass ¤

CommandProjectCreate(
    *,
    repository: str,
    description: str,
    namespace: str,
    project_directory: Path,
    insiders_repository: str | None = None,
    insiders_namespace: str | None = None,
    insiders_project_directory: Path,
    github_username: str | None = None,
    copier_template: str | None = None,
    copier_template_answers: dict[str, str] | None = None,
    post_creation_command: list[str] | None = None,
    register_on_pypi: bool = False,
    pypi_username: str | None = None,
)

Command to create public/insiders repositories.

Methods:

Attributes:

copier_template class-attribute instance-attribute ¤

copier_template: str | None = None

Copier template to generate new projects with.

copier_template_answers class-attribute instance-attribute ¤

copier_template_answers: dict[str, str] | None = None

Copier template answers to use when generating a project.

description instance-attribute ¤

description: str

Shared description.

github_username class-attribute instance-attribute ¤

github_username: str | None = None

GitHub username.

insiders_namespace class-attribute instance-attribute ¤

insiders_namespace: str | None = None

Namespace of the insiders repository.

insiders_project_directory instance-attribute ¤

insiders_project_directory: Path

Directory in which to clone the insiders repository.

insiders_repository class-attribute instance-attribute ¤

insiders_repository: str | None = None

Name of the insiders repository.

namespace instance-attribute ¤

namespace: str

Namespace of the public repository.

post_creation_command class-attribute instance-attribute ¤

post_creation_command: list[str] | None = None

Command to run after creating the public repository.

project_directory instance-attribute ¤

project_directory: Path

Directory in which to clone the public repository.

pypi_username class-attribute instance-attribute ¤

pypi_username: str | None = None

PyPI username to register the project with.

register_on_pypi class-attribute instance-attribute ¤

register_on_pypi: bool = False

Whether to register the project on PyPI after creating it.

repository instance-attribute ¤

repository: str

Name of the public repository.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandProjectPyPIRegister dataclass ¤

CommandProjectPyPIRegister(
    *, username: str, name: str, description: str
)

Command to register a project name on PyPI.

Methods:

Attributes:

description instance-attribute ¤

description: str

Description of the project on PyPI.

name instance-attribute ¤

name: str

Name to register.

username instance-attribute ¤

username: str

Username on PyPI (your account).

__call__ ¤

__call__() -> Any

Run the command.

CommandSponsors dataclass ¤

Command to manage sponsors.

Attributes:

subcommand instance-attribute ¤

The selected subcommand.

CommandSponsorsList dataclass ¤

CommandSponsorsList(
    *,
    github_sponsored_account: str = "",
    include_users: list[str] = list(),
    exclude_users: list[str] = list(),
    github_beneficiaries: dict[str, list[str]] = dict(),
    github_token: str = "",
    polar_sponsored_account: str = "",
    polar_beneficiaries: dict[str, list[str]] = dict(),
    polar_token: str = "",
    minimum_amount: int = 0,
    public: bool = False,
    sponsorships: bool = False,
)

Command to list sponsors.

Methods:

Attributes:

exclude_users class-attribute instance-attribute ¤

exclude_users: list[str] = field(default_factory=list)

Users that should never be in the team.

github_beneficiaries class-attribute instance-attribute ¤

github_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

Beneficiaries of GitHub sponsors.

github_sponsored_account class-attribute instance-attribute ¤

github_sponsored_account: str = ''

The sponsored account on GitHub Sponsors.

github_token class-attribute instance-attribute ¤

github_token: str = ''

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

include_users class-attribute instance-attribute ¤

include_users: list[str] = field(default_factory=list)

Users that should always be in the team.

minimum_amount class-attribute instance-attribute ¤

minimum_amount: int = 0

Minimum amount to be considered an insider.

polar_beneficiaries class-attribute instance-attribute ¤

polar_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

Beneficiaries of Polar sponsors.

polar_sponsored_account class-attribute instance-attribute ¤

polar_sponsored_account: str = ''

The sponsored account on Polar.

polar_token class-attribute instance-attribute ¤

polar_token: str = ''

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

public class-attribute instance-attribute ¤

public: bool = False

Only use public sponsorships.

sponsorships class-attribute instance-attribute ¤

sponsorships: bool = False

List sponsorships rather than users/sponsors.

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandSponsorsShow dataclass ¤

CommandSponsorsShow(
    *,
    insiders_team: str,
    github_sponsored_account: str = "",
    include_users: list[str] = list(),
    exclude_users: list[str] = list(),
    github_beneficiaries: dict[str, list[str]] = dict(),
    github_token: str = "",
    polar_sponsored_account: str = "",
    polar_token: str = "",
    minimum_amount: int = 0,
    dry_run: bool = False,
)

Command to show details about a sponsor/user.

Methods:

Attributes:

dry_run class-attribute instance-attribute ¤

dry_run: bool = False

Display the changes that would be made, without making them.

exclude_users class-attribute instance-attribute ¤

exclude_users: list[str] = field(default_factory=list)

Users that should never be in the team.

github_beneficiaries class-attribute instance-attribute ¤

github_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

A mapping of users belonging to sponsoring organizations.

github_sponsored_account class-attribute instance-attribute ¤

github_sponsored_account: str = ''

The sponsored account on GitHub Sponsors.

github_token class-attribute instance-attribute ¤

github_token: str = ''

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

include_users class-attribute instance-attribute ¤

include_users: list[str] = field(default_factory=list)

Users that should always be in the team.

insiders_team instance-attribute ¤

insiders_team: str

The GitHub team to sync.

minimum_amount class-attribute instance-attribute ¤

minimum_amount: int = 0

Minimum amount to be considered an insider.

polar_sponsored_account class-attribute instance-attribute ¤

polar_sponsored_account: str = ''

The sponsored account on Polar.

polar_token class-attribute instance-attribute ¤

polar_token: str = ''

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

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandSponsorsTeamList dataclass ¤

CommandSponsorsTeamList()

Command to list team memberships.

Methods:

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

CommandSponsorsTeamSync dataclass ¤

CommandSponsorsTeamSync(
    *,
    insiders_team: str,
    github_sponsored_account: str = "",
    include_users: list[str] = list(),
    exclude_users: list[str] = list(),
    github_beneficiaries: dict[str, list[str]] = dict(),
    github_token: str = "",
    polar_sponsored_account: str = "",
    polar_beneficiaries: dict[str, list[str]] = dict(),
    polar_token: str = "",
    minimum_amount: int = 0,
    dry_run: bool = False,
)

Command to sync team memberships with current sponsors.

Methods:

Attributes:

dry_run class-attribute instance-attribute ¤

dry_run: bool = False

Display the changes that would be made, without making them.

exclude_users class-attribute instance-attribute ¤

exclude_users: list[str] = field(default_factory=list)

Users that should never be in the team.

github_beneficiaries class-attribute instance-attribute ¤

github_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

A mapping of users belonging to sponsoring organizations.

github_sponsored_account class-attribute instance-attribute ¤

github_sponsored_account: str = ''

The sponsored account on GitHub Sponsors.

github_token class-attribute instance-attribute ¤

github_token: str = ''

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

include_users class-attribute instance-attribute ¤

include_users: list[str] = field(default_factory=list)

Users that should always be in the team.

insiders_team instance-attribute ¤

insiders_team: str

The GitHub team to sync.

minimum_amount class-attribute instance-attribute ¤

minimum_amount: int = 0

Minimum amount to be considered an insider.

polar_beneficiaries class-attribute instance-attribute ¤

polar_beneficiaries: dict[str, list[str]] = field(
    default_factory=dict
)

Beneficiaries of Polar sponsors.

polar_sponsored_account class-attribute instance-attribute ¤

polar_sponsored_account: str = ''

The sponsored account on Polar.

polar_token class-attribute instance-attribute ¤

polar_token: str = ''

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

__call__ ¤

__call__() -> int

Run the command.

Returns:

  • int

    Return code.

Config dataclass ¤

Config(
    *,
    backlog_namespaces: list[str] | Unset = config_field(
        "backlog.namespaces"
    ),
    backlog_sort: list[Callable] | Unset = config_field(
        "backlog.sort", transform="_eval_sort"
    ),
    backlog_limit: int | Unset = config_field(
        "backlog.limit"
    ),
    backlog_issue_labels: dict[str, str]
    | Unset = config_field("backlog.issue-labels"),
    backlog_github_token_command: str
    | Unset = config_field("backlog.github-token-command"),
    backlog_polar_token_command: str | Unset = config_field(
        "backlog.polar-token-command"
    ),
    index_url: str | Unset = config_field("index.url"),
    index_start_in_background: bool | Unset = config_field(
        "index.start-in-background"
    ),
    index_distributions_directory: str
    | Unset = config_field("index.distributions-directory"),
    index_sources_directory: str | Unset = config_field(
        "index.sources-directory"
    ),
    index_log_path: str | Unset = config_field(
        "index.log-path"
    ),
    project_github_username: str | Unset = config_field(
        "project.github-username"
    ),
    project_namespace: str | Unset = config_field(
        "project.namespace"
    ),
    project_insiders_namespace: str | Unset = config_field(
        "project.insiders-namespace"
    ),
    project_directory: str | Unset = config_field(
        "project.directory"
    ),
    project_insiders_directory: str | Unset = config_field(
        "project.insiders-directory"
    ),
    project_register_on_pypi: bool | Unset = config_field(
        "project.register-on-pypi"
    ),
    project_pypi_username: str | Unset = config_field(
        "project.pypi-username"
    ),
    project_post_creation_command: str
    | list[str]
    | Unset = config_field("project.post-creation-command"),
    project_copier_template: str | Unset = config_field(
        "project.copier-template"
    ),
    project_copier_template_answers: dict[str, str]
    | Unset = config_field(
        "project.copier-template-answers"
    ),
    sponsors_minimum_amount: int | Unset = config_field(
        "sponsors.minimum-amount"
    ),
    sponsors_github_sponsored_account: str
    | Unset = config_field(
        "sponsors.github-sponsored-account"
    ),
    sponsors_github_token_command: str
    | Unset = config_field("sponsors.github-token-command"),
    sponsors_github_beneficiaries: dict[str, set[str]]
    | Unset = config_field("sponsors.github-beneficiaries"),
    sponsors_polar_sponsored_account: str
    | Unset = config_field(
        "sponsors.polar-sponsored-account"
    ),
    sponsors_polar_token_command: str
    | Unset = config_field("sponsors.polar-token-command"),
    sponsors_polar_beneficiaries: dict[str, set[str]]
    | Unset = config_field("sponsors.polar-beneficiaries"),
    sponsors_insiders_team: str | Unset = config_field(
        "sponsors.insiders-team"
    ),
    sponsors_include_users: set[str] | Unset = config_field(
        "sponsors.include-users"
    ),
    sponsors_exclude_users: set[str] | Unset = config_field(
        "sponsors.exclude-users"
    ),
)

Configuration for the insiders project.

Methods:

Attributes:

backlog_github_token property ¤

backlog_github_token: str | Unset

Get the GitHub token for backlog operations.

backlog_github_token_command class-attribute instance-attribute ¤

backlog_github_token_command: str | Unset = config_field(
    "backlog.github-token-command"
)

Command to obtain a GitHub token for the backlog.

backlog_issue_labels class-attribute instance-attribute ¤

backlog_issue_labels: dict[str, str] | Unset = config_field(
    "backlog.issue-labels"
)

Map of label names to their display value (emojis, typically).

backlog_limit class-attribute instance-attribute ¤

backlog_limit: int | Unset = config_field('backlog.limit')

Limit the number of displayed issues.

backlog_namespaces class-attribute instance-attribute ¤

backlog_namespaces: list[str] | Unset = config_field(
    "backlog.namespaces"
)

GitHub namespaces to fetch issues from.

backlog_polar_token property ¤

backlog_polar_token: str | Unset

Get the Polar token for backlog operations.

backlog_polar_token_command class-attribute instance-attribute ¤

backlog_polar_token_command: str | Unset = config_field(
    "backlog.polar-token-command"
)

Command to obtain a Polar token for the backlog.

backlog_sort class-attribute instance-attribute ¤

backlog_sort: list[Callable] | Unset = config_field(
    "backlog.sort", transform="_eval_sort"
)

Sort strategies to apply to the backlog.

index_distributions_directory class-attribute instance-attribute ¤

index_distributions_directory: str | Unset = config_field(
    "index.distributions-directory"
)

Directory to store generated Python project distributions.

index_log_path class-attribute instance-attribute ¤

index_log_path: str | Unset = config_field("index.log-path")

Where to write the index server logs to.

index_sources_directory class-attribute instance-attribute ¤

index_sources_directory: str | Unset = config_field(
    "index.sources-directory"
)

Directory to store project sources (cloned repositories).

index_start_in_background class-attribute instance-attribute ¤

index_start_in_background: bool | Unset = config_field(
    "index.start-in-background"
)

Whether to start the index server in the background.

index_url class-attribute instance-attribute ¤

index_url: str | Unset = config_field('index.url')

URL of the index server.

project_copier_template class-attribute instance-attribute ¤

project_copier_template: str | Unset = config_field(
    "project.copier-template"
)

Copier template to generate new projects with.

project_copier_template_answers class-attribute instance-attribute ¤

project_copier_template_answers: dict[str, str] | Unset = (
    config_field("project.copier-template-answers")
)

Copier template answers to use when generating a project.

project_directory class-attribute instance-attribute ¤

project_directory: str | Unset = config_field(
    "project.directory"
)

Directory in which to clone created public projects.

project_github_username class-attribute instance-attribute ¤

project_github_username: str | Unset = config_field(
    "project.github-username"
)

GitHub username to use for operations.

project_insiders_directory class-attribute instance-attribute ¤

project_insiders_directory: str | Unset = config_field(
    "project.insiders-directory"
)

Directory in which to clone created private projects.

project_insiders_namespace class-attribute instance-attribute ¤

project_insiders_namespace: str | Unset = config_field(
    "project.insiders-namespace"
)

GitHub namespace to create insiders projects in.

project_namespace class-attribute instance-attribute ¤

project_namespace: str | Unset = config_field(
    "project.namespace"
)

GitHub namespace to create public projects in.

project_post_creation_command class-attribute instance-attribute ¤

project_post_creation_command: str | list[str] | Unset = (
    config_field("project.post-creation-command")
)

Command to run after creating a project.

project_pypi_username class-attribute instance-attribute ¤

project_pypi_username: str | Unset = config_field(
    "project.pypi-username"
)

PyPI username to use when registering projects on PyPI.

project_register_on_pypi class-attribute instance-attribute ¤

project_register_on_pypi: bool | Unset = config_field(
    "project.register-on-pypi"
)

Whether to register new projects on PyPI after creating them.

sponsors_exclude_users class-attribute instance-attribute ¤

sponsors_exclude_users: set[str] | Unset = config_field(
    "sponsors.exclude-users"
)

GitHub users to never include in the insiders team (even sponsors).

sponsors_github_beneficiaries class-attribute instance-attribute ¤

sponsors_github_beneficiaries: (
    dict[str, set[str]] | Unset
) = config_field("sponsors.github-beneficiaries")

Map of GitHub sponsors to their beneficiaries.

sponsors_github_sponsored_account class-attribute instance-attribute ¤

sponsors_github_sponsored_account: str | Unset = (
    config_field("sponsors.github-sponsored-account")
)

GitHub account receiving sponsorships.

sponsors_github_token property ¤

sponsors_github_token: str | Unset

Get the GitHub token for sponsors operations.

sponsors_github_token_command class-attribute instance-attribute ¤

sponsors_github_token_command: str | Unset = config_field(
    "sponsors.github-token-command"
)

Command to obtain a GitHub token.

sponsors_include_users class-attribute instance-attribute ¤

sponsors_include_users: set[str] | Unset = config_field(
    "sponsors.include-users"
)

GitHub users to always include in the insiders team (even non-sponsors).

sponsors_insiders_team class-attribute instance-attribute ¤

sponsors_insiders_team: str | Unset = config_field(
    "sponsors.insiders-team"
)

GitHub team to add insiders to.

sponsors_minimum_amount class-attribute instance-attribute ¤

sponsors_minimum_amount: int | Unset = config_field(
    "sponsors.minimum-amount"
)

Minimum sponsorship amount to be considered an insider.

sponsors_polar_beneficiaries class-attribute instance-attribute ¤

sponsors_polar_beneficiaries: (
    dict[str, set[str]] | Unset
) = config_field("sponsors.polar-beneficiaries")

Map of Polar sponsors to their beneficiaries.

sponsors_polar_sponsored_account class-attribute instance-attribute ¤

sponsors_polar_sponsored_account: str | Unset = (
    config_field("sponsors.polar-sponsored-account")
)

Polar account receiving sponsorships.

sponsors_polar_token property ¤

sponsors_polar_token: str | Unset

Get the Polar token for sponsors operations.

sponsors_polar_token_command class-attribute instance-attribute ¤

sponsors_polar_token_command: str | Unset = config_field(
    "sponsors.polar-token-command"
)

Command to obtain a Polar token for the sponsors.

from_default_location classmethod ¤

from_default_location() -> Config

Load configuration from the default location.

from_file classmethod ¤

from_file(path: str | Path) -> Config

Load configuration from a file.

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:

Attributes:

http_client instance-attribute ¤

http_client: Client = Client(
    base_url="https://api.github.com",
    headers={"Authorization": f"Bearer {token}"},
)

HTTP client.

name class-attribute instance-attribute ¤

name: str = 'GitHub'

The name of the client.

consolidate_beneficiaries ¤

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

Consolidate beneficiaries from sponsors data.

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,
) -> dict[tuple[str, str], Issue]

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:

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.

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.

Methods:

  • add

    Add a repository to the index.

  • exists

    Tell if a package version exists.

  • latest

    Get the latest version of a package.

  • list_distributions

    List the distributions in the index.

  • list_projects

    List the projects in the index.

  • logs

    Return the logs file path.

  • remove

    Remove a repository from the index.

  • 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.

Attributes:

  • dist_dir (Path) –

    The directory in which to store the distributions.

  • git_dir (Path) –

    The directory in which to clone the repositories.

  • port (int) –

    The port of the index server.

  • url (str) –

    The URL of the index.

dist_dir instance-attribute ¤

dist_dir: Path = dist_dir

The directory in which to store the distributions.

git_dir instance-attribute ¤

git_dir: Path = git_dir

The directory in which to clone the repositories.

port instance-attribute ¤

port: int = port or 80

The port of the index server.

url instance-attribute ¤

url: str = url

The URL of the index.

add ¤

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

Add a repository to the index.

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.

list_distributions ¤

list_distributions() -> Iterator[Path]

List the distributions in the index.

list_projects ¤

list_projects() -> Iterator[Path]

List the projects in the index.

logs ¤

logs() -> str

Return the logs file path.

remove ¤

remove(repo: str) -> None

Remove a repository from the index.

start ¤

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

Start the server.

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.

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(),
)

An issue.

Attributes:

author instance-attribute ¤

author: Account

The issue author.

created instance-attribute ¤

created: datetime

The issue creation date.

funding property ¤

funding: int

Total funding for the issue.

interested_users property ¤

interested_users: set[Account]

Author and upvoters.

labels class-attribute instance-attribute ¤

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

The issue labels.

number instance-attribute ¤

number: int

The issue number.

repository instance-attribute ¤

repository: str

The issue repository.

sponsorships property ¤

sponsorships: set[Sponsorship]

Sponsorships associated with the issue.

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:

Attributes:

http_client instance-attribute ¤

http_client: Client = Client(
    base_url="https://api.polar.sh",
    headers={
        "Accept": "application/json",
        "Authorization": f"Bearer {token}",
    },
)

HTTP client.

name class-attribute instance-attribute ¤

name: str = 'Polar'

Client name.

get_sponsors ¤

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

Get Polar sponsorships.

Returns:

Sponsors dataclass ¤

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

Wrapper class for sponsorships.

Methods:

  • __add__

    Combine two Sponsors instances into a new one.

  • __iadd__

    Merge a second Sponsors instance into the current one.

  • merge

    Merge a second Sponsors instance into the current one.

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.

__add__ ¤

__add__(other: Sponsors) -> Sponsors

Combine two Sponsors instances into a new one.

__iadd__ ¤

__iadd__(other: Sponsors) -> Self

Merge a second Sponsors instance into the current one.

merge ¤

merge(other: Sponsors) -> Self

Merge a second Sponsors instance into the current one.

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

Unset ¤

Unset(key: str, transform: str | None = None)

A sentinel value for unset configuration options.

Attributes:

  • key (str) –

    TOML key.

  • name (str) –

    Config variable name.

  • transform (str | None) –

    Name of the method to call to transform the config value.

key instance-attribute ¤

key: str = key

TOML key.

name instance-attribute ¤

name: str = replace('.', '_')

Config variable name.

transform instance-attribute ¤

transform: str | None = transform

Name of the method to call to transform the config value.

config_field ¤

config_field(
    key: str, transform: str | None = None
) -> Unset

Get a dataclass field with a TOML key.

get_backlog ¤

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

Get the backlog.

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.

new_public_and_insiders_github_projects ¤

new_public_and_insiders_github_projects(
    *,
    public_namespace: str,
    public_name: str,
    description: str,
    public_repo_path: str | Path,
    insiders_namespace: str | None = None,
    insiders_name: str | None = None,
    insiders_repo_path: str | Path,
    github_username: str | None = None,
    copier_template: str | None = None,
    copier_template_answers: dict[str, Any] | None = None,
    post_creation_command: str | list[str] | None = None,
) -> None

Create a new Insiders project on GitHub (public and private repositories).

Parameters:

  • public_namespace (str) –

    Namespace of the public repository.

  • public_name (str) –

    Name of the public repository.

  • description (str) –

    Shared description.

  • public_repo_path (str | Path) –

    Local path in which to clone the public repository.

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

    Namespace of the insiders repository. Defaults to the public namespace.

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

    Name of the insiders repository. Defaults to the public name.

  • insiders_repo_path (str | Path) –

    Local path in which to clone the insiders repository.

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

    Username. Defaults to the public namespace value.

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

    Copier template to initialize the local insiders repository with.

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

    Answers to the Copier template questions.

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

    Command to run after creating the public repository.

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.

print_sponsors ¤

print_sponsors(
    sponsors: Sponsors,
    min_amount: int,
    limit: int = 0,
    *,
    sponsorships: bool = False,
) -> None

Print the sponsors/sponsorships.

Parameters:

  • sponsors (Sponsors) –

    The sponsors to print.

  • min_amount (int) –

    The minimum amount for a sponsor to become an Insiders.

  • limit (int, default: 0 ) –

    The maximum number of issues to print.

  • sponsorships (bool, default: False ) –

    Whether to print the sponsorships as main column.

reserve_pypi ¤

reserve_pypi(
    username: str, name: str, description: str
) -> None

Reserve a name on PyPI.

Parameters:

  • username (str) –

    Username on PyPI.

  • name (str) –

    Name to reserve.

  • description (str) –

    Description of the project on PyPI.

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.