Skip to content

Commit c1d82be

Browse files
authored
Merge pull request #1485 from FluxML/bc/rm-pycall
Swap PyCall to PythonCall
2 parents 223f856 + 0f5d958 commit c1d82be

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
6868
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
6969
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
7070
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
71-
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
71+
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
7272
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
7373
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
7474

7575
[targets]
76-
test = ["ChainRulesTestUtils", "Conda", "CUDA", "Distances", "FFTW", "FiniteDifferences", "PyCall", "Test"]
76+
test = ["ChainRulesTestUtils", "Conda", "CUDA", "Distances", "FFTW", "FiniteDifferences", "PythonCall", "Test"]

test/features.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -685,15 +685,11 @@ end
685685
end == ([8 112; 36 2004],)
686686
end
687687

688-
@testset "PyCall custom @adjoint" begin
689-
# Trigger Python install if required. Required for Buildkite CI!
690-
import Conda
691-
Conda.list()
692-
693-
import PyCall
694-
math = PyCall.pyimport("math")
688+
@testset "PythonCall custom @adjoint" begin
689+
using PythonCall: pyimport, pyconvert
690+
math = pyimport("math")
695691
pysin(x) = math.sin(x)
696-
Zygote.@adjoint pysin(x) = math.sin(x), (δ) ->* math.cos(x), )
692+
Zygote.@adjoint pysin(x) = pyconvert(Float64, math.sin(x)), δ -> (pyconvert(Float64, δ * math.cos(x)),)
697693
@test Zygote.gradient(pysin, 1.5) == Zygote.gradient(sin, 1.5)
698694
end
699695

test/runtests.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
using Zygote, Test, LinearAlgebra
22
using Zygote: gradient, ZygoteRuleConfig
3-
using CUDA
4-
using CUDA: has_cuda
53

64
@testset "all" begin # Overall testset ensures it keeps running after failure
7-
8-
if has_cuda()
9-
@testset "CUDA tests" begin
10-
include("cuda.jl")
5+
if !haskey(ENV, "GITHUB_ACTION")
6+
using CUDA
7+
if CUDA.has_cuda()
8+
@testset "CUDA tests" begin
9+
include("cuda.jl")
10+
end
11+
@info "CUDA tests have run"
12+
else
13+
@warn "CUDA not found - Skipping CUDA Tests"
1114
end
12-
@info "CUDA tests have run"
13-
else
14-
@warn "CUDA not found - Skipping CUDA Tests"
1515
end
1616

1717
@testset "deprecated.jl" begin

0 commit comments

Comments
 (0)