insiders ¤
insiders package.
Manage your Insiders projects.
Classes:
-
Account
–An account.
-
Backlog
–Backlog of issues.
-
Beneficiary
–A sponsorship beneficiary: a user, grant bit, and optional org.
-
CommandBacklog
–Command to list the backlog of issues.
-
CommandIndex
–Command to manage the local index.
-
CommandIndexAdd
–Command to add a repository to the watched repositories.
-
CommandIndexList
–Command to list the watched repositories.
-
CommandIndexLogs
–Command to show the server logs.
-
CommandIndexRemove
–Command to remove a repository and its distributions (if served locally).
-
CommandIndexStart
–Command to start the server.
-
CommandIndexStatus
–Command to show the server status.
-
CommandIndexStop
–Command to stop the server.
-
CommandIndexUpdate
–Command to update watched projects.
-
CommandMain
–Command to manage your Insiders projects.
-
CommandProject
–Command to manage projects on GitHub and locally.
-
CommandProjectCheck
–Command to check GitHub projects.
-
CommandProjectCreate
–Command to create public/insiders repositories.
-
CommandProjectPyPIRegister
–Command to register a project name on PyPI.
-
CommandSponsors
–Command to manage sponsors.
-
CommandSponsorsList
–Command to list sponsors.
-
CommandSponsorsShow
–Command to show details about a sponsor/user.
-
CommandSponsorsTeamList
–Command to list team memberships.
-
CommandSponsorsTeamSync
–Command to sync team memberships with current sponsors.
-
Config
–Configuration for the insiders project.
-
GitHub
–GitHub client.
-
Index
–Index of repositories.
-
Issue
–An issue.
-
Polar
–Polar client.
-
Sponsors
–Wrapper class for sponsorships.
-
Sponsorship
–A sponsorship.
-
Unset
–A sentinel value for unset configuration options.
Functions:
-
config_field
–Get a dataclass field with a TOML key.
-
get_backlog
–Get the backlog.
-
main
–Run the main program.
-
new_public_and_insiders_github_projects
–Create a new Insiders project on GitHub (public and private repositories).
-
print_backlog
–Print the backlog.
-
print_sponsors
–Print the sponsors/sponsorships.
-
reserve_pypi
–Reserve a name on PyPI.
-
update_numbers_file
–Update the file storing sponsorship numbers.
-
update_sponsors_file
–Update the file storing sponsors info.
Attributes:
-
DEFAULT_CONF_DIR
(Path
) –The default configuration directory.
-
DEFAULT_CONF_PATH
(Path
) –The default configuration file path.
-
DEFAULT_DIST_DIR
(Path
) –The default index distributions directory
-
DEFAULT_INDEX_URL
(str
) –The default index URL.
-
DEFAULT_PORT
(int
) –The default index port.
-
DEFAULT_REPO_DIR
(Path
) –The default Git repository (clones) cache directory.
-
SponsorshipPlatform
(TypeAlias
) –The supported sponsorship platforms.
DEFAULT_CONF_DIR module-attribute
¤
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
¤
The default index distributions directory
DEFAULT_INDEX_URL module-attribute
¤
DEFAULT_INDEX_URL: str = f'http://localhost:{DEFAULT_PORT}'
The default index URL.
DEFAULT_REPO_DIR module-attribute
¤
The default Git repository (clones) cache directory.
SponsorshipPlatform module-attribute
¤
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
(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.
excluded class-attribute
instance-attribute
¤
excluded: bool = False
Indicates if the account is excluded from the sponsors list.
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.
sponsorships class-attribute
instance-attribute
¤
sponsorships: list[Sponsorship] = field(
default_factory=list
)
List of sponsorships associated with the account
Backlog dataclass
¤
Backlog of issues.
Classes:
Methods:
-
sort
–Sort the backlog.
Attributes:
issues class-attribute
instance-attribute
¤
A list of issues.
SortStrategy ¤
Methods:
-
author_sponsorships
–Sort by author sponsorships.
-
created
–Sort by creation date.
-
label
–Sort by label presence.
-
min_author_sponsorships
–Sort by minimum author sponsorships.
-
min_sponsorships
–Sort by minimum sponsorships.
-
min_upvoters_sponsorships
–Sort by minimum upvoters sponsorships.
-
min_upvotes
–Sort by minimum upvotes.
-
repository
–Sort by repository.
-
sponsorships
–Sort by sponsorships.
-
upvoters_sponsorships
–Sort by upvoters sponsorships.
-
upvotes
–Sort by upvotes.
author_sponsorships staticmethod
¤
created staticmethod
¤
label staticmethod
¤
min_author_sponsorships staticmethod
¤
min_sponsorships staticmethod
¤
min_upvoters_sponsorships staticmethod
¤
min_upvotes staticmethod
¤
repository staticmethod
¤
sponsorships staticmethod
¤
upvoters_sponsorships staticmethod
¤
Beneficiary dataclass
¤
A sponsorship beneficiary: a user, grant bit, and optional org.
Attributes:
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:
-
__call__
–Run the command.
Attributes:
-
backlog_namespaces
(list[str]
) –Namespaces to fetch issues from.
-
github_beneficiaries
(dict[str, list[str]]
) –Beneficiaries of GitHub sponsors.
-
github_token
(str
) –A GitHub token. Recommended scopes:
read:user
. -
issue_labels
(dict[str, str]
) –Issue labels to keep in issues metadata, and how they are represented.
-
limit
(int
) –Limit the number of issues to display.
-
polar_beneficiaries
(dict[str, list[str]]
) –Beneficiaries of Polar sponsors.
-
polar_token
(str
) –A Polar token. Recommended scopes:
user:read
,issues:read
,subscriptions:read
. -
public
(bool
) –Only use public sponsorships.
-
sort
(list[Callable]
) –Sort strategy.
backlog_namespaces instance-attribute
¤
Namespaces to fetch issues from.
github_beneficiaries class-attribute
instance-attribute
¤
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 to keep in issues metadata, and how they are represented.
polar_beneficiaries class-attribute
instance-attribute
¤
Beneficiaries of Polar sponsors.
polar_token class-attribute
instance-attribute
¤
polar_token: str = ''
A Polar token. Recommended scopes: user:read
, issues:read
, subscriptions:read
.
sort class-attribute
instance-attribute
¤
Sort strategy.
CommandIndex dataclass
¤
CommandIndex(
*,
subcommand: CommandIndexList
| CommandIndexAdd
| CommandIndexRemove
| CommandIndexUpdate
| CommandIndexStart
| CommandIndexStatus
| CommandIndexStop
| CommandIndexLogs,
)
Command to manage the local index.
Attributes:
-
subcommand
(CommandIndexList | CommandIndexAdd | CommandIndexRemove | CommandIndexUpdate | CommandIndexStart | CommandIndexStatus | CommandIndexStop | CommandIndexLogs
) –The selected subcommand.
subcommand instance-attribute
¤
subcommand: (
CommandIndexList
| CommandIndexAdd
| CommandIndexRemove
| CommandIndexUpdate
| CommandIndexStart
| CommandIndexStatus
| CommandIndexStop
| CommandIndexLogs
)
The selected subcommand.
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:
-
__call__
–Run the command.
Attributes:
-
distributions_directory
(Path
) –Directory where the distributions are stored.
-
repositories
(list[str]
) –List of repositories (GitHub namespace/project or Git URL git@host:repo).
-
sources_directory
(Path
) –Directory where the sources are stored.
-
url
(str
) –URL of the index to upload packages to.
distributions_directory class-attribute
instance-attribute
¤
distributions_directory: Path = DEFAULT_DIST_DIR
Directory where the distributions are stored.
repositories instance-attribute
¤
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: str = DEFAULT_INDEX_URL
URL of the index to upload packages to.
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:
-
__call__
–Run the command.
Attributes:
-
distributions_directory
(Path
) –Directory where the distributions are stored.
-
dists
(bool
) –List distributions.
-
projects
(bool
) –List projects.
-
sources_directory
(Path
) –Directory where the sources are stored.
distributions_directory class-attribute
instance-attribute
¤
distributions_directory: Path = DEFAULT_DIST_DIR
Directory where the distributions are stored.
sources_directory class-attribute
instance-attribute
¤
sources_directory: Path = DEFAULT_REPO_DIR
Directory where the sources are stored.
CommandIndexLogs dataclass
¤
CommandIndexLogs()
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:
-
__call__
–Run the command.
Attributes:
-
distributions_directory
(Path
) –Directory where the distributions are stored.
-
repositories
(list[str]
) –List of repository names.
-
sources_directory
(Path
) –Directory where the sources are stored.
distributions_directory class-attribute
instance-attribute
¤
distributions_directory: Path = DEFAULT_DIST_DIR
Directory where the distributions are stored.
sources_directory class-attribute
instance-attribute
¤
sources_directory: Path = DEFAULT_REPO_DIR
Directory where the sources are stored.
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:
-
__call__
–Run the command.
Attributes:
-
background
(bool
) –Run the server in the background.
-
distributions_directory
(Path
) –Directory where the distributions are stored.
-
log_path
(str | None
) –Where to write index server logs.
-
sources_directory
(Path
) –Directory where the sources are stored.
-
url
(str
) –URL to serve the index at.
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.
CommandIndexStatus dataclass
¤
CommandIndexStatus()
CommandIndexStop dataclass
¤
CommandIndexStop()
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:
-
__call__
–Run the command.
Attributes:
-
distributions_directory
(Path
) –Directory where the distributions are stored.
-
repositories
(list[str]
) –List of repository names.
-
sources_directory
(Path
) –Directory where the sources are stored.
-
url
(str
) –URL of the index to upload packages to.
distributions_directory class-attribute
instance-attribute
¤
distributions_directory: Path = DEFAULT_DIST_DIR
Directory where the distributions are stored.
repositories class-attribute
instance-attribute
¤
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: str = DEFAULT_INDEX_URL
URL of the index to upload packages to.
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
(Config
) –Path to the configuration file.
-
debug_info
(bool
) –Print debug information.
-
log_downgrade
(tuple[str, ...]
) –Downgrade INFO logs to DEBUG for logs originating from these modules/loggers. By default, all dependency logs are downgraded.
-
log_exclude
(tuple[str, ...]
) –Exclude logs originating from these modules/loggers. Applied after inclusion. By default, nothing is excluded.
-
log_include
(tuple[str, ...]
) –Include logs originating from these modules/loggers. By default, all logs are included.
-
log_level
(Literal['TRACE', 'DEBUG', 'INFO', 'SUCCESS', 'WARNING', 'ERROR', 'CRITICAL']
) –Lowest log level to display. Levels below that will be hidden.
-
log_path
(str | None
) –Write log messages to this file path.
-
subcommand
(CommandBacklog | CommandIndex | CommandProject | CommandSponsors
) –The selected subcommand.
-
version
(bool
) –Print the program version and exit.
config class-attribute
instance-attribute
¤
Path to the configuration file.
log_downgrade class-attribute
instance-attribute
¤
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
¤
Exclude logs originating from these modules/loggers. Applied after inclusion. By default, nothing is excluded.
log_include class-attribute
instance-attribute
¤
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
¤
subcommand: (
CommandBacklog
| CommandIndex
| CommandProject
| CommandSponsors
)
The selected subcommand.
CommandProject dataclass
¤
CommandProject(
*,
subcommand: CommandProjectCreate
| CommandProjectCheck
| CommandProjectPyPIRegister,
)
Command to manage projects on GitHub and locally.
Attributes:
-
subcommand
(CommandProjectCreate | CommandProjectCheck | CommandProjectPyPIRegister
) –The selected subcommand.
subcommand instance-attribute
¤
subcommand: (
CommandProjectCreate
| CommandProjectCheck
| CommandProjectPyPIRegister
)
The selected subcommand.
CommandProjectCheck dataclass
¤
CommandProjectCheck()
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:
-
__call__
–Run the command.
Attributes:
-
copier_template
(str | None
) –Copier template to generate new projects with.
-
copier_template_answers
(dict[str, str] | None
) –Copier template answers to use when generating a project.
-
description
(str
) –Shared description.
-
github_username
(str | None
) –GitHub username.
-
insiders_namespace
(str | None
) –Namespace of the insiders repository.
-
insiders_project_directory
(Path
) –Directory in which to clone the insiders repository.
-
insiders_repository
(str | None
) –Name of the insiders repository.
-
namespace
(str
) –Namespace of the public repository.
-
post_creation_command
(list[str] | None
) –Command to run after creating the public repository.
-
project_directory
(Path
) –Directory in which to clone the public repository.
-
pypi_username
(str | None
) –PyPI username to register the project with.
-
register_on_pypi
(bool
) –Whether to register the project on PyPI after creating it.
-
repository
(str
) –Name of the public repository.
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 to use when generating a project.
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.
post_creation_command class-attribute
instance-attribute
¤
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.
CommandProjectPyPIRegister dataclass
¤
CommandSponsors dataclass
¤
CommandSponsors(
*,
subcommand: CommandSponsorsList
| CommandSponsorsShow
| CommandSponsorsTeamList
| CommandSponsorsTeamSync,
)
Command to manage sponsors.
Attributes:
-
subcommand
(CommandSponsorsList | CommandSponsorsShow | CommandSponsorsTeamList | CommandSponsorsTeamSync
) –The selected subcommand.
subcommand instance-attribute
¤
subcommand: (
CommandSponsorsList
| CommandSponsorsShow
| CommandSponsorsTeamList
| CommandSponsorsTeamSync
)
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:
-
__call__
–Run the command.
Attributes:
-
exclude_users
(list[str]
) –Users that should never be in the team.
-
github_beneficiaries
(dict[str, list[str]]
) –Beneficiaries of GitHub sponsors.
-
github_sponsored_account
(str
) –The sponsored account on GitHub Sponsors.
-
github_token
(str
) –A GitHub token. Recommended scopes:
admin:org
andread:user
. -
include_users
(list[str]
) –Users that should always be in the team.
-
minimum_amount
(int
) –Minimum amount to be considered an insider.
-
polar_beneficiaries
(dict[str, list[str]]
) –Beneficiaries of Polar sponsors.
-
polar_sponsored_account
(str
) –The sponsored account on Polar.
-
polar_token
(str
) –A Polar token. Recommended scopes:
user:read
,issues:read
,subscriptions:read
. -
public
(bool
) –Only use public sponsorships.
-
sponsorships
(bool
) –List sponsorships rather than users/sponsors.
exclude_users class-attribute
instance-attribute
¤
Users that should never be in the team.
github_beneficiaries class-attribute
instance-attribute
¤
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
¤
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
¤
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
.
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:
-
__call__
–Run the command.
Attributes:
-
dry_run
(bool
) –Display the changes that would be made, without making them.
-
exclude_users
(list[str]
) –Users that should never be in the team.
-
github_beneficiaries
(dict[str, list[str]]
) –A mapping of users belonging to sponsoring organizations.
-
github_sponsored_account
(str
) –The sponsored account on GitHub Sponsors.
-
github_token
(str
) –A GitHub token. Recommended scopes:
admin:org
andread:user
. -
include_users
(list[str]
) –Users that should always be in the team.
-
insiders_team
(str
) –The GitHub team to sync.
-
minimum_amount
(int
) –Minimum amount to be considered an insider.
-
polar_sponsored_account
(str
) –The sponsored account on Polar.
-
polar_token
(str
) –A Polar token. Recommended scopes:
user:read
,issues:read
,subscriptions:read
.
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
¤
Users that should never be in the team.
github_beneficiaries class-attribute
instance-attribute
¤
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
¤
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_sponsored_account class-attribute
instance-attribute
¤
polar_sponsored_account: str = ''
The sponsored account on Polar.
CommandSponsorsTeamList dataclass
¤
CommandSponsorsTeamList()
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:
-
__call__
–Run the command.
Attributes:
-
dry_run
(bool
) –Display the changes that would be made, without making them.
-
exclude_users
(list[str]
) –Users that should never be in the team.
-
github_beneficiaries
(dict[str, list[str]]
) –A mapping of users belonging to sponsoring organizations.
-
github_sponsored_account
(str
) –The sponsored account on GitHub Sponsors.
-
github_token
(str
) –A GitHub token. Recommended scopes:
admin:org
andread:user
. -
include_users
(list[str]
) –Users that should always be in the team.
-
insiders_team
(str
) –The GitHub team to sync.
-
minimum_amount
(int
) –Minimum amount to be considered an insider.
-
polar_beneficiaries
(dict[str, list[str]]
) –Beneficiaries of Polar sponsors.
-
polar_sponsored_account
(str
) –The sponsored account on Polar.
-
polar_token
(str
) –A Polar token. Recommended scopes:
user:read
,issues:read
,subscriptions:read
.
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
¤
Users that should never be in the team.
github_beneficiaries class-attribute
instance-attribute
¤
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
¤
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
¤
Beneficiaries of Polar sponsors.
polar_sponsored_account class-attribute
instance-attribute
¤
polar_sponsored_account: str = ''
The sponsored account on Polar.
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:
-
from_default_location
–Load configuration from the default location.
-
from_file
–Load configuration from a file.
Attributes:
-
backlog_github_token
(str | Unset
) –Get the GitHub token for backlog operations.
-
backlog_github_token_command
(str | Unset
) –Command to obtain a GitHub token for the backlog.
-
backlog_issue_labels
(dict[str, str] | Unset
) –Map of label names to their display value (emojis, typically).
-
backlog_limit
(int | Unset
) –Limit the number of displayed issues.
-
backlog_namespaces
(list[str] | Unset
) –GitHub namespaces to fetch issues from.
-
backlog_polar_token
(str | Unset
) –Get the Polar token for backlog operations.
-
backlog_polar_token_command
(str | Unset
) –Command to obtain a Polar token for the backlog.
-
backlog_sort
(list[Callable] | Unset
) –Sort strategies to apply to the backlog.
-
index_distributions_directory
(str | Unset
) –Directory to store generated Python project distributions.
-
index_log_path
(str | Unset
) –Where to write the index server logs to.
-
index_sources_directory
(str | Unset
) –Directory to store project sources (cloned repositories).
-
index_start_in_background
(bool | Unset
) –Whether to start the index server in the background.
-
index_url
(str | Unset
) –URL of the index server.
-
project_copier_template
(str | Unset
) –Copier template to generate new projects with.
-
project_copier_template_answers
(dict[str, str] | Unset
) –Copier template answers to use when generating a project.
-
project_directory
(str | Unset
) –Directory in which to clone created public projects.
-
project_github_username
(str | Unset
) –GitHub username to use for operations.
-
project_insiders_directory
(str | Unset
) –Directory in which to clone created private projects.
-
project_insiders_namespace
(str | Unset
) –GitHub namespace to create insiders projects in.
-
project_namespace
(str | Unset
) –GitHub namespace to create public projects in.
-
project_post_creation_command
(str | list[str] | Unset
) –Command to run after creating a project.
-
project_pypi_username
(str | Unset
) –PyPI username to use when registering projects on PyPI.
-
project_register_on_pypi
(bool | Unset
) –Whether to register new projects on PyPI after creating them.
-
sponsors_exclude_users
(set[str] | Unset
) –GitHub users to never include in the insiders team (even sponsors).
-
sponsors_github_beneficiaries
(dict[str, set[str]] | Unset
) –Map of GitHub sponsors to their beneficiaries.
-
sponsors_github_sponsored_account
(str | Unset
) –GitHub account receiving sponsorships.
-
sponsors_github_token
(str | Unset
) –Get the GitHub token for sponsors operations.
-
sponsors_github_token_command
(str | Unset
) –Command to obtain a GitHub token.
-
sponsors_include_users
(set[str] | Unset
) –GitHub users to always include in the insiders team (even non-sponsors).
-
sponsors_insiders_team
(str | Unset
) –GitHub team to add insiders to.
-
sponsors_minimum_amount
(int | Unset
) –Minimum sponsorship amount to be considered an insider.
-
sponsors_polar_beneficiaries
(dict[str, set[str]] | Unset
) –Map of Polar sponsors to their beneficiaries.
-
sponsors_polar_sponsored_account
(str | Unset
) –Polar account receiving sponsorships.
-
sponsors_polar_token
(str | Unset
) –Get the Polar token for sponsors operations.
-
sponsors_polar_token_command
(str | Unset
) –Command to obtain a Polar token for the sponsors.
backlog_github_token property
¤
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
¤
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"
)
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"
)
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_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
¤
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
¤
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.
GitHub ¤
GitHub(token: str)
Bases: _Client
GitHub client.
Initialize GitHub API client.
Parameters:
-
token
(str
) –A GitHub token. Recommended scopes:
admin:org
andread:user
.
Methods:
-
consolidate_beneficiaries
–Consolidate beneficiaries from sponsors data.
-
create_repo
–Create a repository.
-
get_failed_invites
– -
get_issues
–Get issues from GitHub.
-
get_org_members
–Get organization members (username only).
-
get_sponsors
–Get GitHub sponsors.
-
get_team_invites
–Get pending invitations to a GitHub team.
-
get_team_members
–Get members of a GitHub team.
-
grant_access
–Grant access to a user to a GitHub team.
-
is_org
–Check if an account is an organization.
-
revoke_access
–Revoke access from a user to a GitHub team.
-
sync_team
–Sync sponsors with members of a GitHub team.
Attributes:
-
http_client
(Client
) –HTTP client.
-
name
(str
) –The name of the client.
http_client instance-attribute
¤
http_client: Client = Client(
base_url="https://api.github.com",
headers={"Authorization": f"Bearer {token}"},
)
HTTP client.
consolidate_beneficiaries ¤
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_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_org_members ¤
get_sponsors ¤
get_team_invites ¤
get_team_members ¤
grant_access ¤
is_org ¤
revoke_access ¤
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.
exists ¤
latest ¤
status ¤
status() -> dict | None
Return the server status as a dict of metadata.
Returns:
-
dict | None
–Some metadata about the server process.
update ¤
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.
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
(Account
) –The issue author.
-
created
(datetime
) –The issue creation date.
-
funding
(int
) –Total funding for the issue.
-
interested_users
(set[Account]
) –Author and upvoters.
-
labels
(set[str]
) –The issue labels.
-
number
(int
) –The issue number.
-
repository
(str
) –The issue repository.
-
sponsorships
(set[Sponsorship]
) –Sponsorships associated with the issue.
-
title
(str
) –The issue title.
-
upvotes
(set[Account]
) –The issue upvotes / upvoters.
labels class-attribute
instance-attribute
¤
The issue labels.
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_sponsors
–Get Polar sponsorships.
Attributes:
-
http_client
(Client
) –HTTP client.
-
name
(str
) –Client name.
http_client instance-attribute
¤
http_client: Client = Client(
base_url="https://api.polar.sh",
headers={
"Accept": "application/json",
"Authorization": f"Bearer {token}",
},
)
HTTP client.
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
(set[Account]
) –Set of accounts who created sponsorships.
-
beneficiaries
(dict[str, Beneficiary]
) –Beneficiaries of all sponsorships.
-
sponsorships
(list[Sponsorship]
) –Sponsorships.
sponsorships class-attribute
instance-attribute
¤
sponsorships: list[Sponsorship] = field(
default_factory=list
)
Sponsorships.
Sponsorship dataclass
¤
Sponsorship(
*,
private: bool = True,
created: datetime,
amount: int,
account: Account,
beneficiaries: dict[str, Beneficiary] = dict(),
)
A sponsorship.
Attributes:
Unset ¤
A sentinel value for unset configuration options.
Attributes:
config_field ¤
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 ¤
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_sponsors ¤
print_sponsors(
sponsors: Sponsors,
min_amount: int,
limit: int = 0,
*,
sponsorships: bool = False,
) -> None
Print the sponsors/sponsorships.
Parameters:
reserve_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.