From 892e2c02feb83a6c0b699e7a38e88d0c6ffcefec Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Tue, 8 Oct 2024 14:05:18 -0700 Subject: [PATCH 1/7] keep current for part 1 --- devenv/config.ini | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/devenv/config.ini b/devenv/config.ini index 4eb73da0f3d854..b3ad9ce08a8a17 100644 --- a/devenv/config.ini +++ b/devenv/config.ini @@ -51,6 +51,18 @@ linux_arm64_sha256 = 6ecba675e90d154f22e20200fa5684f20ad1495b73c0462f1bd7da4e9d0 # used for autoupdate version = v0.6.6 +[lima] +darwin_x86_64 = https://github.com/lima-vm/lima/releases/download/v0.19.1/lima-0.19.1-Darwin-x86_64.tar.gz +darwin_x86_64_sha256 = ac8827479f66ef1b288b31f164b22f6433faa14c44ce5bbebe09e6e913582479 +darwin_arm64 = https://github.com/lima-vm/lima/releases/download/v0.19.1/lima-0.19.1-Darwin-arm64.tar.gz +darwin_arm64_sha256 = 0dfcf3a39782baf1c2ea43cf026f8df0321c671d914c105fbb78de507aa8bda4 +linux_x86_64 = https://github.com/lima-vm/lima/releases/download/v0.19.1/lima-0.19.1-Linux-x86_64.tar.gz +linux_x86_64_sha256 = 7d18b1716aae14bf98d6ea93a703e8877b0c3142f7ba2e87401d47d5d0fe3ff1 +linux_arm64 = https://github.com/lima-vm/lima/releases/download/v0.19.1/lima-0.19.1-Linux-aarch64.tar.gz +linux_arm64_sha256 = c55e57ddbefd9988d0f3676bb873bcc6e0f7b3c3d47a1f07599ee151c5198d96 +# used for autoupdate +version = 0.19.1 + # kept here only for compatibility with older `devenv` [python] version = 3.12.6 From c388372de0e3b3f1c993bc51e9ebd7e33493efbf Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Wed, 9 Oct 2024 13:02:46 -0700 Subject: [PATCH 2/7] bump devenv and compat limactl call --- devenv/sync.py | 18 ++++++++++++++++++ requirements-dev-frozen.txt | 4 ++-- requirements-dev.txt | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/devenv/sync.py b/devenv/sync.py index 8b3c18dd663c52..8986f3dc34c242 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -97,6 +97,24 @@ def main(context: dict[str, str]) -> int: volta.install(reporoot) + if constants.DARWIN: + colima.install( + repo_config["colima"]["version"], + repo_config["colima"][constants.SYSTEM_MACHINE], + repo_config["colima"][f"{constants.SYSTEM_MACHINE}_sha256"], + reporoot, + ) + try: + limactl.install(reporoot) + except TypeError: + # again, it'll take 2 syncs to get here + limactl.install( + repo_config["lima"]["version"], + repo_config["lima"][constants.SYSTEM_MACHINE], + repo_config["lima"][f"{constants.SYSTEM_MACHINE}_sha256"], + reporoot, + ) + # no more imports from devenv past this point! if the venv is recreated # then we won't have access to devenv libs until it gets reinstalled diff --git a/requirements-dev-frozen.txt b/requirements-dev-frozen.txt index 8483c454629115..344cd2357fc043 100644 --- a/requirements-dev-frozen.txt +++ b/requirements-dev-frozen.txt @@ -179,8 +179,8 @@ s3transfer==0.10.0 selenium==4.16.0 sentry-arroyo==2.16.5 sentry-cli==2.16.0 -sentry-devenv==1.10.2 -sentry-forked-django-stubs==5.1.0.post2 +sentry-devenv==1.11.0 +sentry-forked-django-stubs==5.1.0.post1 sentry-forked-djangorestframework-stubs==3.15.1.post2 sentry-kafka-schemas==0.1.111 sentry-ophio==1.0.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index ea63d298d6b715..9dffbcf13d7826 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ --index-url https://pypi.devinfra.sentry.io/simple -sentry-devenv>=1.10.2 +sentry-devenv>=1.11.0 covdefaults>=2.3.0 docker>=6 From e1db289889a9f2bdc1491c5f471bb44ede35486a Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Wed, 9 Oct 2024 13:06:34 -0700 Subject: [PATCH 3/7] fix bad rebase lol --- devenv/sync.py | 43 +++++++++---------------------------- requirements-dev-frozen.txt | 2 +- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/devenv/sync.py b/devenv/sync.py index 8986f3dc34c242..c87eb32ae034b8 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -97,6 +97,16 @@ def main(context: dict[str, str]) -> int: volta.install(reporoot) + # no more imports from devenv past this point! if the venv is recreated + # then we won't have access to devenv libs until it gets reinstalled + + # venv's still needed for frontend because repo-local devenv and pre-commit + # exist inside it + venv_dir, python_version, requirements, editable_paths, bins = venv.get(reporoot, repo) + url, sha256 = config.get_python(reporoot, python_version) + print(f"ensuring {repo} venv at {venv_dir}...") + venv.ensure(venv_dir, python_version, url, sha256) + if constants.DARWIN: colima.install( repo_config["colima"]["version"], @@ -115,39 +125,6 @@ def main(context: dict[str, str]) -> int: reporoot, ) - # no more imports from devenv past this point! if the venv is recreated - # then we won't have access to devenv libs until it gets reinstalled - - # venv's still needed for frontend because repo-local devenv and pre-commit - # exist inside it - venv_dir, python_version, requirements, editable_paths, bins = venv.get(reporoot, repo) - url, sha256 = config.get_python(reporoot, python_version) - print(f"ensuring {repo} venv at {venv_dir}...") - venv.ensure(venv_dir, python_version, url, sha256) - - if constants.DARWIN: - try: - colima.install( - repo_config["colima"]["version"], - repo_config["colima"][constants.SYSTEM_MACHINE], - repo_config["colima"][f"{constants.SYSTEM_MACHINE}_sha256"], - reporoot, - ) - except TypeError: - # this is needed for devenv <=1.4.0,>1.2.3 to finish syncing and therefore update itself - colima.install( - repo_config["colima"]["version"], - repo_config["colima"][constants.SYSTEM_MACHINE], - repo_config["colima"][f"{constants.SYSTEM_MACHINE}_sha256"], - ) - - # TODO: move limactl version into per-repo config - try: - limactl.install(reporoot) - except TypeError: - # this is needed for devenv <=1.4.0,>1.2.3 to finish syncing and therefore update itself - limactl.install() - if not run_procs( repo, reporoot, diff --git a/requirements-dev-frozen.txt b/requirements-dev-frozen.txt index 344cd2357fc043..a9d7e48c0bab30 100644 --- a/requirements-dev-frozen.txt +++ b/requirements-dev-frozen.txt @@ -180,7 +180,7 @@ selenium==4.16.0 sentry-arroyo==2.16.5 sentry-cli==2.16.0 sentry-devenv==1.11.0 -sentry-forked-django-stubs==5.1.0.post1 +sentry-forked-django-stubs==5.1.0.post2 sentry-forked-djangorestframework-stubs==3.15.1.post2 sentry-kafka-schemas==0.1.111 sentry-ophio==1.0.0 From 1a21037f1fb246ad6cb66e271ec85ddf6bbcbf4a Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 10 Oct 2024 11:54:26 -0700 Subject: [PATCH 4/7] check_minimum_version --- devenv/sync.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/devenv/sync.py b/devenv/sync.py index c87eb32ae034b8..cc6e5554786b34 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -1,5 +1,6 @@ from __future__ import annotations +import importlib import os import shlex import subprocess @@ -70,7 +71,28 @@ def run_procs( return all_good +def check_minimum_version(minimum_devenv_version: str): + devenv_version = importlib.metadata.version("sentry-devenv") + + min_major, min_minor, min_patch = map(int, minimum_devenv_version.split(".")) + major, minor, patch = map(int, devenv_version.split(".")) + + if (major, minor, patch) < (min_major, min_minor, min_patch): + raise SystemExit( + f""" + +Your devenv version is too old! + +Run `{constants.root}/bin/devenv update {minimum_devenv_version}` +then `{constants.root}/bin/devenv sync`. + +""" + ) + + def main(context: dict[str, str]) -> int: + check_minimum_version("1.10.2") + repo = context["repo"] reporoot = context["reporoot"] repo_config = config.get_config(f"{reporoot}/devenv/config.ini") From a479d42003d92cdd6179455326560b15473d4628 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 10 Oct 2024 11:58:08 -0700 Subject: [PATCH 5/7] better --- devenv/sync.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/devenv/sync.py b/devenv/sync.py index cc6e5554786b34..28f0cce031a76c 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -80,12 +80,13 @@ def check_minimum_version(minimum_devenv_version: str): if (major, minor, patch) < (min_major, min_minor, min_patch): raise SystemExit( f""" +Your devenv version ({devenv_version}) is too old! -Your devenv version is too old! - -Run `{constants.root}/bin/devenv update {minimum_devenv_version}` -then `{constants.root}/bin/devenv sync`. +Run the following to update your global devenv to the minimum, +and use it to run this repo's sync. +{constants.root}/bin/devenv update {minimum_devenv_version} +{constants.root}/bin/devenv sync """ ) From 8d8150fc6b539746aa90a9d060db90a1da26b4b1 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 10 Oct 2024 12:25:40 -0700 Subject: [PATCH 6/7] min version check will be part of config --- devenv/sync.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/devenv/sync.py b/devenv/sync.py index 28f0cce031a76c..c87eb32ae034b8 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -1,6 +1,5 @@ from __future__ import annotations -import importlib import os import shlex import subprocess @@ -71,29 +70,7 @@ def run_procs( return all_good -def check_minimum_version(minimum_devenv_version: str): - devenv_version = importlib.metadata.version("sentry-devenv") - - min_major, min_minor, min_patch = map(int, minimum_devenv_version.split(".")) - major, minor, patch = map(int, devenv_version.split(".")) - - if (major, minor, patch) < (min_major, min_minor, min_patch): - raise SystemExit( - f""" -Your devenv version ({devenv_version}) is too old! - -Run the following to update your global devenv to the minimum, -and use it to run this repo's sync. - -{constants.root}/bin/devenv update {minimum_devenv_version} -{constants.root}/bin/devenv sync -""" - ) - - def main(context: dict[str, str]) -> int: - check_minimum_version("1.10.2") - repo = context["repo"] reporoot = context["reporoot"] repo_config = config.get_config(f"{reporoot}/devenv/config.ini") From 4046a3124e209c9239fe36d8dd877cab19c8f546 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 10 Oct 2024 15:52:01 -0700 Subject: [PATCH 7/7] mypy pls --- devenv/config.ini | 3 +++ devenv/sync.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/devenv/config.ini b/devenv/config.ini index b3ad9ce08a8a17..c66da09851d7ec 100644 --- a/devenv/config.ini +++ b/devenv/config.ini @@ -1,3 +1,6 @@ +[devenv] +minimum_version = 1.10.2 + [venv.sentry] python = 3.12.6 path = .venv diff --git a/devenv/sync.py b/devenv/sync.py index c87eb32ae034b8..b46039ae92ad13 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -93,7 +93,7 @@ def main(context: dict[str, str]) -> int: ) node.install_yarn(repo_config["node"]["yarn_version"], reporoot) except ImportError: - from devenv.lib import volta + from devenv.lib import volta # type: ignore[attr-defined] volta.install(reporoot) @@ -115,7 +115,7 @@ def main(context: dict[str, str]) -> int: reporoot, ) try: - limactl.install(reporoot) + limactl.install(reporoot) # type: ignore[call-arg] except TypeError: # again, it'll take 2 syncs to get here limactl.install(