JuliaPy / JuliaPy/PyCall.jl

Set environment variables without package rebuild?

Offen
#977 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.