Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap PyCall to PythonCall #1485

Merged
merged 4 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"

[targets]
test = ["ChainRulesTestUtils", "Conda", "CUDA", "Distances", "FFTW", "FiniteDifferences", "PyCall", "Test"]
test = ["ChainRulesTestUtils", "Conda", "CUDA", "Distances", "FFTW", "FiniteDifferences", "PythonCall", "Test"]
12 changes: 4 additions & 8 deletions test/features.jl
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,11 @@ end
end == ([8 112; 36 2004],)
end

@testset "PyCall custom @adjoint" begin
# Trigger Python install if required. Required for Buildkite CI!
import Conda
Conda.list()

import PyCall
math = PyCall.pyimport("math")
@testset "PythonCall custom @adjoint" begin
using PythonCall: pyimport, pyconvert
math = pyimport("math")
pysin(x) = math.sin(x)
Zygote.@adjoint pysin(x) = math.sin(x), (δ) -> (δ * math.cos(x), )
Zygote.@adjoint pysin(x) = pyconvert(Float64, math.sin(x)), δ -> (pyconvert(Float64, δ * math.cos(x)),)
@test Zygote.gradient(pysin, 1.5) == Zygote.gradient(sin, 1.5)
end

Expand Down
18 changes: 9 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using Zygote, Test, LinearAlgebra
using Zygote: gradient, ZygoteRuleConfig
using CUDA
using CUDA: has_cuda

@testset "all" begin # Overall testset ensures it keeps running after failure

if has_cuda()
@testset "CUDA tests" begin
include("cuda.jl")
if !haskey(ENV, "GITHUB_ACTION")
using CUDA
if CUDA.has_cuda()
@testset "CUDA tests" begin
include("cuda.jl")
end
@info "CUDA tests have run"
else
@warn "CUDA not found - Skipping CUDA Tests"
end
@info "CUDA tests have run"
else
@warn "CUDA not found - Skipping CUDA Tests"
end

@testset "deprecated.jl" begin
Expand Down
Loading