Skip to content

Commit aea784f

Browse files
authored
Don't use Pkg to compute project-version. (#114)
* Don't use Pkg to compute project-version. This feature from Pkg is apparently "experimental" and not well supported, so it's safer to just read from the TOML file ourselves. Also, TOML is a much smaller dependency than Pkg. * Bump patch version 0.2.6
1 parent 93b18be commit aea784f

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "RAI"
22
uuid = "9c30249a-7e08-11ec-0e99-a323e937e79f"
3-
version = "0.2.5"
3+
version = "0.2.6"
44

55
[deps]
66
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
@@ -12,8 +12,8 @@ ExceptionUnwrapping = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
1212
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
1313
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
1414
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533"
15-
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1615
ProtoBuf = "3349acd9-ac6a-5e09-bcdb-63829b23a429"
16+
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
1717
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
1818

1919
[compat]

src/RAI.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ APIs.
2020
"""
2121
module RAI
2222

23-
import Pkg
23+
import TOML
2424

2525
# Used for sending the User Agent.
26-
const PROJECT_VERSION = Pkg.project().version
26+
project_toml = joinpath(dirname(@__DIR__), "Project.toml")
27+
const PROJECT_VERSION = TOML.parsefile(project_toml)["version"]
2728

2829
export
2930
AccessToken,

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ end
3434
include("integration.jl")
3535
end
3636

37+
@testset "user-agent" begin
38+
@test RAI.PROJECT_VERSION isa String
39+
@test !isempty(RAI.PROJECT_VERSION)
40+
@test occursin(r"^rai-sdk-julia/\d+\.\d+\.\d+$", RAI._user_agent())
41+
end
42+
3743
# def output =
3844
# 1, "foo", 3.4, :foo;
3945
# 2, "bar", 5.6, :foo

0 commit comments

Comments
 (0)