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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| question | str | yes | ||
| choices | list[str] | yes | ||
| default | str | yes | ||
| non_interactive | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| debug_mode | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| non_interactive | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| manage_py_dir | yes |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| command | str | list[str] | yes | ||
| extra_env | dict | None | no | None | |
| shell | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| command | str | list[str] | yes | ||
| cwd | str | None | no | None | |
| extra_env | dict | None | no | None | |
| shell | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| start_dir | no | None |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| non_interactive | bool | no | False |
Source
server/vueda/update.py:433
migrate
Run Django management command 'migrate' and 'remove_stale_contenttypes'.
Signature
migrate(stdout, stderr, non_interactive)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| non_interactive | bool | no | False |
Source
server/vueda/update.py:545
orange_char
Get single character input, but color it orange.
Signature
orange_char(stdout, stderr, default)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| default | str | yes |
Source
server/vueda/update.py:71
orange_input
Get user input, but color it orange.
Signature
orange_input(stdout, _stderr, default)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| _stderr | typing.TextIO | yes | ||
| default | str | yes |
Source
server/vueda/update.py:94
post
Run post-update commands. This is historical at the moment.
Signature
post(stdout, stderr, non_interactive)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| non_interactive | bool | no | False |
Source
server/vueda/update.py:570
print_trace
Print an error message and its trace to stderr with an "Error:" prefix.
Signature
print_trace(stderr, message, trace)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stderr | yes | |||
| message | yes | |||
| trace | yes |
Source
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| non_interactive | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| parsed_args | argparse.Namespace | yes | ||
| exit_on_error | no | True | ||
| terminal_width | no | None |
Source
server/vueda/update.py:588
static
Run Django management command 'collectstatic', if on a live site.
Signature
static(stdout, stderr, non_interactive)
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| stdout | typing.TextIO | yes | ||
| stderr | typing.TextIO | yes | ||
| non_interactive | bool | no | False |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| width | yes |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| subparsers | no | None | ||
| exit_on_error | no | True |
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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| text | yes |
Source
server/vueda/update.py:111
Source
server/vueda/update.py