Skip to content

Commit aa5741a

Browse files
Bump vws-web-tools to 2026.2.22 (#2997)
* Bump vws-web-tools to 2026.2.22 and refactor secrets file creation Use get_database_details from vws-web-tools to fetch inactive database credentials instead of loading from an existing secrets file. This simplifies the setup by reducing env vars from 6 to 1 (INACTIVE_VUFORIA_TARGET_MANAGER_DATABASE_NAME). Removes python-dotenv dependency and simplifies admin/create_secrets_files.py. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Simplify _fetch_inactive_database_details to match existing helper pattern Take a driver parameter and let TimeoutException propagate, consistent with _create_and_get_database_details and the other helper functions. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 1fda714 commit aa5741a

3 files changed

Lines changed: 33 additions & 20 deletions

File tree

admin/create_secrets_files.py

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from typing import TYPE_CHECKING
1212

1313
import vws_web_tools
14-
from dotenv import load_dotenv
1514
from selenium.common.exceptions import TimeoutException
1615

1716
if TYPE_CHECKING:
@@ -123,6 +122,25 @@ def _create_and_get_vumark_target_id(
123122
)
124123

125124

125+
def _fetch_inactive_database_details(
126+
driver: "WebDriver",
127+
email_address: str,
128+
password: str,
129+
database_name: str,
130+
) -> "DatabaseDict":
131+
"""Fetch details for an existing inactive database."""
132+
vws_web_tools.log_in(
133+
driver=driver,
134+
email_address=email_address,
135+
password=password,
136+
)
137+
vws_web_tools.wait_for_logged_in(driver=driver)
138+
return vws_web_tools.get_database_details(
139+
driver=driver,
140+
database_name=database_name,
141+
)
142+
143+
126144
def _create_vuforia_resource_names() -> tuple[str, str, str, str]:
127145
"""Create names for Vuforia resources."""
128146
time = datetime.datetime.now(tz=datetime.UTC).strftime(
@@ -141,23 +159,18 @@ def main() -> None:
141159
email_address = os.environ["VWS_EMAIL_ADDRESS"]
142160
password = os.environ["VWS_PASSWORD"]
143161
new_secrets_dir = Path(os.environ["NEW_SECRETS_DIR"]).expanduser()
144-
existing_secrets_file = Path(
145-
os.environ["EXISTING_SECRETS_FILE"]
146-
).expanduser()
147-
if not existing_secrets_file.exists():
148-
msg = f"Existing secrets file does not exist: {existing_secrets_file}"
149-
raise FileNotFoundError(msg)
150-
load_dotenv(dotenv_path=existing_secrets_file)
151-
inactive_database_details: DatabaseDict = {
152-
"database_name": os.environ[
153-
"INACTIVE_VUFORIA_TARGET_MANAGER_DATABASE_NAME"
154-
],
155-
"server_access_key": os.environ["INACTIVE_VUFORIA_SERVER_ACCESS_KEY"],
156-
"server_secret_key": os.environ["INACTIVE_VUFORIA_SERVER_SECRET_KEY"],
157-
"client_access_key": os.environ["INACTIVE_VUFORIA_CLIENT_ACCESS_KEY"],
158-
"client_secret_key": os.environ["INACTIVE_VUFORIA_CLIENT_SECRET_KEY"],
159-
}
162+
inactive_database_name = os.environ[
163+
"INACTIVE_VUFORIA_TARGET_MANAGER_DATABASE_NAME"
164+
]
160165
new_secrets_dir.mkdir(exist_ok=True)
166+
inactive_driver = vws_web_tools.create_chrome_driver()
167+
inactive_database_details = _fetch_inactive_database_details(
168+
driver=inactive_driver,
169+
email_address=email_address,
170+
password=password,
171+
database_name=inactive_database_name,
172+
)
173+
inactive_driver.quit()
161174

162175
num_databases = 100
163176
required_files = [

docs/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ To create databases without using the browser, use :file:`admin/create_secrets_f
102102
$ export VWS_EMAIL_ADDRESS=...
103103
$ export VWS_PASSWORD=...
104104
$ export NEW_SECRETS_DIR=...
105-
$ export EXISTING_SECRETS_FILE=/existing/file/with/inactive/db/creds
105+
$ export INACTIVE_VUFORIA_TARGET_MANAGER_DATABASE_NAME=...
106106
# You may have to run this a few times, but it is idempotent.
107107
$ python admin/create_secrets_files.py
108108
# Each generated file gets its own Cloud database credentials and shares

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ optional-dependencies.dev = [
7979
"pytest==9.0.2",
8080
"pytest-retry==1.7.0",
8181
"pytest-xdist==3.8.0",
82-
"python-dotenv==1.2.1",
8382
"pyyaml==6.0.3",
8483
"requests-mock-flask==2026.2.16",
8584
"ruff==0.15.1",
@@ -107,7 +106,7 @@ optional-dependencies.dev = [
107106
"vulture==2.14",
108107
"vws-python==2026.2.21",
109108
"vws-test-fixtures==2023.3.5",
110-
"vws-web-tools==2026.2.20",
109+
"vws-web-tools==2026.2.22",
111110
"yamlfix==1.19.1",
112111
"zizmor==1.22.0",
113112
]
@@ -453,6 +452,7 @@ ignore_names = [
453452
"model_config",
454453
# Used in TYPE_CHECKING for type hints
455454
"CloudDatabaseDict",
455+
"DatabaseDict",
456456
"VuMarkDatabaseDict",
457457
"VuMarkTargetDict",
458458
]

0 commit comments

Comments
 (0)