diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2e02c2e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,23 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + # To group all GitHub Actions updates into a single PR, uncomment the following: + # groups: + # github-actions: + # patterns: + # - "*" + - package-ecosystem: "julia" + directories: + - "/" + - "/docs" + schedule: + interval: "weekly" + # To group all Julia dependency updates into a single PR, uncomment the following: + # groups: + # julia-dependencies: + # patterns: + # - "*" diff --git a/.github/workflows/benchmark_pr.yml b/.github/workflows/benchmark_pr.yml index 0cd855e..206f2ab 100644 --- a/.github/workflows/benchmark_pr.yml +++ b/.github/workflows/benchmark_pr.yml @@ -13,16 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v7 + - uses: julia-actions/setup-julia@v3 with: version: "1" - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v3 - name: Extract Package Name from Project.toml id: extract-package-name run: | PACKAGE_NAME=$(grep "^name" Project.toml | sed 's/^name = "\(.*\)"$/\1/') - echo "::set-output name=package_name::$PACKAGE_NAME" + echo "package_name=$PACKAGE_NAME" >> "$GITHUB_OUTPUT" - name: Build SymPy env: JULIA_NUM_THREADS: 2 @@ -44,7 +44,7 @@ jobs: mkdir -p plots benchpkgplot ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --npart=10 --format=png --input-dir=results/ --output-dir=plots/ - name: Upload plot as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v7 with: name: plots path: plots @@ -62,7 +62,7 @@ jobs: echo 'Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).' >> body.md - name: Find Comment - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@v4 id: fcbenchmark with: issue-number: ${{ github.event.pull_request.number }} @@ -70,7 +70,7 @@ jobs: body-includes: Benchmark Results - name: Comment on PR - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v5 with: comment-id: ${{ steps.fcbenchmark.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} diff --git a/.github/workflows/ci-nightly.yml b/.github/workflows/ci-nightly.yml index 85bbd28..47c25b0 100644 --- a/.github/workflows/ci-nightly.yml +++ b/.github/workflows/ci-nightly.yml @@ -21,22 +21,13 @@ jobs: - macos-latest - windows-latest arch: - - x64 + - default steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v7 + - uses: julia-actions/setup-julia@v3 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/cache@v3 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 441e27c..0a59021 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,11 +26,11 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v7 + - uses: julia-actions/setup-julia@v3 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: julia-actions/cache@v1 + - uses: julia-actions/cache@v3 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 diff --git a/.gitignore b/.gitignore index 5268739..b17ab46 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ docs/site Manifest.toml appveyor.yml .travis.yml -default.profraw \ No newline at end of file +default.profraw +.idea/ +*.iml diff --git a/Project.toml b/Project.toml index a2c9751..f670368 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "SymPy" uuid = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6" -version = "2.3.3" +version = "2.3.4" [deps] CommonEq = "3709ef60-1bee-4518-9f2f-acd86f176c50" @@ -14,7 +14,7 @@ SymPyCore = "458b697b-88f0-4a86-b56b-78b75cfb3531" CommonEq = "0.2.1" CommonSolve = "0.2" LinearAlgebra = "1.10" -PyCall = "1.96.2" +PyCall = "1.97" SparseArrays = "1.1" SpecialFunctions = "0.7, 0.8, 0.8, 0.10, 1, 2" SymPyCore = "0.2.11,0.3" diff --git a/src/python_connection.jl b/src/python_connection.jl index b1aa6b8..584ab59 100644 --- a/src/python_connection.jl +++ b/src/python_connection.jl @@ -69,12 +69,8 @@ _up_matrix(m) = map(↑, m.tolist()) -# hash (work around pending PyCall release with its own hash) -function Base.hash(x::SymbolicObject{T}, h::UInt) where {T <: PyCall.PyObject} - o = ↓(x) - px = ccall((PyCall.@pysym :PyObject_Hash), PyCall.Py_hash_t, (PyCall.PyPtr,), o) # from PyCall.jl - reinterpret(UInt, Int(px)) - 3h # from PythonCall.jl -end +# hash: defer to PyCall (≥ 1.97), which acquires the GIL before calling PyObject_Hash +Base.hash(x::SymbolicObject{T}, h::UInt) where {T <: PyCall.PyObject} = hash(↓(x), h) # should we also have different code path for a::String like PyCall? diff --git a/test/runtests.jl b/test/runtests.jl index 3ddd9ed..514df2a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,15 @@ end using SymPy +using Test + +@testset "hash (issue with PyCall GIL release)" begin + @syms c() a b + d = Dict(c(0) => a) + @test d[c(0)] == a + @test hash(a + b) == hash(b + a) + @test length(Set([a, a, c(0), c(0)])) == 2 +end path = joinpath(pathof(SymPy.SymPyCore), "../../test") include(joinpath(path, "runtests-sympycore.jl"))