nskit.vcs
Repositories¶
nskit.vcs.repo.Repo
¶
Bases: _Repo
Repo with namespace validator.
Source code in src/nskit/vcs/repo.py
name
instance-attribute
¶
nskit.vcs.repo.NamespaceValidationRepo
¶
Bases: _Repo
Repo for managing namespace validation.
Source code in src/nskit/vcs/repo.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
name = '.namespaces'
class-attribute
instance-attribute
¶
namespaces_filename = 'namespaces.yaml'
class-attribute
instance-attribute
¶
validator
property
¶
Get the namespace validator.
validate_name(proposed_name)
¶
create(*, namespace_options, delimiters=None, repo_separator=None)
¶
Create and populate the validator repo.
Source code in src/nskit/vcs/repo.py
Namespace Validation¶
nskit.vcs.namespace_validator.NamespaceValidator
¶
Bases: BaseConfiguration
Namespace Validator object.
Source code in src/nskit/vcs/namespace_validator.py
options
instance-attribute
¶
repo_separator = REPO_SEPARATOR
class-attribute
instance-attribute
¶
delimiters = _DELIMITERS
class-attribute
instance-attribute
¶
validate_name(proposed_name)
¶
Validate a proposed name.
Source code in src/nskit/vcs/namespace_validator.py
to_parts(name)
¶
to_repo_name(name)
¶
nskit.vcs.namespace_validator.NamespaceOptionsType = TypeAliasType('NamespaceOptionsType', list[Union[str, dict[str, 'NamespaceOptionsType']]])
module-attribute
¶
nskit.vcs.namespace_validator.ValidationEnum
¶
Installers¶
nskit.vcs.installer.PythonInstaller
¶
Bases: Installer
Python language installer.
Can be enabled or disabled using the boolean flag and environment variables. The virtualenv config can be updated (to a custom dir/path relative to the codebase root)
Source code in src/nskit/vcs/installer.py
check_repo(path)
¶
Check if this is a python repo.
Source code in src/nskit/vcs/installer.py
install(path, *, executable='venv', deps=True)
¶
Install the repo.
executable can override the executable to use (e.g. a virtualenv) deps controls whether dependencies are installed or not.
Source code in src/nskit/vcs/installer.py
Provider Detection¶
nskit.vcs.provider_detection.get_default_repo_client()
¶
Auto-detect and return a configured VCS provider's repo client.
Iterates through registered providers (via the nskit.vcs.providers
entry point) and returns the client for the last one that initialises
successfully from environment variables.
Raises:
| Type | Description |
|---|---|
ValueError
|
If no provider could be configured. |
Source code in src/nskit/vcs/provider_detection.py
Providers¶
nskit.vcs.providers.abstract.RepoClient
¶
Bases: ABC
Repo management client.
Source code in src/nskit/vcs/providers/abstract.py
check_exists(repo_name)
abstractmethod
¶
configure(repo_name, settings=None)
¶
Apply repository-level configuration (e.g. merge options, features).
Default is a no-op so providers that do not support remote configuration
remain valid. Providers should override to apply settings to the repo.
Source code in src/nskit/vcs/providers/abstract.py
create(repo_name)
abstractmethod
¶
create_ruleset(repo_name, ruleset)
¶
Create a ruleset on the repo, returning its ID if the provider gives one.
Default is a no-op so providers without ruleset support remain valid.
Source code in src/nskit/vcs/providers/abstract.py
delete(repo_name)
abstractmethod
¶
delete_ruleset(repo_name, ruleset_id)
¶
get_clone_url(repo_name)
¶
Get the clone URL.
This defaults to the remote url unless specifically implemented.
get_remote_url(repo_name)
abstractmethod
¶
list()
abstractmethod
¶
list_rulesets(repo_name)
¶
set_branch_protection(repo_name, branch, rules=None)
¶
Apply classic branch protection configuration to branch.
Default is a no-op so providers without branch-protection support remain
valid. Providers should override to apply rules to the named branch.
Prefer the ruleset methods below where the provider supports them; rulesets are the successor to classic branch protection.
Source code in src/nskit/vcs/providers/abstract.py
update_ruleset(repo_name, ruleset_id, **changes)
¶
nskit.vcs.providers.abstract.VCSProviderSettings
¶
Bases: ABC, BaseConfiguration
Settings for VCS Provider.
Source code in src/nskit/vcs/providers/abstract.py
nskit.vcs.providers.github.GithubSettings
¶
Bases: VCSProviderSettings
Github settings.
Token resolution order:
- an explicitly provided
token(orGITHUB_TOKENin the environment); - the GitHub CLI (
gh auth token), whenuse_gh_cliis set; - interactive device authentication, when
interactiveis set.
Both fallbacks are opt-in. In particular use_gh_cli defaults to
False: picking up whatever credential happens to be sitting in the
developer's gh login would mean a caller that supplied no token silently
acquires one, which hides misconfiguration and surprises anything that
expects "no token" to mean "no access".
Source code in src/nskit/vcs/providers/github/provider.py
repo_client
property
¶
Get the instantiated repo client.