pjkm.cli.commands.project

Project lifecycle commands — init, add, update, upgrade, link, preview.

Functions

init([name, archetype, group, recipe_name, directory, ...])

Initialize a new project from a template.

add([group, directory])

Add package groups to an existing project.

update([directory, dry_run])

Re-render templates on an existing project.

upgrade([group, directory, latest, refresh_tools, ...])

Upgrade dependencies for applied groups to their latest defined versions.

link_tool([tool_name, directory, dry_run])

Link/refresh tool configuration from group definitions.

preview([archetype, group, recipe_name])

Preview what a project would look like without creating anything.

Module Contents

pjkm.cli.commands.project.init(name=typer.Argument(help='Project name'), archetype=typer.Option('', '--archetype', '-a', help='Project archetype: single-package, service, poly-repo, script-tool'), group=typer.Option([], '--group', '-g', help='Package groups to include (repeatable)'), recipe_name=typer.Option('', '--recipe', '-r', help='Use a named recipe (overrides --archetype and --group)'), directory=typer.Option('', '--dir', '-d', help='Target directory (project will be created as a subdirectory)'), dry_run=typer.Option(False, '--dry-run', help='Show what would be done without making changes'), author=typer.Option('', '--author', help='Author name (overrides defaults)'), email=typer.Option('', '--email', help='Author email (overrides defaults)'))[source]

Initialize a new project from a template.

Options not provided on the command line are filled from defaults. Set defaults in ~/.pjkmrc.yaml or ./.pjkmrc.yaml. Use –recipe for a pre-configured archetype + groups combo.

Parameters:
Return type:

None

pjkm.cli.commands.project.add(group=typer.Option(..., '--group', '-g', help='Package group(s) to add (repeatable)'), directory=typer.Option('', '--dir', '-d', help='Project directory containing pyproject.toml (default: cwd)'))[source]

Add package groups to an existing project.

Reads the existing pyproject.toml, resolves the requested groups (including transitive dependencies), merges new dependencies and tool config, renders scaffolded files, and updates [tool.pjkm.groups].

Parameters:
Return type:

None

pjkm.cli.commands.project.update(directory=typer.Option('', '--dir', '-d', help='Project directory to update (default: current directory)'), dry_run=typer.Option(False, '--dry-run', help='Show what would be done without making changes'))[source]

Re-render templates on an existing project.

Reads [tool.pjkm] from pyproject.toml to find the archetype and applied groups, then re-renders the base and archetype templates. Useful after updating pjkm to pick up new CI workflows, gitignore improvements, etc.

If .copier-answers.yml exists, uses Copier’s update mechanism. Otherwise, falls back to re-rendering with overwrite.

Parameters:
Return type:

None

pjkm.cli.commands.project.upgrade(group=typer.Option([], '--group', '-g', help='Specific group(s) to upgrade (default: all applied groups)'), directory=typer.Option('', '--dir', '-d', help='Project directory (default: cwd)'), latest=typer.Option(False, '--latest', help="Remove version pins and use latest (e.g. 'pkg' instead of 'pkg>=1.0')"), refresh_tools=typer.Option(False, '--refresh-tools', help='Re-apply tool config from group definitions (overwrites customizations)'), dry_run=typer.Option(False, '--dry-run', help='Show what would change without modifying files'), install=typer.Option(True, '--install/--no-install', help='Run `pdm install` after upgrading (default: yes)'))[source]

Upgrade dependencies for applied groups to their latest defined versions.

Reads [tool.pjkm.groups] from pyproject.toml, loads the current group definitions, and replaces dependency version pins with the latest from the group YAML files. Optionally re-applies tool config sections.

Examples

pjkm upgrade # upgrade all group deps pjkm upgrade -g logging -g testing # upgrade specific groups pjkm upgrade –latest # strip version pins entirely pjkm upgrade –refresh-tools # also re-apply [tool.*] config pjkm upgrade –dry-run # preview changes

Parameters:
Return type:

None

Link/refresh tool configuration from group definitions.

Reads the applied groups and re-applies their [tool.*] config sections to pyproject.toml. Useful after updating pjkm or group definitions to pick up new recommended settings.

Examples

pjkm link ruff # refresh [tool.ruff.*] config from groups pjkm link pytest # refresh [tool.pytest.*] config pjkm link pyright # refresh [tool.pyright] config

Parameters:
Return type:

None

pjkm.cli.commands.project.preview(archetype=typer.Argument('', help='Project archetype (optional when --recipe is given)'), group=typer.Option([], '--group', '-g', help='Package groups to preview (repeatable)'), recipe_name=typer.Option('', '--recipe', '-r', help='Use a named recipe instead of specifying groups'))[source]

Preview what a project would look like without creating anything.

Shows the full file tree, dependencies, tool config, and workflows that would be generated. Great for trying different combinations before committing to pjkm init.

Examples

pjkm preview service -g api -g database -g docker pjkm preview –recipe python-lib pjkm preview –recipe fastapi-service

Parameters:
Return type:

None