repomatic.init.run moduleΒΆ
Run repomatic init: select the components, then write their files.
Selectors use the same component[/file] syntax as the exclude config option
in [tool.repomatic]. Qualified entries like skills/repomatic-topics select a
single file within a component.
- repomatic.init.run.AWESOME_TEMPLATE_REWRITTEN_SUFFIXES = frozenset({'.md', '.yaml', '.yml'})ΒΆ
Extensions of the awesome-template files whose URLs name the repository.
- repomatic.init.run.AWESOME_TEMPLATE_SLUG = 'kdeldycke/awesome-template'ΒΆ
Source slug embedded in bundled awesome-template files, rewritten at sync time.
- repomatic.init.run.AWESOME_TEMPLATE_URL_RE = re.compile('/kdeldycke/awesome\\-template(?![\\w.-])')ΒΆ
A URL path naming the template repository itself.
The lookahead stops a longer repository name, like
awesome-template-v2, from matching. Whatever else follows the slug matches: a/blob/path, a#readmefragment, or the end of the link.
- repomatic.init.run.TEMPLATE_TREE_SKIPPED = frozenset({'__init__.py', '__pycache__'})ΒΆ
Entries of a bundled tree that make it a package, not part of the template.
- class repomatic.init.run.ReportSection(*values)[source]ΒΆ
Bases:
EnumA section of the
initreport that lists files a run may delete.The value is the name of the
InitResultfield holding the paths.- EXCLUDED = 'excluded_existing'ΒΆ
Files the configuration excludes, still on disk.
- UNMODIFIED = 'unmodified_configs'ΒΆ
Tool configs identical to the bundled defaults.
- REMOVED = 'removed_prunable'ΒΆ
Untouched orphans of assets repomatic no longer ships.
- REMOVED_MODIFIED = 'removed_review'ΒΆ
Orphans of dropped assets, edited since repomatic shipped them.
- property prunes_parents: boolΒΆ
Whether deleting a path also removes the parents it leaves empty.
On for the sections whose targets sit in directories repomatic itself created (
.claude/skills/<name>/). Off for unmodified tool configs, which share.github/and the repository root with files repomatic does not own.
- class repomatic.init.run.DeletionPolicy(delete_excluded=False, delete_unmodified=False, keep_removed=False, delete_removed_modified=False)[source]ΒΆ
Bases:
objectWhich
ReportSectionaninitrun deletes from disk.Each field is named after the
initoption that sets it, which is whatflags()reads back to hand the same policy to a childinit.- delete_removed_modified: bool = FalseΒΆ
Also delete the orphans edited since repomatic shipped them.
- class repomatic.init.run.InitResult(created=<factory>, updated=<factory>, skipped=<factory>, excluded=<factory>, excluded_existing=<factory>, unmodified_configs=<factory>, removed_prunable=<factory>, removed_review=<factory>, warnings=<factory>, previous_pin=None, adopted_pin=None)[source]ΒΆ
Bases:
objectResult of a repository initialization run.
- removed_prunable: list[tuple[str, str]]ΒΆ
(relative_path, successor)for on-disk orphans of dropped assets whose content matches the last-shipped version (safe to auto-delete).
- removed_review: list[tuple[str, str]]ΒΆ
(relative_path, successor)for on-disk orphans of dropped assets that differ from the last-shipped version (locally modified: reported for manual review, never auto-deleted).
- previous_pin: str | None = NoneΒΆ
Bare version of the highest upstream
uses:pin the repository carried before the run, read only when a workflow component was selected.Nonefor a first adoption, or for a run generating no workflow.
- adopted_pin: str | None = NoneΒΆ
Bare version the run wrote its thin callers at, or
Nonewhen the workflow sync was skipped.
- prune(output_dir, policy)[source]ΒΆ
Delete every section of the report policy asks to delete.
- Parameters:
output_dir (
Path) β Repository root the paths are relative to.policy (
DeletionPolicy) β The sections to delete.
- Return type:
- upgraded_pin()[source]ΒΆ
(previous, adopted)when the run moved the upstream pin forward.The pair
initβs closing hint and the upgrade review are keyed on. A first adoption has no previous release to review against, a regeneration at the pinned version moves nothing, and a rollback is a deliberate step back no upgrade review should chase, so all three answerNone.
- repomatic.init.run.run_init(output_dir, components=(), *, config, version=None, cooldown=True, repo='kdeldycke/repomatic', repo_slug=None)[source]ΒΆ
Bootstrap a repository for use with
kdeldycke/repomatic.Creates thin-caller workflow files, exports configuration files, and generates a minimal
changelog.mdif missing. Managed files (workflows, configs, skills) are always overwritten. The user-owned changelog is created once and never overwritten.For
awesome-*repositories, theawesome-templatecomponent joins a bareinitthrough itsAWESOME_ONLYscope.Note
Scope exclusions (
RepoScope.AWESOME_ONLY,PYTHON_ONLY) and user-config exclusions ([tool.repomatic] exclude) only apply during barerepomatic init. When components are explicitly named on the CLI, scope is bypassed: the caller knows what they asked for. This allows workflows to materialize out-of-scope configs at runtime (likerepomatic init publish-pypi-actionin a non-Python repo).- Parameters:
output_dir (
Path) β Root directory of the target repository.components (
Sequence[str]) β Components to initialize. Empty means all defaults. When non-empty, scope and user-config exclusions are bypassed.config (
Config) β The resolved[tool.repomatic]configuration of the target.version (
str|None) β Version pin for upstream workflows (likev5.10.0). WhenNone, derived from the running package version, gated by cooldown.cooldown (
bool) β WhenTrue(and version is unset), hold the derived pin back to the newest release past the [tool.repomatic] minimum-release-age window instead of pinning a fresh running version (seeresolve_default_pin()). Ignored when version is explicit.repo (
str) β Upstream repository containing reusable workflows.repo_slug (
str|None) β Repositoryowner/nameslug, for the awesome-template URL rewriting and the changelog stub. Read fromMetadataon first use when omitted.
- Return type:
- Returns:
Summary of created, updated, skipped, and warned items.