On this page
Base class for release targets providing shared defaults for version reading, writing, detection, scaffolding, and publish configuration.
#rlsbl.targets.base
#rlsbl.targets.base
Base class for release targets providing shared defaults for version reading, writing, detection, scaffolding, and publish configuration.
#TemplateVars
Dict subclass that auto-generates namespaced {target}.{key} entries.
On construction, for every key in base_dict, an additional entry "{target_name}.{key}" is stored so templates can reference target-specific values like {{pypi.minRequiredPython}}.
Post-construction mutations (tv["newkey"] = val) produce bare-only keys -- this is correct for non-target-specific additions like year or repoName that callers add after the target returns its vars.
#BaseTarget
Concrete base providing defaults for optional Protocol methods.
Subclasses should override detection_files with the filenames whose existence in a directory indicates a project of that type. The tuple is used both by the target's own detect() method and by checks.PROJECT_MANIFESTS (derived automatically from the registry).
#name
def name(self)Target registry name. Subclasses must override.
#version_file
def version_file(self, dir_path=None)Return the relative path of the file that holds the project version.
#tag_format
def tag_format(self, version)Return the git tag string for a standalone release version.
#monorepo_tag_format
def monorepo_tag_format(self, name, version, path=None)Return the git tag string for a monorepo package release.
#monorepo_tag_glob
def monorepo_tag_glob(self, name, path=None)Return a glob pattern matching all version tags for a monorepo package.
#template_dir
def template_dir(self)Return the path to this target's ecosystem-specific template directory.
#shared_template_dir
def shared_template_dir(self)Return the path to the shared template directory common to all targets.
#read_name
def read_name(self, dir_path, ctx)Read the project name from the target's manifest file.
#read_metadata
def read_metadata(self, dir_path)Read project metadata (license, description) from the manifest file.
#template_vars
def template_vars(self, dir_path, ctx)Return template variables extracted from the project for scaffold rendering.
#template_mappings
def template_mappings(self, ctx)Return the list of target-specific template-to-file mappings for scaffolding.
#shared_template_mappings
def shared_template_mappings(self, ctx)Return template-to-file mappings shared across all targets.
#_lint_config_mappings
def _lint_config_mappings(self, ctx)Return lint config mappings filtered by declared targets.
If no targets are configured, all 3 lint configs are included for backward compatibility with unconfigured projects.
#_extract_target_names
def _extract_target_names(ctx)Extract target name strings from ctx.config["targets"].
Returns a set of target names, or an empty set if targets is not configured or ctx is unavailable.
#check_project_exists
def check_project_exists(self, dir_path)Return True if the project's manifest file exists in dir_path.
#get_project_init_hint
def get_project_init_hint(self)Return a user-facing hint for initializing a project of this target type.
#write_version
def write_version(self, dir_path, version, ctx)Write a new version to the target's version file(s).
Returns a list of relative file paths (relative to dir_path) that were modified. Subclasses must override this method and return the actual paths written.
#_resolve_build_timeout
def _resolve_build_timeout(self, config)Resolve the build timeout from config, then the shipped default.
config["build_timeout"]-- an int, or a dict keyed by target
name with an optional "default" entry
self.BUILD_TIMEOUT_DEFAULTclass variable
There is deliberately no environment-variable layer: build budgets are declared in .rlsbl/config.json, never picked up from the ambient environment.
#build
def build(self, dir_path, version, *, config=None)Build distributable artifacts for this target. No-op by default.
#companion_tags
def companion_tags(self, name, version, path=None)Return additional tags to create alongside the primary release tag.
Ecosystems that require extra tags (e.g. Go module proxy tags) override this to return a list of tag strings. The default implementation returns no companion tags.
Args:
name: the releasable or project name.version: the version being released (withoutvprefix).path: workspace-relative path to the package directory, or
None for standalone projects.
Returns:
- List of tag strings to create alongside the primary tag.
#format_version
def format_version(self, version)Format a semver version for this target's ecosystem.
The default implementation returns the version unchanged (identity). This is correct for npm, Go, Deno, plain, and most targets where semver is used directly.
Targets with different version conventions (e.g. PyPI's PEP 440) override this to translate from semver to the ecosystem format.
#publication_probe
def publication_probe(self, dir_path, version, ctx=None)Probe the registry to determine if a specific version is published.
Returns a PublicationProbeResult with one of three statuses: PUBLISHED: the version exists on the registry. UNPUBLISHED: the version does not exist on the registry. UNPROBEABLE: this target cannot probe (no API, no name, etc.).
The default implementation returns UNPROBEABLE. Targets with registry APIs (npm, pypi, go) override this to query the registry.
#dev_install_command
def dev_install_command(self, project_dir)Specs for local install via rlsbl dev install, keyed by mode.
Subclasses override to return spec dicts for the "global" and/or "venv" modes. See the protocol docstring for the spec format. Default returns {"global": None, "venv": None} (unsupported).