Skip to content

[FEATURE] Opt-in Python starter as a flake template (nix flake init -t ...#python) #930

Closed

Description

@c-vigo

Description

Ship an opt-in Python project starter as a flake template, so a consumer who
does want a Python package can restore one with
nix flake init -t github:vig-os/devcontainer#python.

Problem Statement

Companion to the language-neutral scaffold change (the copied scaffold no longer
ships pyproject.toml/src//tests/). Python consumers — still the majority —
need a first-class, single-sourced way to get the Python package layout back
without hand-writing pyproject.toml/src//tests/ or running bare uv init.

Proposed Solution

Add templates/python/ mirroring the existing templates/personal/
(flake.nix-registered nix flake init -t template):

  • templates/python/pyproject.toml — minimal: hatchling build,
    requires-python = ">=3.14,<3.15", dev = [pytest, pytest-cov] pinned to the
    image versions. Drops the heavy science/jupyter extras of the old scaffold.
  • templates/python/src/example_pkg/__init__.py, tests/__init__.py,
    tests/test_example.py.
  • templates/python/README.md — usage + the rename step.

Uses a concrete package name (example_pkg) the user renames, because
nix flake init -t performs no token substitution (unlike the
init-workspace.sh scaffold path). Register in flake.nix next to
templates.personal:

templates.python = {
  path = ./templates/python;
  description = "Opt-in Python project starter (pyproject + src/ + pytest)";
};

Add test_python_template_is_exposed (mirroring test_personal_template_is_exposed)
and a one-line pointer in the generated README / docs/MIGRATION.md.

Alternatives Considered

  • Fold into a --template selector in install.sh: rejected — see the
    companion issue; duplicates the standards layer and fights SSoT.
  • Leave users to uv init by hand: workable but loses the vig-os-consistent
    pin set and the single-sourced starter.

Impact

  • Who benefits: Python consumers (one-command restore of the package layout).
  • Compatibility: purely additive / semver:minor. No change to existing
    scaffolded repos.
  • Ships in the same release as the language-neutral scaffold change so there
    is never a window without a restore path.

Changelog Category

Added.

Activity

  1. added this to the 0.5 milestone on Jul 8, 2026
  2. added
    feature
    area:workspace
    semver:minor
    on Jul 8, 2026
  3. c-vigo commented on Jul 8, 2026

    @c-vigo
    ContributorAuthor

    Companion: #929 (language-neutral scaffold — removes the shipped Python starter). Both should land in the same release.

  4. c-vigo commented on Jul 8, 2026

    @c-vigo
    ContributorAuthor

    Done — merged into dev via #933 (merge bcb08633). nix flake init -t github:vig-os/devcontainer#python restores an opt-in Python package layout (pyproject + src/ + pytest) onto the now language-neutral scaffold (#929). Ships in 0.5.

  5. added a commit that references this issue on Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:workspacefeaturesemver:minor

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions