Skip to content

Commit

Permalink
Add preference-based shared Conda env for Thermo
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Ames committed Apr 3, 2024
1 parent f4e73fa commit d33c7e6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
20 changes: 12 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
authors = ["Alex Ames <[email protected]> and contributors"]
name = "PyThermo"
uuid = "6fae04a5-42e9-4d0c-90a8-26d1a9434b6b"
authors = ["Alex Ames <[email protected]> and contributors"]
version = "0.2.4"
version = "0.2.5"

[compat]
CondaPkg = "0.2"
PythonCall = "0.9"
Unitful = "1.6"
julia = "1.6"

[deps]
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
CondaPkg = "0.2"
PythonCall = "0.9"
Unitful = "1.6"
julia = "1.6"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[preferences.CondaPkg]
env = "@Thermo"

[targets]
test = ["Aqua", "Test", "Unitful"]
9 changes: 5 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Mixture
## Interaction with Conda
PyThermo's Python dependencies are managed by CondaPkg.jl, which registers
a project's dependencies in CondaPkg.toml (similar to Julia's Project.toml).
These dependencies are installed automatically when PyThermo is first loaded.
To avoid Conda management overhead during subsequent initialization of PyThermo,
the `JULIA_CONDAPKG_OFFLINE` environment is set to `"true"` by default. This can
be overriden by setting `JULIA_CONDAPKG_OFFLINE` to `"false"` before loading PyThermo.
These dependencies are installed automatically in a shared Conda environment
located at ~/.julia/conda_environments/Thermo when PyThermo is first loaded.
If you'd like to use a different Conda environment, you can set the corresponding preference
as described in the [CondaPkg.jl documentation](https://github.com/JuliaPy/CondaPkg.jl?tab=readme-ov-file#preferences).

17 changes: 9 additions & 8 deletions src/PyThermo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ module PyThermo
# if .CondaPkg exists in the current environment, use "true" to skip
# Conda pkg resolution. Otherwise, use "false" to allow Conda to
# resolve the pkg environment.
using Pkg
get!(ENV, "JULIA_CONDAPKG_OFFLINE") do
if ispath(joinpath(dirname(Pkg.project().path), ".CondaPkg"))
"yes"
else
"no"
end
end
# using Pkg
# get!(ENV, "JULIA_CONDAPKG_OFFLINE") do
# if ispath(joinpath(dirname(Pkg.project().path), ".CondaPkg"))
# "yes"
# else
# "no"
# end
# end

using CondaPkg
using PythonCall
using Printf
using Unitful
Expand Down

0 comments on commit d33c7e6

Please sign in to comment.