JuliaPy / JuliaPy/PyCall.jl

Set environment variables without package rebuild?

Aperta
#977 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Begin with deps/build.jl and the PyCall build instructions, then inspect the GitHub Actions steps using julia-actions/julia-buildpkg and julia-actions/julia-runtest. Clarify whether MyPackage can configure PyCall before dependent packages build; done means a documented or supported workflow that avoids repeating the custom command for every dependent package.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
github-actions, julia
Ambito
build-system, ci-cd
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.