Skip to content

vueda.update ​

Overview ​

Interactive update workflow for vueda-server deployments.

Classes ​

ask ​

Ask the user a question, with a list of choices and a default.

Signature ​

ask(stdout, stderr, question, choices, default, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
questionstryes
choiceslist[str]yes
defaultstryes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:148

ask_tag ​

Ask the user which git tag they would like to check out. We should not show all tags because there are too many. We can show the last 5 tags and default to the latest tag. We should allow the user to enter a tag that is not in the list. We should allow HEAD as a tag, for development.

Signature ​

ask_tag(stdout, stderr, debug_mode)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
debug_modeboolnoFalse

Source ​

server/vueda/update.py:179

backup ​

Clean up backups older than a week. Create a new database backup.

Signature ​

backup(stdout, stderr, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:227

configure_django_settings ​

Configure Django settings from the correct directory so relative config lookups work.

Signature ​

configure_django_settings(manage_py_dir)

Parameters ​

NameTypeRequiredDefaultDescription
manage_py_diryes

Source ​

server/vueda/update.py:338

detect_package_manager ​

Auto-detect package manager based on lock files and availability. Works from anywhere within a git repository. Returns tuple of (package_manager, repo_root, manage_py_dir).

Results are cached to avoid repeated filesystem operations.

Signature ​

detect_package_manager()

Source ​

server/vueda/update.py:356

echo_and_eval ​

Print a command to stdout and then execute it.

Signature ​

echo_and_eval(stdout, stderr, command, extra_env, shell)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
commandstr | list[str]yes
extra_envdict | NonenoNone
shellboolnoFalse

Source ​

server/vueda/update.py:214

echo_and_eval_with_cwd ​

Print a command to stdout and then execute it from specified directory.

Signature ​

echo_and_eval_with_cwd(stdout, stderr, command, cwd, extra_env, shell)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
commandstr | list[str]yes
cwdstr | NonenoNone
extra_envdict | NonenoNone
shellboolnoFalse

Source ​

server/vueda/update.py:402

find_manage_py ​

Find manage.py starting from start_dir (or current directory). Searches common locations: ., server/, src/, backend/, app/ Returns the directory containing manage.py, or None if not found.

Signature ​

find_manage_py(start_dir)

Parameters ​

NameTypeRequiredDefaultDescription
start_dirnoNone

Source ​

server/vueda/update.py:314

find_repo_root ​

Find the git repository root directory. Returns None if not in a git repo.

Signature ​

find_repo_root()

Source ​

server/vueda/update.py:302

get_tag ​

Get the current git tag, if it exists.

Signature ​

get_tag()

Source ​

server/vueda/update.py:54

install ​

Install the latest requirements, supporting both uv and pipenv.

Auto-detects package manager or uses PACKAGE_MANAGER setting. Use sync so deploys get locked files, and so devs don't change the lock unintentionally.

Signature ​

install(stdout, stderr, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:433

migrate ​

Run Django management command 'migrate' and 'remove_stale_contenttypes'.

Signature ​

migrate(stdout, stderr, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:545

orange_char ​

Get single character input, but color it orange.

Signature ​

orange_char(stdout, stderr, default)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
defaultstryes

Source ​

server/vueda/update.py:71

orange_input ​

Get user input, but color it orange.

Signature ​

orange_input(stdout, _stderr, default)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
_stderrtyping.TextIOyes
defaultstryes

Source ​

server/vueda/update.py:94

post ​

Run post-update commands. This is historical at the moment.

Signature ​

post(stdout, stderr, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:570

Print an error message and its trace to stderr with an "Error:" prefix.

print_trace(stderr, message, trace)

NameTypeRequiredDefaultDescription
stderryes
messageyes
traceyes

server/vueda/update.py:131

pull ​

Pull the latest code from git. if on main, we ask the user if they want to check out a tag. if on a branch, we pull.

Signature ​

pull(stdout, stderr, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:275

run ​

Run the update steps from parsed_args.first_step onward, or only that step with --only. On a step failure, exit with its code, or return the code when exit_on_error is false.

Signature ​

run(parsed_args, exit_on_error, terminal_width)

Parameters ​

NameTypeRequiredDefaultDescription
parsed_argsargparse.Namespaceyes
exit_on_errornoTrue
terminal_widthnoNone

Source ​

server/vueda/update.py:588

static ​

Run Django management command 'collectstatic', if on a live site.

Signature ​

static(stdout, stderr, non_interactive)

Parameters ​

NameTypeRequiredDefaultDescription
stdouttyping.TextIOyes
stderrtyping.TextIOyes
non_interactiveboolnoFalse

Source ​

server/vueda/update.py:517

temp_terminal_width ​

Set the shared text wrapper's width to width for the duration of the with block.

Signature ​

temp_terminal_width(width)

Parameters ​

NameTypeRequiredDefaultDescription
widthyes

Source ​

server/vueda/update.py:118

update_for_main ​

Build the update argument parser as a subcommand of subparsers when given. Return run and the parser; the caller parses the arguments and passes them to run.

Signature ​

update_for_main(subparsers, exit_on_error)

Parameters ​

NameTypeRequiredDefaultDescription
subparsersnoNone
exit_on_errornoTrue

Source ​

server/vueda/update.py:625

wrap_text ​

Wrap text to the shared text wrapper's width and join the lines.

Signature ​

wrap_text(text)

Parameters ​

NameTypeRequiredDefaultDescription
textyes

Source ​

server/vueda/update.py:111

Source ​

server/vueda/update.py