upgrade()
Bring a project made by an older Framework up to the current layout.
It prints a plan first and, with dry_run=False, backs up every file it
rewrites to .framework/backups/<timestamp>/ (which git ignores) and
applies the plan. Your code, data, and notes are not touched. Running it
again changes nothing. python -m framework upgrade [--apply] [--no-backup]` (what `fw project upgrade runs) does the same.
The plan covers, in this order:
Usage
upgrade(
path: str | Path = '.',
dry_run: bool = True,
backup: bool = True,
type: str | None = None,
move_settings: bool = False,
) -> UpgradeResult
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| path | str | Path | '.' |
The project folder. |
| dry_run | bool | True |
Print the plan and change nothing. |
| backup | bool | True |
Copy every file before it is rewritten or removed. Skills replaced by an update are always backed up, to |
| type | str | None | None |
Change the project's type: |
| move_settings | bool | False |
Move top-level keys of the settings file that no environment reads ( |
Value
An UpgradeResult: the planned actions (step, path, change),
notes, whether it was applied, and the backup_location.
Details
- Settings: a 1.x
config.ymlbecomessettings.yml. Missing sections are added:tools:(Quarto and uv, from the files present) andsecurity:. Aproject_sensitiveproject, or one with the private folder layout, getssecurity: sensitive: true. Keys outsidedefault:, which Framework ignores, are reported, or moved intosettings/withmove_settings=True. - Connections: the old layouts (
options: default_connection:with connections listed flat, or the empty hybrid of both) are rewritten asconnections:withdefault_database,databases, andstorage_buckets. A password written into the settings is reported (by key, never by value) and left where it is. The spec refers to it asenv("NAME"), NAME being the variable the project already uses for it (in.env, an example.env, or the code), else one made from the connection's name; the plan names it and says to set it. - .gitignore: the rules of the current template for the project's type that it lacks, private folders, and folder publishing destinations are appended in one block. No line is removed, and a rule that would ignore files git tracks is left out and reported.
- AI files: AGENTS.md becomes the canonical context file, with CLAUDE.md
a one-line
@AGENTS.mdpointer, when CLAUDE.md held the full guide; the marked sections are regenerated. A hand-written AGENTS.md is left alone and reported. Sensitive projects get the Claude Code guards (.claude/settings.json) that keep agents out of private folders, whatever the AI settings say: folders with aprivate(or*_private) segment, folders whose key marks them private (inputs_private_raw: inputs/raw), and private render folders. The plan says when git ignores.claude/, so the guards would stay on one computer. - Skills: Framework skills that match a version framework-py has
shipped are updated, in the assistants' skills folders and in
.agents/skills; missing ones for the type are added, and edited ones are kept and listed. A project with no skills folder gets none, except that a sensitive project getsframework-sensitive-data. - Quarto: missing Quarto files are created, and an existing
_quarto.ymlat most gains missing keys (seequarto_regenerate()). - Spec:
.framework/spec.jsonis written from the settings when it is missing, and refreshed when its folders, type, author, security, tools, connections, or copy of.gitignoreno longer match, socloud_register()andfw project push-specwork. It holds only what spec.v1 allows (seespec.v1.json), so keys an earlierupgrade()wrote that Framework Cloud refuses (scaffold.positron,source.upgraded_from) are dropped.
Raises
FrameworkError: When the folder is not a Framework project, or is a project in another language.