1
1
class Vivaria < Formula
2
- # A brief description of the software
2
+ include Language :: Python :: Virtualenv
3
3
desc "Task environment setup tool for AI research"
4
-
5
- # The official website of the software
4
+ # AUTHORS: METR <[email protected] >
6
5
homepage "https://vivaria.metr.org/"
7
-
8
- # URL to the tarball of the release
9
- # This should point to a specific version, not a branch
10
- # This gets put into the temporary $(brew --cache)/downloads directory
11
- # Then gets extracted into $(brew --cache)/vivaria--[version].tar.gz/ directory
12
- # Install is then relied on to copy the necessary files to the Cellar
13
- url "https://github.com/GatlenCulp/vivaria/archive/refs/tags/v0.1.0.tar.gz"
14
-
15
- # SHA256 checksum of the tarball for security verification
16
- # Generate this with: curl -L <tarball_url> | shasum -a 256
17
- sha256 "eabcf6b3d0d63ba37cd6af03c0566e981d333b5a06fd38dd61102e9f72941ecd"
18
-
19
- # The license of the software
6
+ url "https://github.com/GatlenCulp/vivaria/archive/refs/tags/v0.1.1.tar.gz" #, tag: "v0.1.0"
7
+ version "0.1.0" # TODO: Grab the version from the tag(?)
8
+ sha256 "3360781d374e010e2b6c7a86b2cc5a91b51d6b2c5337d14788858a719af943d2"
20
9
license "MIT"
10
+ head "https://github.com/METR/vivaria.git" , branch : "main"
21
11
22
- # TODO: AUTHORS: METR <[email protected] >
12
+ # TODO: Make these options work
13
+ # option "with-dev-mode", "Install Vivaria for development of the software itself."
14
+ # option "without-cli", "Only install the Docker setup scripts and not the CLI."
23
15
24
- # Dependencies required to run the software
25
- # Brew will make sure these are installed before installing the software
26
- # `:run` means these are runtime dependencies
27
16
# This was fixed after I ran `brew link docker`
28
17
depends_on "docker" => :run
29
18
depends_on "docker-compose" => :run
30
- # TODO: Depends on python >= 3.11
31
- # python=">=3.11,<4"
32
- # For the CLI
33
- # Might not be necessary? I think homebrew already has python installed
34
- depends_on "python" => :build
19
+
35
20
36
21
DEV_MODE = false
37
22
38
- # The installation method
39
- # Brew tracks the files installed by the formula. But only removes files in the prefix directory
40
- # Cellar is within the prefix directory for formulas.
41
- def install
42
- # binding.pry for debugging, not set up yet
43
- # Create necessary directories in the Cellar
44
- # The `prefix` variable refers to the root directory of this formula in the Cellar
45
- # (prefix/"scripts").mkpath
46
- # (prefix/"docker").mkpath
23
+ resource "annotated-types" do
24
+ url "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz"
25
+ sha256 "aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"
26
+ end
27
+
28
+ resource "certifi" do
29
+ url "https://files.pythonhosted.org/packages/b0/ee/9b19140fe824b367c04c5e1b369942dd754c4c5462d5674002f75c4dedc1/certifi-2024.8.30.tar.gz"
30
+ sha256 "bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"
31
+ end
32
+
33
+ resource "charset-normalizer" do
34
+ url "https://files.pythonhosted.org/packages/63/09/c1bc53dab74b1816a00d8d030de5bf98f724c52c1635e07681d312f20be8/charset-normalizer-3.3.2.tar.gz"
35
+ sha256 "f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"
36
+ end
37
+
38
+ resource "fire" do
39
+ url "https://files.pythonhosted.org/packages/1b/1b/84c63f592ecdfbb3d77d22a8d93c9b92791e4fa35677ad71a7d6449100f8/fire-0.6.0.tar.gz"
40
+ sha256 "54ec5b996ecdd3c0309c800324a0703d6da512241bc73b553db959d98de0aa66"
41
+ end
42
+
43
+ resource "idna" do
44
+ url "https://files.pythonhosted.org/packages/00/6f/93e724eafe34e860d15d37a4f72a1511dd37c43a76a8671b22a15029d545/idna-3.9.tar.gz"
45
+ sha256 "e5c5dafde284f26e9e0f28f6ea2d6400abd5ca099864a67f576f3981c6476124"
46
+ end
47
47
48
- # These commands are ruby methods wrapping shell commands
49
- # Copy the setup scripts to the Cellar
50
- # The `buildpath` refers to the directory where the tarball was extracted
48
+ resource "pydantic" do
49
+ url "https://files.pythonhosted.org/packages/14/15/3d989541b9c8128b96d532cfd2dd10131ddcc75a807330c00feb3d42a5bd/pydantic-2.9.1.tar.gz"
50
+ sha256 "1363c7d975c7036df0db2b4a61f2e062fbc0aa5ab5f2772e0ffc7191a4f4bce2"
51
+ end
52
+
53
+ resource "pydantic-core" do
54
+ url "https://files.pythonhosted.org/packages/5c/cc/07bec3fb337ff80eacd6028745bd858b9642f61ee58cfdbfb64451c1def0/pydantic_core-2.23.3.tar.gz"
55
+ sha256 "3cb0f65d8b4121c1b015c60104a685feb929a29d7cf204387c7f2688c7974690"
56
+ end
57
+
58
+ resource "requests" do
59
+ url "https://files.pythonhosted.org/packages/63/70/2bf7780ad2d390a8d301ad0b550f1581eadbd9a20f896afe06353c2a2913/requests-2.32.3.tar.gz"
60
+ sha256 "55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"
61
+ end
62
+
63
+ resource "sentry-sdk" do
64
+ url "https://files.pythonhosted.org/packages/3c/23/6527e56fb17817153c37d702d6b9ed0a2f75ed213fd98a176c1b8894ad20/sentry_sdk-2.14.0.tar.gz"
65
+ sha256 "1e0e2eaf6dad918c7d1e0edac868a7bf20017b177f242cefe2a6bcd47955961d"
66
+ end
67
+
68
+ resource "six" do
69
+ url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz"
70
+ sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"
71
+ end
72
+
73
+ resource "termcolor" do
74
+ url "https://files.pythonhosted.org/packages/10/56/d7d66a84f96d804155f6ff2873d065368b25a07222a6fd51c4f24ef6d764/termcolor-2.4.0.tar.gz"
75
+ sha256 "aab9e56047c8ac41ed798fa36d892a37aca6b3e9159f3e0c24bc64a9b3ac7b7a"
76
+ end
77
+
78
+ resource "typeguard" do
79
+ url "https://files.pythonhosted.org/packages/8d/e1/3178b3e5369a98239ed7301e3946747048c66f4023163d55918f11b82d4e/typeguard-4.3.0.tar.gz"
80
+ sha256 "92ee6a0aec9135181eae6067ebd617fd9de8d75d714fb548728a4933b1dea651"
81
+ end
82
+
83
+ resource "typing-extensions" do
84
+ url "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz"
85
+ sha256 "1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"
86
+ end
87
+
88
+ resource "urllib3" do
89
+ url "https://files.pythonhosted.org/packages/ed/63/22ba4ebfe7430b76388e7cd448d5478814d3032121827c12a2cc287e2260/urllib3-2.2.3.tar.gz"
90
+ sha256 "e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"
91
+ end
92
+
93
+ def install
51
94
52
95
# Copy everything except certain directories
53
96
prefix . install Dir [ "*" ]
@@ -58,10 +101,9 @@ def install
58
101
rm_rf prefix /".github"
59
102
rm_rf prefix /".vscode"
60
103
61
-
62
104
# Set permissions for scripts
63
- chmod 0755 , prefix /"scripts/setup-docker-compose.sh"
64
- chmod 0755 , prefix /"scripts/configure-cli-for-docker-compose.sh"
105
+ # chmod 0755, prefix/"scripts/setup-docker-compose.sh"
106
+ # chmod 0755, prefix/"scripts/configure-cli-for-docker-compose.sh"
65
107
66
108
# These scripts must be run in the prefix directory to generate the files in the correct location
67
109
Dir . chdir ( prefix ) do
@@ -70,56 +112,55 @@ def install
70
112
system "./scripts/setup-docker-compose.sh"
71
113
raise "Setup script failed" unless $?. success?
72
114
73
- # # NOTE: Viv must be available via the command line before this is run.
115
+ # NOTE: Viv must be available via the command line before this is run.
74
116
# system "./scripts/configure-cli-for-docker-compose.sh"
75
117
# raise "Configuration script failed" unless $?.success?
76
118
end
77
119
78
- def cli_setup
79
- # TODO: Set up a "developer install" of the CLI. Is this useful or should they just work from a cloned repo?
80
- # TODO: Include Version: 1.0.0 from the pyproject.toml file
81
- Dir . chdir ( prefix ) do
82
- # Install python dependencies
83
- system "python3 -m venv venv"
84
- system "source ./venv/bin/activate"
85
- # Makes the CLI available in the command line
86
- # Non-editable mode are slightly faster, but editable mode is better for development
87
- if DEV_MODE then
88
- system "pip install -e cli"
89
- else
90
- system "pip install cli"
91
- end
92
- end
93
-
94
- # # Create necessary symlinks (to either /usr/local/bin or /opt/homebrew/bin)
95
- # # This is properly set up by homebrew, but this sets up the files in the CWD.
96
- # bin.install_symlink prefix/"scripts/setup-docker-compose.sh" => "vivaria-setup"
97
- # bin.install_symlink prefix/"scripts/configure-cli-for-docker-compose.sh" => "vivaria-cli-setup"
98
-
99
-
100
- # etc = editable text configurations
101
- # It is non-standard for homebrew to use ~/.config or ~/.<name> for configuration
102
- # Rather, it prefers to use /opt/homebrew/etc/<name> or /usr/local/etc/<name>
103
- # Create a directory for user configurations
120
+ # def cli_setup
121
+ # # TODO: Set up a "developer install" of the CLI. Is this useful or should they just work from a cloned repo?
122
+ # Dir.chdir(prefix) do
123
+
124
+ # venv = libexec/"venv"
125
+ # ENV["VIRTUAL_ENV"] = venv
126
+ # venv.mkpath
127
+ # system "python3", "-m", "venv", venv
128
+
129
+ # with_env(PATH: "#{venv}/bin:#{ENV["PATH"]}") do
130
+ # system "#{venv}/bin/pip", "install", "-v", "--no-deps", buildpath/"cli"
131
+ # end
132
+
133
+ # # Create the wrapper script in the bin directory
134
+ # (bin/"viv").write <<~EOS
135
+ # #!/bin/bash
136
+ # VENV_PATH="#{venv}"
137
+ # source "$VENV_PATH/bin/activate"
138
+ # "$VENV_PATH/bin/viv" "$@"
139
+ # deactivate
140
+ # EOS
141
+ # chmod 0755, bin/"viv"
142
+ # end
143
+
104
144
( etc /"vivaria" ) . mkpath
105
145
106
- # If there's a default configuration file, copy it to the etc directory
107
- # cp buildpath/"config.default", etc/"vivaria/config" if File.exist? buildpath/"config.default"
108
146
end
109
147
110
- def post_install
111
- ohai "Lol"
112
- end
113
148
# Information displayed after installation
114
149
def caveats
115
150
<<~EOS
116
- TODO: Add post-installation instructions here
117
- This will include steps to set up and run the Docker server
151
+ Post-installation instructions:
152
+
153
+ To set up and run the Docker server, run:
154
+ viv setup-docker-compose
155
+
156
+ For more information, visit:
157
+ https://vivaria.metr.org/
118
158
EOS
119
159
end
120
160
121
- # Test to ensure the formula was installed correctly
122
161
test do
123
- # TODO: Add a simple test to check if the installation was successful
162
+ # TODO: Make this test work.
163
+ output = shell_output ( "#{ bin } /viv --version" )
164
+ assert_match "vivaria version #{ version } " , output . strip
124
165
end
125
166
end
0 commit comments