Skip to content

Commit e597206

Browse files
committed
clean up conda installs
avoid use of PythonCall resolve all conda changes at once
1 parent 2d07eac commit e597206

File tree

3 files changed

+60
-38
lines changed

3 files changed

+60
-38
lines changed

Project.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ authors = ["Matt Johnson <[email protected]>", "Hao-Wei Pang <hao4wei3pang2@
44
version = "1.0.0"
55

66
[deps]
7+
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
78
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
89
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
910
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
10-
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
1111
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
1212
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
1313
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
@@ -17,6 +17,7 @@ IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
1717
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1818
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1919
LsqFit = "2fda8390-95c7-5789-9bda-21331edee243"
20+
MicroMamba = "0b3b1443-0f03-428d-bdfb-f27f9c1191ea"
2021
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
2122
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2223
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
@@ -41,18 +42,18 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
4142
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
4243

4344
[compat]
45+
CSV = "0.10"
4446
Calculus = "0.4,0.5"
4547
Colors = "0.11,0.12"
4648
CondaPkg = "0.2"
47-
CSV = "0.10"
4849
DataFrames = "1"
49-
SciMLSensitivity = "^7"
5050
FastGaussQuadrature = "0.5"
5151
ForwardDiff = "0.10"
5252
Images = "0.24"
5353
IncompleteLU = "0.2"
5454
IterTools = "1.3"
5555
LsqFit = "0.12"
56+
MicroMamba = "0.1"
5657
ModelingToolkit = "8"
5758
OrdinaryDiffEq = "^6"
5859
Parameters = "0.12"
@@ -63,6 +64,7 @@ QuartzImageIO = "0.7"
6364
RecursiveArrayTools = "2.17"
6465
ReverseDiff = "1.9"
6566
SciMLBase = "^1"
67+
SciMLSensitivity = "^7"
6668
SmoothingSplines = "0.3"
6769
SpecialFunctions = "1"
6870
StaticArrays = "1"

src/ReactionMechanismSimulator.jl

+28-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
module ReactionMechanismSimulator
2-
using PythonCall
2+
ENV["JULIA_CONDAPKG_BACKEND"] = "MicroMamba"
33
using CondaPkg
44
using Logging
5+
packages = keys(CondaPkg.current_packages())
6+
7+
if !("rmg" in packages) && !("rmgmolecule" in packages)
8+
@info "missing rmg and rmgmolecule installing rmgmolecule..."
9+
if "python" in packages
10+
py_version = VersionNumber(CondaPkg.current_packages()["python"][:version])
11+
else
12+
py_version = nothing
13+
end
14+
if py_version === nothing || !(v"3.7" <= py_version && py_version <= v"3.9")
15+
@info "python version was not in 3.7-3.9 changing python version"
16+
CondaPkg.add("python"; version="3.9",resolve=false)
17+
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541",resolve=false)
18+
CondaPkg.add("matplotlib", channel="conda-forge",resolve=false)
19+
CondaPkg.add("rdkit", channel="conda-forge",resolve=false)
20+
CondaPkg.add("pydot", channel="conda-forge",resolve=false)
21+
CondaPkg.resolve()
22+
else
23+
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541",resolve=false)
24+
CondaPkg.add("matplotlib", channel="conda-forge",resolve=false)
25+
CondaPkg.add("rdkit", channel="conda-forge",resolve=false)
26+
CondaPkg.add("pydot", channel="conda-forge",resolve=false)
27+
CondaPkg.resolve()
28+
end
29+
end
30+
31+
using PythonCall
532
const Chem = PythonCall.pynew()
633
const Desc = PythonCall.pynew()
734
const molecule = PythonCall.pynew()
@@ -17,24 +44,6 @@ const solvation = PythonCall.pynew()
1744
const fragment = PythonCall.pynew()
1845
const pydot = PythonCall.pynew()
1946

20-
packages = keys(CondaPkg.current_packages())
21-
22-
if !("rmg" in packages) && !("rmgmolecule" in packages)
23-
@info "missing rmg and rmgmolecule installing rmgmolecule..."
24-
if !(v"3.7" <= PythonCall.C.python_version() && PythonCall.C.python_version() <= v"3.9")
25-
@info "python version was not in 3.7-3.9 changing python version"
26-
CondaPkg.add("python"; version="3.9")
27-
end
28-
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541")
29-
CondaPkg.add("matplotlib", channel="conda-forge")
30-
CondaPkg.add("rdkit", channel="conda-forge")
31-
CondaPkg.add("pydot", channel="conda-forge")
32-
33-
Pkgc = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
34-
Pkgc.build("PythonCall")
35-
end
36-
37-
3847
function __init__()
3948
PythonCall.pycopy!(Chem, pyimport("rdkit.Chem"))
4049
PythonCall.pycopy!(Desc, pyimport("rdkit.Chem.Descriptors"))

src/rmstest.jl

+27-16
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,41 @@
11
import Logging
22
Logging.disable_logging(Logging.Warn)
3-
4-
using PythonCall
5-
using CondaPkg
6-
const Chem = PythonCall.pynew()
7-
const molecule = PythonCall.pynew()
8-
const fragment = PythonCall.pynew()
9-
const pydot = PythonCall.pynew()
3+
ENV["JULIA_CONDAPKG_BACKEND"] = "MicroMamba"
4+
using CondaPkg
105

116
packages = keys(CondaPkg.current_packages())
127

138
if !("rmg" in packages) && !("rmgmolecule" in packages)
149
@info "missing rmg and rmgmolecule installing rmgmolecule..."
15-
if !(v"3.7" <= PythonCall.C.python_version() && PythonCall.C.python_version() <= v"3.9")
10+
if "python" in packages
11+
py_version = VersionNumber(CondaPkg.current_packages()["python"][:version])
12+
else
13+
py_version = nothing
14+
end
15+
if py_version === nothing || !(v"3.7" <= py_version && py_version <= v"3.9")
1616
@info "python version was not in 3.7-3.9 changing python version"
17-
CondaPkg.add("python"; version="3.9")
17+
CondaPkg.add("python"; version="3.9",resolve=false)
18+
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541",resolve=false)
19+
CondaPkg.add("matplotlib", channel="conda-forge",resolve=false)
20+
CondaPkg.add("rdkit", channel="conda-forge",resolve=false)
21+
CondaPkg.add("pydot", channel="conda-forge",resolve=false)
22+
CondaPkg.resolve()
23+
else
24+
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541",resolve=false)
25+
CondaPkg.add("matplotlib", channel="conda-forge",resolve=false)
26+
CondaPkg.add("rdkit", channel="conda-forge",resolve=false)
27+
CondaPkg.add("pydot", channel="conda-forge",resolve=false)
28+
CondaPkg.resolve()
1829
end
19-
CondaPkg.add("rmgmolecule"; version=">=0.3.0", channel="mjohnson541")
20-
CondaPkg.add("matplotlib", channel="conda-forge")
21-
CondaPkg.add("rdkit", channel="conda-forge")
22-
CondaPkg.add("pydot", channel="conda-forge")
23-
24-
Pkgc = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
25-
Pkgc.build("PythonCall")
2630
end
2731

32+
using PythonCall
33+
34+
const Chem = PythonCall.pynew()
35+
const molecule = PythonCall.pynew()
36+
const fragment = PythonCall.pynew()
37+
const pydot = PythonCall.pynew()
38+
2839
PythonCall.pycopy!(Chem, pyimport("rdkit.Chem"))
2940
try
3041
PythonCall.pycopy!(molecule, pyimport("rmgpy.molecule"))

0 commit comments

Comments
 (0)