rlsbl v0.92.0 /rlsbl.targets.base
On this page

Base class for release targets with shared defaults for version I/O, detection, scaffolding, publish, asset builds, and dev-install.

#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

python
def name(self)

Target registry name. Subclasses must override.

#version_file

python
def version_file(self, dir_path=None)

#tag_format

python
def tag_format(self, version)

#monorepo_tag_format

python
def monorepo_tag_format(self, name, version, path=None)

#monorepo_tag_glob

python
def monorepo_tag_glob(self, name, path=None)

#template_dir

python
def template_dir(self)

#shared_template_dir

python
def shared_template_dir(self)

#read_name

python
def read_name(self, dir_path, ctx)

#read_metadata

python
def read_metadata(self, dir_path)

#template_vars

python
def template_vars(self, dir_path, ctx)

#template_mappings

python
def template_mappings(self, ctx)

#shared_template_mappings

python
def shared_template_mappings(self, ctx)

#_lint_config_mappings

python
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

python
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

python
def check_project_exists(self, dir_path)

#get_project_init_hint

python
def get_project_init_hint(self)

#write_version

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

#build

python
def build(self, dir_path, version)

#companion_tags

python
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 (without v prefix).
  • 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

python
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, Cargo, 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.

#dev_install_command

python
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).