JuliaPy / JuliaPy/PyCall.jl

Set environment variables without package rebuild?

Open
#977 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I have the following in my `deps/build.jl` file:

```julia
using PyCall
PyCall.Conda.add("wfdb")
```

And inside module:
```julia
module MyPackage
const WFDB = PyNULL()
function __init__()
copy!(WFDB, pyimport("wfdb"))
end
end # module
```

But this doesn't work on Linux, because there are different paths for `PyCall.libpython` and `PyCall.Conda.PYTHONDIR`.
As explained in the PyCall documentation, I should set `ENV["PYTHON"]=""`, run `Pkg.build("PyCall")`, and re-launch Julia.

So, in GH Actions I've added a custom `run` command for MyPackage:
```yaml
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-arch }}
- uses: julia-actions/julia-buildpkg@v1
- run: julia --project=@. -e 'import Pkg; ENV["PYTHON"]=""; Pkg.add("PyCall"); Pkg.build("PyCall")'
- uses: julia-actions/julia-runtest@v1
```

But it breaks again in GH Actions for other packages, if they have MyPackage as a dependency.

So, should I really repeat this custom `run` command to all other packages that rely on MyPackage?

Or maybe I can somehow add scripts in my package, that will be run before build?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.