Skip to content

feat(tools): share package definitions across feature setup and Bazel - #201

Closed
AlexanderLanin wants to merge 1 commit into
eclipse-score:mainfrom
etas-contrib:refactor/shared-provider-definitions
Closed

AlexanderLanin wants to merge 1 commit into
eclipse-score:mainfrom
etas-contrib:refactor/shared-provider-definitions

Conversation

@AlexanderLanin

Copy link
Copy Markdown
Member

Why

Maintainers currently have to follow two feature-specific YAML files and a separate Python catalog to find package versions. Feature setup also downloads yq just to read those files. Keep Python/npm package definitions, APT policies and special setup metadata together in tools/providers.json, while retaining the existing native release lockfiles.

The feature scripts and their tests read quoted metadata through the existing Python installer. Bazel derives its Python package data from the same JSON and exposes basedpyright and pytest alongside pre-commit, using the existing pins. The current package choices and installation locations are retained.

🦬🪒 Yak shaving

  • Remove the replaced YAML/Python definitions, yq loader and obsolete YAML Renovate entries; native lockfile update rules remain.
  • Preserve Debian epochs in APT constraints while comparing executable versions without the epoch prefix.
  • Remove the unused macOS CodeQL checksum and unreachable macOS branch from Linux feature setup; Linux ARM64 continues to skip CodeQL.

Package-definition extraction from #198, based directly on main and independent of #200. Environment selections and the new installation lifecycle remain in #198. Part of #190; builds on #196.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the shared package-metadata consolidation.

No open issues 🎉

What changed in this PR

Consolidates package definitions in tools/providers.json so DevContainer features and Bazel share metadata while native releases retain their existing lockfiles. This extracts the package-definition work from #198 without introducing environment selections or the new installation lifecycle.

Changes:

  • Replace feature YAML files and the Python catalog with shared JSON, removing the yq loader.
  • Generate Bazel’s Python catalog from JSON and expose basedpyright and pytest alongside pre-commit.
  • Add metadata regression coverage, preserve APT epochs, and remove unreachable macOS CodeQL handling.
File Description
tools/​tests/​python_tool_runner_test.sh Compare generated Bazel metadata with shared JSON.
tools/​tests/​metadata_test.py Check metadata completeness and safe shell quoting.
tools/​tests/​catalog_test.py Adapt catalog validation tests to JSON.
tools/​README.md Add basedpyright and pytest to the tool table.
tools/​python_tool.bzl Create targets from the generated Python catalog.
tools/​providers.json Centralize package definitions and setup metadata.
tools/​lockfiles/​python_tools.bzl Remove the replaced Python catalog.
tools/​internal/​README.md Document shared definitions and delivery paths.
tools/​internal/​devcontainer/​load_feature_versions.sh Remove the yq-based metadata loader.
tools/​internal/​devcontainer/​install.py Export shell-quoted metadata from shared definitions.
tools/​internal/​catalog.py Read and validate provider definitions.
tools/​catalog_repository.bzl Generate loadable Starlark metadata from JSON.
tools/​BUILD.bazel Export definitions, expose Python tools, and wire test data.
src/​s-core-devcontainer/​.devcontainer/​s-core-local/​versions.yaml Remove migrated feature definitions.
src/​s-core-devcontainer/​.devcontainer/​s-core-local/​tests/​test_default.sh Use shared metadata and strip epochs in version checks.
src/​s-core-devcontainer/​.devcontainer/​s-core-local/​install.sh Use shared metadata and simplify Linux CodeQL handling.
src/​s-core-devcontainer/​.devcontainer/​bazel-feature/​versions.yaml Remove migrated Bazel feature definitions.
src/​s-core-devcontainer/​.devcontainer/​bazel-feature/​tests/​test_default.sh Read expected versions through the installer.
src/​s-core-devcontainer/​.devcontainer/​bazel-feature/​install.sh Replace YAML loading with shared metadata exports.
REUSE.toml Add license coverage for provider JSON.
MODULE.bazel Register the generated catalog repository.
.pre-commit-config.yaml Watch provider JSON for README regeneration.
.github/​renovate.json5 Remove obsolete YAML update rules.

Review effort: Balanced

@AlexanderLanin
AlexanderLanin marked this pull request as ready for review November 4, 2026 13:30
etas-contrib-automation Bot pushed a commit to etas-contrib/score_devcontainer that referenced this pull request Nov 5, 2026
…lipse-score#198)

## Why

Adding or removing a tool currently means following several installation
scripts and separate version files. Maintainers need one place to see
which tools each environment provides, and to change that selection
without rewriting installation steps.

For developers, basedpyright and pytest become available to all
DevContainer users alongside pre-commit, rather than being installed
into one user's home directory. They also gain Bazel targets using the
same package versions. Invalid selections, missing declared dependencies
and unsupported platform artifacts are reported before installation
starts.

## What changes

- **Tool selection:** `tools/environments.json` lists the directly
managed tools for the two existing container features and this
repository's own setup.
- **Package definitions:** `tools/providers.json` holds Python/npm
packages, APT policies and special setup metadata. Native release
versions and checksums stay in the existing lockfiles; Bazel reads
Python definitions from the same JSON source.
- **Installation:** each setup requests its selection with one installer
call. The installer manages temporary build packages, tool setup,
cleanup and required privileges, while npm retains the development
user's environment. Tool-specific setup lives beside the installer.
- **Cleanup and fixes:** remove the replaced YAML definitions and yq
bootstrap, and repair config/state parent ownership without changing
existing private permissions.

Existing tool versions and APT policies are retained.
Distribution-selected packages still follow Ubuntu; the change does not
make those packages exactly pinned.

Part of eclipse-score#190; builds on eclipse-score#196.

---

## Possible split if this is too large

If this PR is too large to review as one change, we could split it into
the following independently usable steps. Extractions eclipse-score#200 and eclipse-score#201 are
ready for review, each based directly on `main` and independent of the
other. This PR retains the complete implementation until the extractions
land.

| PR | Scope | Result |
| --- | --- | --- |
| 1. Fix directory ownership (eclipse-score#200) | Repair config/state parent
ownership while preserving private permissions, with regression
coverage. | An independent bugfix. |
| 2. Consolidate package definitions (eclipse-score#201) | Introduce `providers.json`
and the Bazel adapter; replace the Python/YAML definitions and yq. Adapt
existing installers to read the new metadata and expose the additional
Python Bazel targets. | Shared definitions, with existing installation
flows largely retained. |
| 3. Migrate repository setup | Add environment selection, validation
and native/Python/npm installation with privilege handling; migrate
`post_create_command.sh`. | The new model is used by this repository's
own setup. |
| 4. Migrate container features | Add APT, temporary build dependencies
and declared setup scripts; migrate both features, including system-wide
Python tools, and remove their inline installation logic. | The complete
behavior proposed by this PR. |

Steps 2 → 3 → 4 build on each other. Step 1 is independent and should
land before step 4. If step 4 is still too large, it can be split
further by `bazel-feature` and `s-core-local`. Tests and documentation
would accompany their respective changes; intermediate steps would keep
one source for each version rather than introducing duplicate
definitions.
@AlexanderLanin

Copy link
Copy Markdown
Member Author

Superseded by #198, which has been merged and already includes the shared package definitions, Bazel integration, and removal of the YAML/yq setup. Closing this extraction without merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants